/**
 * Public Navigation Bar - Standalone CSS
 * Only navbar styles. Safe to include on any page without affecting page content.
 */

:root {
    --nav-primary: #712a2a;
    --nav-primary-dark: #5a2121;
    --nav-primary-light: #a04040;
    --nav-accent: #c9553d;
    --nav-gold: #d4a853;
    --nav-gray-50: #f9fafb;
    --nav-gray-100: #f3f4f6;
    --nav-gray-200: #e5e7eb;
    --nav-gray-500: #6b7280;
    --nav-gray-700: #374151;
    --nav-gray-900: #111827;
}

/* ── Top accent bar ── */
.nav-accent {
    height: 3px;
    background: linear-gradient(90deg, var(--nav-primary) 0%, var(--nav-accent) 40%, var(--nav-gold) 70%, var(--nav-primary-light) 100%);
}

.navbar {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem 2rem;
    position: relative;
    box-sizing: border-box;
    flex-wrap: nowrap;
}

/* ── Brand / Logo ── */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    text-decoration: none;
    transition: opacity 0.2s;
}
.nav-brand:hover { opacity: 0.85; }

.nav-logo {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
}
.nav-logo svg {
    width: 42px;
    height: 42px;
    display: block;
}
.nav-brand-logo {
    height: 28px;
    width: auto;
    flex-shrink: 0;
    display: block;
}

.nav-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--nav-gray-900);
    line-height: 1.2;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.nav-subtitle {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.63rem;
    font-weight: 500;
    color: var(--nav-gray-500);
    letter-spacing: 0.02em;
    text-transform: none;
    white-space: nowrap;
}

/* ── Menu links ── */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.4rem;
    align-items: center;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.nav-menu li { list-style: none; }

.nav-menu-auth { display: none; }

/* ── Hamburger ── */
.nav-hamburger {
    display: none !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: 1.5px solid var(--nav-gray-200);
    border-radius: 10px;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    transition: all 0.2s;
    box-sizing: border-box;
}
.nav-hamburger:hover {
    border-color: var(--nav-primary);
    background: rgba(113, 42, 42, 0.04);
}
.nav-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--nav-gray-700);
    border-radius: 2px;
    transition: all 0.3s;
}
.nav-hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.active span:nth-child(2) { opacity: 0; }
.nav-hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Nav links ── */
.nav-link {
    text-decoration: none;
    color: var(--nav-gray-700);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
    padding: 0.5rem 0.2rem;
    position: relative;
    white-space: nowrap;
    display: inline-block;
    border-bottom: 2px solid transparent;
}
.nav-link:hover {
    color: var(--nav-primary);
    border-bottom-color: var(--nav-primary-light);
}
.nav-link.active {
    color: var(--nav-primary);
    font-weight: 600;
    border-bottom-color: var(--nav-primary);
}

/* ── Action buttons ── */
.nav-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: nowrap;
    white-space: nowrap;
    order: 3;
}

.nav-actions .btn {
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.25s ease;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    box-sizing: border-box;
    line-height: 1.4;
    letter-spacing: 0.01em;
}
.nav-actions .btn-primary {
    background: linear-gradient(135deg, var(--nav-primary) 0%, var(--nav-primary-light) 100%);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(113, 42, 42, 0.25);
}
.nav-actions .btn-primary:hover {
    background: linear-gradient(135deg, var(--nav-primary-dark) 0%, var(--nav-primary) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(113, 42, 42, 0.35);
}
.nav-actions .btn-outline {
    background: transparent;
    color: var(--nav-primary) !important;
    border-color: var(--nav-gray-200);
}
.nav-actions .btn-outline:hover {
    border-color: var(--nav-primary);
    background: rgba(113, 42, 42, 0.04);
}

/* ── Tablet/collapse: ≤1200px ── */
@media (max-width: 1200px) {
    .nav-hamburger { display: flex !important; }
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        flex-direction: column;
        gap: 0;
        padding: 8px 0;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
        border-top: 1px solid var(--nav-gray-200);
        z-index: 999;
        overflow: visible;
    }
    .nav-menu.open { display: flex; }
    .nav-menu li { width: 100%; }
    .nav-menu .nav-link {
        display: block;
        padding: 14px 24px;
        border-bottom: none;
        white-space: normal;
        font-size: 16px;
    }
    .nav-menu .nav-link:hover { color: var(--nav-primary); }
    .nav-menu .nav-link.active { color: var(--nav-primary); font-weight: 600; }
    .nav-menu.open .nav-menu-auth { display: list-item; }
    .nav-menu.open .nav-menu-auth:first-of-type { border-top: 1px solid var(--nav-gray-200); margin-top: 4px; padding-top: 4px; }
}

/* ── Small tablet: ≤992px ── */
@media (max-width: 992px) {
    .nav-container { padding: 12px 14px; gap: 0.75rem; }
    .nav-title { font-size: 1.15rem; }
    .nav-subtitle { font-size: 0.65rem; }
}

