/* ============================================================
   Configura Shared Nav — nav.css
   Matches index.html authenticated dashboard nav exactly.
   ============================================================ */

:root {
    --nav-height: 70px;
    --nav-bg: #ffffff;
    --nav-border: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --bg-secondary: #f6f7f9;
    --bg-elevated: #f0f2f5;
    --border-subtle: #e5e7eb;
    --accent-primary: #4f46e5;
    --sidebar-width: 240px;
}

/* Dark theme for landing page nav */
#configura-nav[data-landing="true"] {
    --nav-bg: rgba(10, 10, 11, 0.9);
    --nav-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --bg-secondary: rgba(255, 255, 255, 0.05);
    --bg-elevated: rgba(255, 255, 255, 0.1);
    --border-subtle: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
}

/* ── Nav shell ──────────────────────────────────────────────── */
#configura-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(12px, 2vw, 24px);
    padding: 0 clamp(16px, 3vw, 32px);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Logo ───────────────────────────────────────────────────── */
.cn-logo {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 10px);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    letter-spacing: -0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}
.cn-logo svg,
.cn-logo .cn-logo-icon {
    height: clamp(24px, 4vw, 32px);
    width: auto;
    flex-shrink: 0;
}

/* ── Center: search + dropdowns ────────────────────────────── */
.cn-center {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 24px;
    min-width: 0;
}

/* Search */
.cn-search {
    position: relative;
    flex: 1;
    max-width: 320px;
}
.cn-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.cn-search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}
.cn-search-input::placeholder { color: var(--text-muted); }
.cn-search-input:focus {
    border-color: var(--accent-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.cn-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: none;
    max-height: 360px;
    overflow-y: auto;
    z-index: 1000;
}
.cn-search-results.active { display: block; }
.cn-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    transition: background 0.15s;
}
.cn-search-result:hover { background: var(--bg-elevated); }
.cn-search-result-icon {
    width: 32px; height: 32px;
    border-radius: 7px;
    background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.cn-search-result-name { font-weight: 500; font-size: 13px; }
.cn-search-result-type { font-size: 11px; color: var(--text-muted); }
.cn-search-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Dropdowns — exact match to index.html .nav-dropdown-trigger */
.cn-dropdowns { display: flex; align-items: center; gap: 2px; }
.cn-dropdown { position: relative; }
.cn-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.cn-dropdown-trigger:hover,
.cn-dropdown-trigger.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
}
.cn-dropdown-trigger svg { transition: transform 0.2s ease; }
.cn-dropdown-trigger.active svg:last-child { transform: rotate(180deg); }
.cn-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.18s ease;
    z-index: 200;
    padding: 6px;
}
.cn-dropdown-menu.right { left: auto; right: 0; }
.cn-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.cn-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 7px;
    transition: all 0.12s;
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    text-align: left;
}
.cn-dropdown-item:hover { color: var(--text-primary); background: var(--bg-elevated); }
.cn-dropdown-item svg { opacity: 0.6; flex-shrink: 0; }
.cn-dropdown-item:hover svg { opacity: 1; }
.cn-dropdown-divider { height: 1px; background: var(--border-subtle); margin: 5px 0; }

/* ── Right side ─────────────────────────────────────────────── */
.cn-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* User button — exact match to body.authenticated .user-button */
.cn-user-menu { position: relative; }
.cn-user-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
}
.cn-user-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
}

