/* =============================================================================
   RivalScan — layout.css
   Estruturas de layout: páginas de auth, header, sidebar, footer, app shell
   ============================================================================= */

/* ─────────────────────────────────────────────────────────────────────────────
   AUTH LAYOUT (login, registro, recuperar senha, nova senha)
   ───────────────────────────────────────────────────────────────────────────── */

/* Glow radial central — exclusivo das páginas auth */
.auth-page body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(0, 212, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.auth-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* Glow radial inline (aplicado via elemento no body das auth pages) */
.auth-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(0, 212, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-card);
    padding: 40px 40px 36px;
    box-shadow:
        0 0 0 1px rgba(0, 212, 255, 0.06),
        0 24px 64px rgba(0, 0, 0, 0.4);
    animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-card.wide { max-width: 520px; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Logo nas páginas auth */
.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    text-decoration: none;
}

.auth-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.auth-logo-text {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

/* Textos do card auth */
.auth-title {
    font-size: 22px;
    font-weight: 700;
    color: #F0F4F8;
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 28px;
    line-height: 1.5;
}

/* Links auxiliares */
.auth-link {
    color: var(--cyan);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.auth-link:hover { opacity: 0.8; text-decoration: underline; }

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
}

.auth-footer a {
    color: var(--cyan);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover { text-decoration: underline; }

.forgot-link {
    display: block;
    text-align: right;
    font-size: 12px;
    color: var(--text-light);
    text-decoration: none;
    margin-top: 6px;
    transition: color 0.2s;
}

.forgot-link:hover { color: var(--cyan); }

/* ─────────────────────────────────────────────────────────────────────────────
   APP SHELL — Header + Sidebar + Main + Footer
   ───────────────────────────────────────────────────────────────────────────── */

:root {
    --header-h:          62px;
    --sidebar-w:         250px;
    --sidebar-collapsed: 60px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--bg-main);
    border-bottom: 1px solid var(--cyan);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    gap: 16px;
    box-shadow: 0 2px 20px rgba(0, 212, 255, 0.06);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
    min-width: 160px;
}

.header-logo-icon {
    width: 32px; height: 32px;
    background: var(--gradient);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0;
}

.header-logo-text {
    font-size: 17px; font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

.header-brand {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-btn);
    padding: 6px 12px;
    font-size: 13px; font-weight: 500;
    color: #E2E8F0;
    cursor: pointer;
    transition: border-color 0.2s;
    max-width: 180px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.header-brand:hover { border-color: var(--cyan); }

.header-brand-arrow {
    flex-shrink: 0;
    color: var(--text-light);
    font-size: 10px;
}

.header-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.header-search-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-btn);
    padding: 8px 14px 8px 36px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    color: #E2E8F0;
    outline: none;
    transition: border-color 0.2s;
}

.header-search-input::placeholder { color: var(--text-medium); }
.header-search-input:focus { border-color: var(--cyan); }

.header-search-icon {
    position: absolute;
    left: 11px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-medium);
    pointer-events: none;
}

.header-right {
    display: flex; align-items: center; gap: 6px;
    margin-left: auto;
}

/* Barra de trial no header */
.header-trial {
    display: flex; align-items: center; gap: 8px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-btn);
    padding: 5px 12px;
    font-size: 12px; font-weight: 600;
    color: var(--warning);
    margin-right: 8px;
    white-space: nowrap;
}

/* Botão de ícone (notificações, etc) */
.header-icon-btn {
    position: relative;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-btn);
    cursor: pointer; color: var(--text-light);
    transition: border-color 0.2s, color 0.2s;
    text-decoration: none;
}

.header-icon-btn:hover { border-color: var(--cyan); color: var(--cyan); }

.header-notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 9px; font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
    border: 2px solid var(--bg-main);
}

/* Avatar + dropdown */
.header-avatar-wrap { position: relative; }

.header-avatar {
    width: 36px; height: 36px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; color: #fff;
    cursor: pointer;
    transition: box-shadow 0.2s;
    border: 2px solid transparent;
    user-select: none;
}

.header-avatar:hover { box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2); }

.header-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px); right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-card);
    min-width: 200px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    z-index: 200;
    overflow: hidden;
}

