/*
 * DROPDOWN NAVIGATION - Industry Standard
 * Logo protrudes via negative margins in style.css.
 * Dropdown uses top:100% + padding-top for zero dead-zone.
 */

/* === PARENT LI === */
.has-dropdown {
    position: relative;
}

.has-dropdown > a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.has-dropdown > a::after {
    content: '';
    display: inline-block;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.3s;
    margin-top: 1px;
}

.has-dropdown > a::before { display: none !important; }

.has-dropdown:hover > a::after { transform: rotate(180deg); }

.has-dropdown > a[aria-current="page"] { color: var(--accent-indigo, #4a56c0); }

/* === DROPDOWN UL === */
.dropdown {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    list-style: none !important;

    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding-top: 14px;
    width: 210px;
    min-width: 0;
    z-index: 1001;

    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s;

    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.dropdown::before {
    content: '';
    position: absolute;
    top: 14px; left: 0; right: 0; bottom: 0;
    background: var(--card-bg, #fff);
    border-radius: 10px;
    border: 1px solid var(--border-color, #e5ddd3);
    box-shadow: 0 10px 32px rgba(30,42,58,0.12), 0 3px 8px rgba(30,42,58,0.06);
    z-index: -1;
}

.dropdown::after {
    content: '';
    position: absolute;
    top: 9px; left: 50%;
    width: 11px; height: 11px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5ddd3);
    border-bottom: none; border-right: none;
    transform: translateX(-50%) rotate(45deg);
    z-index: 0;
}

.has-dropdown:hover .dropdown {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* === DROPDOWN ITEMS === */
.dropdown li {
    list-style: none;
    position: relative;
    z-index: 1;
}

.dropdown a {
    display: block;
    padding: 0.45rem 1.1rem;
    color: var(--primary-text, #1e2a3a);
    font-size: 0.84rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    position: relative;
}

.dropdown a::after,
.dropdown a::before { display: none !important; }

.dropdown a:hover {
    background: linear-gradient(135deg, rgba(74,86,192,0.07), rgba(12,133,153,0.07));
    color: var(--accent-indigo, #4a56c0);
}

/* Active submenu item — works on ALL devices */
.dropdown a[aria-current="page"] {
    color: var(--accent-indigo, #4a56c0);
    background: linear-gradient(135deg, rgba(74,86,192,0.06), rgba(12,133,153,0.06));
    font-weight: 600;
}

.dropdown li:first-child a { border-radius: 10px 10px 0 0; padding-top: 0.6rem; }
.dropdown li:last-child a { border-radius: 0 0 10px 10px; padding-bottom: 0.6rem; }

/* === MOBILE TOGGLE === */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px; height: 2.5px;
    background: var(--primary-text, #1e2a3a);
    border-radius: 2px;
    transition: all 0.3s;
}

/* === MOBILE === */
@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }

    nav > ul {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: var(--primary-bg, #fffdf9);
        flex-direction: column;
        padding: 0.5rem 1.5rem 1.5rem;
        gap: 0;
        box-shadow: 0 10px 30px rgba(30,42,58,0.1);
        border-top: 1px solid var(--border-color, #e5ddd3);
        max-height: 80vh;
        overflow-y: auto;
    }

    nav > ul.active { display: flex; }

    nav > ul > li {
        padding: 0.7rem 0;
        border-bottom: 1px solid var(--border-light, #f0e9df);
    }

    nav > ul > li:last-child { border-bottom: none; }

    /* Active indicator on mobile: color + left accent bar */
    nav > ul > li > a[aria-current="page"] {
        color: var(--accent-indigo, #4a56c0);
        padding-left: 0.7rem;
        border-left: 3px solid var(--accent-indigo, #4a56c0);
    }

    /* Remove desktop underline on mobile */
    nav > ul > li > a::after {
        display: none;
    }

    .has-dropdown .dropdown {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: static !important;
        transform: none !important;
        width: auto !important;
        padding-top: 0.4rem !important;
        transition: none !important;
    }

    .has-dropdown .dropdown::before,
    .has-dropdown .dropdown::after { display: none !important; }

    .has-dropdown > a::after { display: none; }

    .dropdown a {
        padding: 0.35rem 0 0.35rem 0.8rem;
        font-size: 0.82rem;
        color: var(--secondary-text, #4d5f72);
        border-left: 2px solid var(--border-color, #e5ddd3);
        border-radius: 0 !important;
    }

    /* Active submenu item on mobile */
    .dropdown a:hover,
    .dropdown a[aria-current="page"] {
        background: transparent;
        color: var(--accent-indigo, #4a56c0);
        border-left-color: var(--accent-indigo, #4a56c0);
        font-weight: 600;
    }

    .dropdown li:first-child a { padding-top: 0.35rem; border-radius: 0 !important; }
    .dropdown li:last-child a { padding-bottom: 0.35rem; border-radius: 0 !important; }
}