/* Avatar — exact match to body.authenticated .user-avatar */
.cn-avatar {
    width: 32px; height: 32px;
    background: #1a1a1a;
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* User name — show full name, no truncation */
.cn-user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

/* User dropdown — exact match to body.authenticated .user-dropdown */
.cn-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    overflow: hidden;
}
.cn-user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.cn-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f2;
}
.cn-dropdown-header .cn-avatar { width: 36px; height: 36px; font-size: 0.9rem; }
.cn-dropdown-header-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.cn-dropdown-header-plan { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.cn-dropdown-header-dashboard {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 8px;
    padding: 10px 14px;
    background: var(--accent-primary);
    color: #ffffff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}
.cn-dropdown-header-dashboard:hover { background: #4338ca; }
.cn-dropdown-body { padding: 6px; }
.cn-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    text-align: left;
}
.cn-user-item:hover { color: var(--text-primary); background: var(--bg-secondary); }
.cn-user-item svg { opacity: 0.7; flex-shrink: 0; }
.cn-user-item:hover svg { opacity: 1; }
.cn-user-divider { height: 1px; background: #f0f0f2; margin: 4px 0; }
.cn-signout { color: #ef4444 !important; opacity: 0.8; }
.cn-signout:hover { background: rgba(239,68,68,0.06) !important; color: #ef4444 !important; opacity: 1 !important; }

/* Mobile toggle */
.cn-mobile-toggle {
    display: none;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* ── Mobile Nav Panel ───────────────────────────────────────── */
.cn-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.cn-mobile-overlay.active { opacity: 1; visibility: visible; display: block; }
.cn-mobile-panel {
    position: fixed;
    top: 0; right: -300px;
    width: 300px; height: 100%;
    background: #ffffff;
    border-left: 1px solid var(--border-subtle);
    z-index: 200;
    transition: right 0.25s ease;
    overflow-y: auto;
    padding: 20px;
    display: none;
}
.cn-mobile-panel.active { right: 0; }
.cn-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f2;
}
.cn-mobile-close {
    padding: 6px; background: transparent; border: none;
    color: var(--text-primary); cursor: pointer;
}
.cn-mobile-section { margin-bottom: 20px; }
.cn-mobile-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 6px 12px 4px;
}
.cn-mobile-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.12s;
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    text-align: left;
}
.cn-mobile-item:hover { color: var(--text-primary); background: var(--bg-elevated); }
.cn-mobile-item svg { opacity: 0.6; flex-shrink: 0; }
.cn-mobile-signout { color: #ef4444 !important; }
.cn-mobile-signout:hover { background: #fef2f2 !important; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .cn-logo {
        /* On mobile, logo doesn't need to match sidebar width */
        width: auto;
    }
    .cn-center { display: none; }
    .cn-right .cn-user-name { display: none; }
    .cn-mobile-toggle { display: flex; align-items: center; justify-content: center; }
    .cn-mobile-overlay,
    .cn-mobile-panel { display: block; }
    /* Compact user button on mobile */
    .cn-user-btn {
        padding: 6px 10px 6px 6px;
        gap: 6px;
    }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .cn-search { max-width: 220px; }
    .cn-dropdown-trigger { padding: 7px 9px; font-size: 13px; }
}

/* ── Page body offset — set per-page if needed ──────────────── */
/* nav.css does NOT set body padding-top because pages vary in layout.
   Pages that need it should add: body { padding-top: var(--nav-height); } */


/* ============================================================
   LANDING NAV STYLES (logged out state)
   ============================================================ */

/* Landing links in center */
.cn-landing-links {
    display: flex;
    align-items: center;
    gap: clamp(20px, 4vw, 40px);
}

.cn-landing-link {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
    white-space: nowrap;
}
.cn-landing-link:hover {
    color: var(--text-primary);
}

/* Landing auth buttons */
.cn-btn-ghost {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.cn-btn-ghost:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.cn-btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border: none;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.cn-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Mobile primary button in landing mobile nav */
.cn-mobile-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
    color: #fff !important;
    border-radius: 8px !important;
    margin-top: 8px;
    justify-content: center !important;
}
.cn-mobile-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%) !important;
}

/* Landing nav responsive */
@media (max-width: 768px) {
    .cn-landing-links {
        display: none;
    }
    .cn-btn-ghost,
    .cn-btn-primary {
        display: none;
    }
}

/* Notification badge on avatar */
.cn-avatar-wrap { position: relative; display: inline-flex; }
.cn-notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-panel, #fff);
    line-height: 1;
    pointer-events: none;
    animation: badgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badgePop {
    from { transform: scale(0); }
    to { transform: scale(1); }
}