.header-dropdown.open { display: block; }

.dropdown-user {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-dark);
}

.dropdown-user-name {
    font-size: 13px; font-weight: 600; color: #E2E8F0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dropdown-user-email {
    font-size: 11px; color: var(--text-light); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    font-size: 13px; font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

.dropdown-item:hover { background: var(--bg-tertiary); color: #E2E8F0; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: rgba(239, 68, 68, 0.08); }

.dropdown-divider {
    height: 1px;
    background: var(--border-dark);
    margin: 4px 0;
}

.badge-admin {
    background: var(--gradient);
    color: #fff;
    font-size: 9px; font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Hamburguer mobile */
.header-menu-btn {
    display: none;
    width: 36px; height: 36px;
    align-items: center; justify-content: center;
    background: none; border: none;
    color: #E2E8F0; cursor: pointer;
    padding: 0; flex-shrink: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.app-sidebar {
    position: fixed;
    top: var(--header-h); left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    background: var(--bg-main);
    border-right: 1px solid var(--border-dark);
    padding: 16px 12px;
    z-index: 900;
    overflow-y: auto;
    display: flex; flex-direction: column;
    transition: transform 0.25s ease, width 0.25s ease;
}

.sidebar-nav { flex: 1; }

.sidebar-section { margin-bottom: 24px; }

.sidebar-label {
    font-size: 10px; font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase; letter-spacing: 1.5px;
    padding: 0 10px; margin-bottom: 6px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-btn);
    color: var(--text-light);
    font-size: 13px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: background 0.15s, color 0.15s;
    position: relative;
    white-space: nowrap;
}

.nav-item:hover { background: var(--bg-secondary); color: #E2E8F0; }

.nav-item.active {
    background: rgba(0, 212, 255, 0.1);
    color: var(--cyan);
}

.nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 6px; bottom: 6px;
    width: 3px; background: var(--cyan);
    border-radius: 0 3px 3px 0;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff; font-size: 10px; font-weight: 700;
    padding: 1px 6px; border-radius: 10px;
    min-width: 18px; text-align: center;
}

/* Bloco de plano no rodapé da sidebar */
.sidebar-plan {
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-card);
    padding: 14px;
    margin-top: 8px;
}

.sidebar-plan-label {
    font-size: 10px; font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 6px;
}

.sidebar-plan-name {
    font-size: 14px; font-weight: 600; color: #E2E8F0;
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 10px;
}

.plan-badge {
    background: var(--gradient);
    padding: 1px 7px; border-radius: 4px;
    font-size: 9px; font-weight: 700; color: #fff;
    letter-spacing: 0.5px;
}

.sidebar-usage-label {
    font-size: 11px; color: var(--text-light);
    margin-bottom: 6px;
}

.sidebar-usage-label b { color: var(--cyan); }

.sidebar-bar {
    width: 100%; height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px; overflow: hidden;
    margin-bottom: 6px;
}

.sidebar-bar-fill {
    height: 100%; border-radius: 2px;
    background: var(--gradient);
    transition: width 0.4s ease;
}

.sidebar-upgrade {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 11px; font-weight: 600;
    color: var(--cyan);
    text-decoration: none;
    padding: 6px;
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: var(--radius-btn);
    transition: background 0.2s;
}

.sidebar-upgrade:hover { background: rgba(0, 212, 255, 0.08); }

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 850;
}

.sidebar-overlay.open { display: block; }

/* ── Main content ────────────────────────────────────────────────────────── */
.app-main {
    margin-left: var(--sidebar-w);
    margin-top: var(--header-h);
    padding: 28px 32px 60px;
    min-height: calc(100vh - var(--header-h));
    background: #F0F4F8;
}

/* Sem sidebar (onboarding, páginas especiais) */
.app-main.no-sidebar {
    margin-left: 0;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.app-footer {
    margin-left: var(--sidebar-w);
    background: #F0F4F8;
    border-top: 1px solid var(--border-light);
    padding: 14px 32px;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: var(--text-medium);
    gap: 12px; flex-wrap: wrap;
}

.app-footer.no-sidebar { margin-left: 0; }

.footer-version { color: var(--text-light); font-size: 11px; }