/* ==========================================
   Debtia Mobile Menu Styles
   ========================================== */

/* -----------------------------------------
   Toggle Button
   ----------------------------------------- */
#mobile-menu-toggle {
    position: relative;
    z-index: 10001;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.3s ease;
}

#mobile-menu-toggle:hover {
    color: var(--bs-primary, #088c76);
}

#mobile-menu-toggle.is-active {
    color: var(--bs-secondary, #002954);
}

#mobile-menu-toggle.is-active .mobile-menu-icon-open {
    display: none;
}

#mobile-menu-toggle.is-active .mobile-menu-icon-close {
    display: block !important;
}

/* -----------------------------------------
   Mobile Menu Overlay
   ----------------------------------------- */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 41, 84, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu.is-open {
    opacity: 1;
    visibility: visible;
}

/* -----------------------------------------
   Mobile Menu Inner Panel
   ----------------------------------------- */
.mobile-menu-inner {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: #ffffff;
    box-shadow: -10px 0 40px rgba(0, 41, 84, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.is-open .mobile-menu-inner {
    transform: translateX(0);
}

/* -----------------------------------------
   Mobile Menu Header
   ----------------------------------------- */
.mobile-menu-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 41, 84, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.mobile-menu-logo img {
    height: 28px;
    width: auto;
}

/* -----------------------------------------
   Mobile Menu Navigation
   ----------------------------------------- */
.mobile-menu-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.mobile-menu-item {
    border-bottom: 1px solid rgba(0, 41, 84, 0.06);
}

.mobile-menu-item:last-child {
    border-bottom: none;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-secondary, #002954);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.mobile-menu-link:hover,
.mobile-menu-link:focus {
    background: rgba(8, 140, 118, 0.04);
    color: var(--bs-primary, #088c76);
}

.mobile-menu-link span {
    flex: 1;
}

/* Chevron animation */
.mobile-menu-chevron {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    color: #9ca3af;
}

.mobile-menu-toggle-submenu[aria-expanded="true"] .mobile-menu-chevron {
    transform: rotate(180deg);
    color: var(--bs-primary, #088c76);
}

/* -----------------------------------------
   Mobile Submenu
   ----------------------------------------- */
.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    background: rgba(0, 41, 84, 0.02);
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-submenu.is-open {
    max-height: 1000px;
}

.mobile-submenu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem 0.875rem 2rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--bs-secondary, #002954);
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-submenu-link:hover,
.mobile-submenu-link:focus {
    background: rgba(8, 140, 118, 0.06);
    color: var(--bs-primary, #088c76);
}

.mobile-submenu-link svg,
.mobile-submenu-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--bs-primary, #088c76);
    opacity: 0.7;
}

.mobile-submenu-icon svg {
    width: 100%;
    height: 100%;
}

.mobile-submenu-link:hover svg,
.mobile-submenu-link:hover .mobile-submenu-icon {
    opacity: 1;
}

.mobile-submenu-count {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    background: rgba(0, 41, 84, 0.05);
    padding: 0.125rem 0.5rem;
    border-radius: 20px;
}

/* See all link */
.mobile-submenu-link-all {
    margin-top: 0.25rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-top: 1px dashed rgba(0, 41, 84, 0.1);
    font-weight: 600;
    color: var(--bs-primary, #088c76);
}

.mobile-submenu-link-all svg {
    color: currentColor;
    opacity: 1;
}

/* -----------------------------------------
   Mobile Menu Actions (Login buttons)
   ----------------------------------------- */
.mobile-menu-actions {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid rgba(0, 41, 84, 0.08);
    flex-shrink: 0;
}

.mobile-menu-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    font-weight: 600;
}

.mobile-menu-actions .btn svg {
    flex-shrink: 0;
}

/* -----------------------------------------
   Mobile Menu Contact Info
   ----------------------------------------- */
.mobile-menu-contact {
    padding: 1rem 1.5rem 1.5rem;
    background: linear-gradient(135deg, rgba(8, 140, 118, 0.04), rgba(0, 41, 84, 0.04));
    flex-shrink: 0;
}

.mobile-menu-contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--bs-secondary, #002954);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mobile-menu-contact-item:hover {
    color: var(--bs-primary, #088c76);
}

.mobile-menu-contact-item svg {
    flex-shrink: 0;
    color: var(--bs-primary, #088c76);
}

/* -----------------------------------------
   Body lock when menu is open
   ----------------------------------------- */
body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* -----------------------------------------
   Hide on desktop
   ----------------------------------------- */
@media (min-width: 992px) {
    .mobile-menu {
        display: none !important;
    }
}

/* -----------------------------------------
   Small screens adjustments
   ----------------------------------------- */
@media (max-width: 400px) {
    .mobile-menu-inner {
        max-width: 100%;
    }
}

/* -----------------------------------------
   Accessibility
   ----------------------------------------- */
.mobile-menu-link:focus,
.mobile-submenu-link:focus,
.mobile-menu-contact-item:focus {
    outline: 2px solid var(--bs-primary, #088c76);
    outline-offset: -2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mobile-menu,
    .mobile-menu-inner,
    .mobile-submenu,
    .mobile-menu-link,
    .mobile-submenu-link,
    .mobile-menu-chevron,
    #mobile-menu-toggle {
        transition: none;
    }
}

/* -----------------------------------------
   Animation for menu items (stagger effect)
   ----------------------------------------- */
.mobile-menu.is-open .mobile-menu-item {
    animation: slideInRight 0.4s ease forwards;
    opacity: 0;
}

.mobile-menu.is-open .mobile-menu-item:nth-child(1) { animation-delay: 0.05s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(2) { animation-delay: 0.1s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(3) { animation-delay: 0.15s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(4) { animation-delay: 0.2s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(5) { animation-delay: 0.25s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(6) { animation-delay: 0.3s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(7) { animation-delay: 0.35s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(8) { animation-delay: 0.4s; }

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mobile-menu.is-open .mobile-menu-actions,
.mobile-menu.is-open .mobile-menu-contact {
    animation: fadeInUp 0.4s ease 0.3s forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