@media (max-width: 768px) {
    .nav-actions .btn-outline { display: none; }
    .nav-actions .btn-primary { padding: 8px 16px; font-size: 13px; }
}

/* ── Small mobile ≤640px: prevent nav overflow ── */
@media (max-width: 640px) {
    .nav-container { padding: 10px 14px; gap: 0.5rem; }
    /* Allow brand text to shrink & truncate instead of overflowing */
    .nav-brand { flex-shrink: 1; min-width: 0; overflow: hidden; }
    .nav-brand-logo { height: 30px; }
    .nav-text  { min-width: 0; overflow: hidden; }
    .nav-title { overflow: hidden; text-overflow: ellipsis; font-size: 1rem; }
    /* Hide subtitle to keep nav single-line */
    .nav-subtitle { display: none; }
    /* Language switcher is secondary on mobile — hide to free ~80px */
    #aid-lang-switcher { display: none !important; }
    /* Hide CTA buttons — accessible via hamburger menu instead */
    .nav-actions .btn-primary { display: none !important; }
    .nav-actions { gap: 0.4rem; }
}

/* ════════════════════════════════════════
   Dashboards Dropdown
   ════════════════════════════════════════ */

.nav-has-dropdown { position: relative; }

.nav-dropdown-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    cursor: default;
}

.nav-dd-caret {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0.55;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.nav-has-dropdown:hover .nav-dd-caret,
.nav-has-dropdown.dd-open .nav-dd-caret {
    transform: rotate(180deg);
    opacity: 1;
}

/* Dropdown panel — visibility controlled by JS */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 14px);
    left: 0;
    width: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.13), 0 4px 16px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.06);
    z-index: 9999;
}

/* Upward caret/arrow */
.nav-dropdown::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 22px;
    width: 10px;
    height: 10px;
    background: #5D0C34;
    transform: rotate(45deg);
    border-radius: 2px 0 0 0;
    z-index: 1;
}

/* Shown via JS — no CSS hover rule needed */

/* Two-column grid */
.nav-dd-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    border-radius: 0;
    overflow: hidden;
}

/* ── Left column ── */
.nav-dd-left {
    background: linear-gradient(160deg, #5D0C34 0%, #3d0822 100%);
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.nav-dd-left-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 12px;
}

.nav-dd-main-link {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 14px 13px;
    border-radius: 0;
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.1);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 10px;
}
.nav-dd-main-link:hover {
    background: rgba(255,255,255,0.17);
    border-color: rgba(255,255,255,0.22);
}

.nav-dd-main-icon {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.12);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.nav-dd-main-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.nav-dd-main-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
}

.nav-dd-main-arrow {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.38);
    margin-top: 2px;
    transition: color 0.15s;
}
.nav-dd-main-link:hover .nav-dd-main-arrow { color: rgba(255,255,255,0.7); }

.nav-dd-sub-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 0;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 0.15s;
}
.nav-dd-sub-link:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9);
}

/* ── Right column ── */
.nav-dd-right {
    padding: 20px 16px;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.nav-dd-right-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 10px;
    padding-left: 2px;
}

.nav-dd-prog-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: 0;
    text-decoration: none;
    transition: background 0.13s;
    margin-bottom: 2px;
}
.nav-dd-prog-item:hover { background: #faf5f8; }

.nav-dd-prog-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nav-dd-prog-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-dd-prog-code {
    font-size: 9.5px;
    font-weight: 800;
    color: #5D0C34;
    font-family: 'SF Mono', 'Consolas', monospace;
    letter-spacing: 0.3px;
}

.nav-dd-prog-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.nav-dd-prog-meta {
    font-size: 10px;
    color: #94a3b8;
}

.nav-dd-prog-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
    flex-shrink: 0;
    white-space: nowrap;
}

.nav-dd-view-all {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 8px 8px;
    border-radius: 0;
    border: 1px dashed #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    color: #5D0C34;
    text-decoration: none;
    transition: all 0.15s;
}
.nav-dd-view-all:hover { background: #faf5f8; border-color: #5D0C34; }
.nav-dd-view-all svg { opacity: 0.6; }

/* ── Mobile dropdown (inside collapsed menu) ── */
@media (max-width: 1200px) {
    .nav-dropdown {
        position: static !important;
        width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        transform: none !important;
        transition: none !important;
    }

    .nav-dropdown::before { display: none; }

    .nav-dd-grid {
        grid-template-columns: 1fr;
        border-radius: 0;
    }

    .nav-dd-left {
        padding: 16px 24px;
        border-radius: 0;
    }

    .nav-dd-right {
        padding: 14px 24px 18px;
        border-top: 2px solid rgba(255,255,255,0.08);
    }
}

@media (max-width: 480px) {
    .nav-title { font-size: 0.85rem; }
    .nav-subtitle { display: none; }
    .nav-logo { width: 30px; height: 30px; }
    .nav-logo svg { width: 30px; height: 30px; }
    .nav-actions .btn { padding: 6px 10px; font-size: 13px; }
}
