/* ============================================================
   LAYOUT — Imper Credi Brasil
   ============================================================ */

@keyframes spin { to { transform: rotate(360deg); } }

/* BASE */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0a0a0a; color: #f0f0f0; font-family: 'Segoe UI', system-ui, sans-serif; min-height: 100vh; }
#app-root { min-height: 100vh; }

/* ============================================================
   BANNER "ADICIONAR À TELA DE INÍCIO" (iOS/Safari)
   ============================================================ */
.ios-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--bottom-nav-height, 64px) + 12px);
  z-index: var(--z-toast, 300);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--color-surface, #141414);
  border: 1px solid var(--color-brand-gold, #c9a84c);
  border-radius: var(--radius-md, 10px);
  padding: 12px 14px;
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(0,0,0,0.6));
  animation: ios-banner-in 250ms ease;
}
@keyframes ios-banner-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ios-install-banner-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.ios-install-banner-text { flex: 1; font-size: var(--font-size-sm, 13px); color: var(--color-text, #f0f0f0); line-height: 1.5; }
.ios-install-banner-text strong { color: var(--color-brand-gold, #c9a84c); }
.ios-install-banner-text p { margin-top: 4px; color: var(--color-text-secondary, #aaaaaa); }
.ios-install-banner-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted, #888888);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.ios-install-banner-action {
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--color-brand-red, #c8102e);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ios-install-banner-close:hover,
.ios-install-banner-close:focus-visible { color: var(--color-text, #f0f0f0); }

@media (min-width: 769px) {
  /* Desktop: sidebar não tem bottom-nav, então cola no rodapé da tela */
  .ios-install-banner { bottom: 16px; max-width: 420px; left: auto; right: 16px; }
}

/* ============================================================
   ADMIN SHELL
   ============================================================ */

/* Wrapper: sidebar à esquerda, main à direita — igual ao cliente */
.adm-shell {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR — sticky, acompanha o scroll da página */
.adm-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #0d0d0d;
  border-right: 1px solid #1e1e1e;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.adm-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #1e1e1e;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.adm-sidebar-logo {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid #a07828;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #1a0a0a;
}
.adm-sidebar-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.adm-sidebar-name     { font-size: 13px; font-weight: 600; color: #f0f0f0; line-height: 1.4; }
.adm-sidebar-name small { color: #666; font-weight: 400; font-size: 11px; }

.adm-nav-section { padding: 16px 16px 4px; font-size: 10px; font-weight: 700; color: #444; text-transform: uppercase; letter-spacing: 1px; }

.adm-sidebar-nav { flex: 1; padding: 8px 0; }

.adm-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  color: #aaa; font-size: 14px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.adm-nav-item:hover  { background: rgba(255,255,255,0.04); color: #f0f0f0; }
.adm-nav-item.active { background: rgba(200,16,46,0.15); color: #ff6080; border-left-color: #c8102e; font-weight: 600; }
.adm-nav-icon        { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.adm-nav-icon svg    { width: 18px; height: 18px; }

.adm-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #1e1e1e;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.adm-sidebar-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,#6a0010,#a07828); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.adm-sidebar-user   { flex: 1; min-width: 0; }
.adm-sidebar-username { font-size: 12px; font-weight: 500; color: #f0f0f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-sidebar-role     { font-size: 10px; color: #666; }
.adm-sidebar-logout   { padding: 4px 8px; border-radius: 6px; background: transparent; color: #666; cursor: pointer; font-size: 12px; border: 1px solid #2a2a2a; white-space: nowrap; transition: all 0.15s; }
.adm-sidebar-logout:hover { background: rgba(200,16,46,0.15); color: #c8102e; border-color: #c8102e; }

/* Overlay mobile */
.adm-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 99; }
.adm-overlay.active { display: block; }

/* MAIN AREA */
.adm-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOPBAR */
.adm-topbar {
  height: 56px;
  background: #0d0d0d;
  border-bottom: 1px solid #1e1e1e;
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 90;
}
.adm-hamburger    { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 6px; background: #1c1c1c; color: #aaa; font-size: 18px; cursor: pointer; border: 1px solid #2a2a2a; flex-shrink: 0; }
.adm-topbar-title { font-size: 15px; font-weight: 600; color: #f0f0f0; flex: 1; }
.adm-topbar-role  { font-size: 12px; color: #666; white-space: nowrap; }
.adm-topbar-back  { display: none !important; }

/* CONTENT */
.adm-content {
  flex: 1;
  padding: 24px;
}

/* ============================================================
   PAGE ELEMENTS (usados pelas pages admin)
   ============================================================ */
.page-header         { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header-left    { display: flex; align-items: center; gap: 12px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-title          { font-size: 26px; font-weight: 700; color: #f0f0f0; line-height: 1.2; }
.page-subtitle       { font-size: 13px; color: #888; margin-top: 2px; }

/* alias para page-content (usado por pages que pegam #page-content) */
#page-content { flex: 1; }

.detail-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ============================================================
   CLIENT SHELL (não muda — já funciona)
   ============================================================ */
.main-with-bottomnav {
  min-height: 100vh;
  padding-bottom: 64px;
  display: flex; flex-direction: column;
}
.main-with-bottomnav #page-content,
.main-with-bottomnav .page-content { padding: 16px; flex: 1; }

.topbar {
  height: 56px; background: #0d0d0d; border-bottom: 1px solid #1e1e1e;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 90;
}
.topbar-title   { font-size: 15px; font-weight: 600; color: #f0f0f0; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 64px;
  background: #0d0d0d; border-top: 1px solid #1e1e1e;
  display: flex; align-items: center; justify-content: space-around;
  z-index: 100;
}
.bottom-nav-item  { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px; color: #555; font-size: 10px; font-weight: 500; cursor: pointer; text-decoration: none; transition: color 0.15s; flex: 1; text-align: center; }
.bottom-nav-item:hover  { color: #888; }
.bottom-nav-item.active { color: #c9a84c; }
.bottom-nav-icon  { font-size: 20px; line-height: 1; }
.bottom-nav-label { font-size: 10px; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #0a0a0a; padding: 16px; }
.login-card { background: #141414; border: 1px solid #2a2a2a; border-radius: 20px; padding: 32px; width: 100%; max-width: 420px; }
.login-logo     { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; gap: 12px; }
.login-logo-img { width: 90px; height: 90px; border-radius: 50%; overflow: hidden; border: 2px solid #a07828; }
.login-logo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-logo-icon { width: 90px; height: 90px; border-radius: 50%; background: #1a0a0a; border: 2px solid #a07828; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; color: #c9a84c; }
.login-logo-text { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.login-logo-name { font-size: 18px; font-weight: 700; color: #fff; line-height: 1.1; }
.login-logo-sub  { font-size: 18px; font-weight: 700; color: #fff; text-align: center; line-height: 1.1; }

/* ============================================================
   CLIENT HERO
   ============================================================ */
.client-hero { background: linear-gradient(135deg,#3a0010 0%,#1a0a0a 60%,#141414 100%); border-radius: 16px; padding: 20px; margin-bottom: 16px; border: 1px solid rgba(200,16,46,0.2); }
.client-hero-greeting   { font-size: 13px; color: rgba(255,255,255,0.5); }
.client-hero-name       { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 16px; }
.client-hero-stats      { display: flex; gap: 20px; flex-wrap: wrap; }
.client-hero-stat-label { font-size: 11px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.5px; }
.client-hero-stat-value { font-size: 18px; font-weight: 700; color: #c9a84c; }

.account-status-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #141414; border: 1px solid #2a2a2a; border-radius: 12px; margin-bottom: 16px; font-size: 13px; color: #f0f0f0; }
.account-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.account-status-dot.active    { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.account-status-dot.pending   { background: #f59e0b; }
.account-status-dot.suspended { background: #ef4444; }

/* ============================================================
   LOADING INLINE
   ============================================================ */
.loading-spinner-inline { display: flex; align-items: center; justify-content: center; padding: 3rem; color: #666; font-size: 14px; gap: 12px; }
.loading-spinner-inline::before { content: ''; width: 20px; height: 20px; border: 2px solid #a07828; border-top-color: #c9a84c; border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }

/* ============================================================
   LOADING SCREEN
   ============================================================ */
.loading-screen { position: fixed; inset: 0; background: #0a0a0a; display: flex; align-items: center; justify-content: center; z-index: 999; transition: opacity 0.4s; }
.loading-inner  { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.loading-logo   { width: 90px; height: 90px; border-radius: 50%; overflow: hidden; border: 2px solid #a07828; }
.loading-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.loading-logo-text { width: 90px; height: 90px; border-radius: 50%; background: #1a0a0a; border: 2px solid #a07828; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: #c9a84c; }
.loading-name   { color: #666; font-size: 12px; letter-spacing: 3px; text-transform: uppercase; }
.loading-spinner { width: 28px; height: 28px; border: 2px solid rgba(201,168,76,0.2); border-top-color: #c9a84c; border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .adm-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .adm-sidebar.open    { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
  .adm-hamburger       { display: flex; }
  .adm-topbar-back     { display: flex !important; }
  .adm-topbar-role     { display: none; }
  .adm-content         { padding: 16px; }
  .detail-grid, .dashboard-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .page-title  { font-size: 20px; }
  .page-header { margin-bottom: 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

@media (min-width: 1025px) {
  /* Desktop: em vez de esconder o menu, transforma a bottom-nav numa
     barra de navegação fixa no topo (abaixo do topbar), mantendo os
     mesmos itens/ids/listeners — antes o cliente ficava sem acesso a
     Crédito/Capital/Histórico no desktop, só com sino/perfil/logout. */
  /* Correção 2026-09-27: o cabeçalho (logo, título, sino, sair) ficava
     ESCONDIDO atrás da barra de menu — o padding de 52px empurrava o
     cabeçalho pra baixo, bem onde a barra fixa (top: 56px) é desenhada.
     Agora o cabeçalho fica fixo no topo e a barra logo abaixo dele. */
  .main-with-bottomnav { padding-bottom: 0; padding-top: 108px; }
  .main-with-bottomnav > .topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 101; }
  .bottom-nav {
    position: fixed; top: 56px; bottom: auto; left: 0; right: 0;
    height: 52px; justify-content: center; gap: 8px;
    border-top: none; border-bottom: 1px solid #1e1e1e;
  }
  .bottom-nav-item {
    flex: 0 0 auto; flex-direction: row; gap: 8px; padding: 8px 18px;
    font-size: 13px; border-radius: 8px;
  }
  .bottom-nav-item:hover  { background: #1a1a1a; }
  .bottom-nav-item.active { background: #1c1c1c; }
  .bottom-nav-label { font-size: 13px; }
  .client-profile-btn { display: inline-flex; }
}
@media (max-width: 1024px) {
  .client-profile-btn { display: none !important; }
}
.login-social-icon:hover { transform: scale(1.1); }
