/**
 * Left Menu Drawer Styles
 *
 * @package Left_Menu_Drawer
 * @version 1.0.0
 */

/* ============================================
   Variables
   ============================================ */
:root {
    --lmd-primary-color: #8bc34a;
    --lmd-drawer-width: 300px;
    --lmd-header-height: 56px;
    --lmd-z-index: 9999;
    --lmd-animation-speed: 300ms;
}

/* ============================================
   Reset and Base Styles
   ============================================ */
.lmd-drawer *,
.lmd-overlay *,
.lmd-submenu-container * {
    box-sizing: border-box;
}

/* ============================================
   Overlay
   ============================================ */
.lmd-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--lmd-z-index) - 1);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--lmd-animation-speed) ease,
                visibility var(--lmd-animation-speed) ease;
}

.lmd-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Drawer Container
   ============================================ */
.lmd-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--lmd-drawer-width);
    max-width: 90vw;
    height: 100vh;
    background: #ffffff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: var(--lmd-z-index);
    transform: translateX(-100%);
    transition: transform var(--lmd-animation-speed) ease;
    display: flex;
    flex-direction: column;
    font-family: Lato, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
}

.lmd-drawer.is-open {
    transform: translateX(0);
}

/* ============================================
   Header (Fixed)
   ============================================ */
.lmd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 13px 16px 24px;
    height: var(--lmd-header-height);
    background: #f7f7f7;
    border-top: 4px solid var(--lmd-primary-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.lmd-site-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lmd-close-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.lmd-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.lmd-close-btn svg {
    color: #666;
}

/* ============================================
   Menu Container (Scrollable)
   ============================================ */
.lmd-menu-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 16px;
}

/* Scrollbar styling */
.lmd-menu-container::-webkit-scrollbar {
    width: 6px;
}

.lmd-menu-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.lmd-menu-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.lmd-menu-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   First Level Menu
   ============================================ */
.lmd-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lmd-menu-item {
    position: relative;
}

.lmd-level-1 {
    margin-bottom: 4px;
}

.lmd-level-1 > .lmd-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    line-height: 1.4;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.lmd-level-1 > .lmd-menu-link:hover {
    background: #f7f7f7;
}

/* Active state */
.lmd-level-1.active > .lmd-menu-link {
    background: #f7f7f7;
    border-radius: 4px;
    color: #0c2941;
    font-weight: 700;
}

.lmd-level-1.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--lmd-primary-color);
    border-radius: 0 2px 2px 0;
}

.lmd-arrow {
    margin-left: 8px;
    display: flex;
    align-items: center;
    color: #999;
    flex-shrink: 0;
}

/* ============================================
   Submenu Container (2nd & 3rd Level)
   ============================================ */
.lmd-submenu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: calc(var(--lmd-z-index) + 1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.lmd-submenu-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lmd-submenu-container {
    position: fixed;
    left: var(--lmd-drawer-width);
    top: var(--lmd-header-height);
    bottom: 0;
    right: 0;
    background: #ffffff;
    border-radius: 0 20px 0 0;
    max-width: 904px;
    min-width: 468px;
    height: calc(100vh - var(--lmd-header-height));
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 8px 0 32px;
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: calc(var(--lmd-z-index) + 2);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    transition: opacity 0.2s ease,
                visibility 0.2s ease,
                transform 0.2s ease;
}

.lmd-submenu-container.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Submenu Header */
.lmd-submenu-header {
    margin-bottom: 20px;
}

.lmd-submenu-title {
    background: linear-gradient(135deg, var(--lmd-primary-color) 0%, #4caf50 100%);
    padding: 13px 72px 14px;
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    font-weight: 900;
    font-size: 24px;
    line-height: 28.8px;
    border-radius: 80px 0 140px 80px;
    max-width: 619px;
    position: relative;
}

/* Submenu Grid (4 columns) */
.lmd-submenu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    max-width: 100%;
}

.lmd-submenu-column {
    min-width: 0;
}

/* ============================================
   Second Level Items
   ============================================ */
.lmd-second-level-title {
    margin-bottom: 8px;
}

.lmd-second-level-title a {
    font-size: 19px;
    font-weight: 700;
    line-height: 22.8px;
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.lmd-second-level-title a:hover {
    color: var(--lmd-primary-color);
}

/* ============================================
   Third Level Items
   ============================================ */
.lmd-third-level-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lmd-third-level-item {
    margin-bottom: 12px;
}

.lmd-third-level-item a {
    font-size: 14px;
    line-height: 16px;
    font-weight: 400;
    color: #495867;
    text-decoration: none;
    transition: color 0.2s;
}

.lmd-third-level-item a:hover {
    color: var(--lmd-primary-color);
}

/* ============================================
   Body Lock (Prevent scrolling when drawer open)
   ============================================ */
body.lmd-drawer-open {
    overflow: hidden;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 767px) {
    :root {
        --lmd-drawer-width: 280px;
    }

    .lmd-submenu-container {
        left: 0;
        right: 0;
        top: 0;
        max-width: 100%;
        min-width: 100%;
        height: 100vh;
        border-radius: 0;
        padding: 20px 16px;
    }

    .lmd-submenu-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .lmd-submenu-title {
        font-size: 20px;
        padding: 10px 30px;
        border-radius: 40px 0 80px 40px;
    }
}

/* ============================================
   Tablet Responsive
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    .lmd-submenu-container {
        max-width: calc(100vw - var(--lmd-drawer-width) - 40px);
    }

    .lmd-submenu-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

/* ============================================
   Accessibility
   ============================================ */
.lmd-drawer a:focus,
.lmd-close-btn:focus {
    outline: 2px solid var(--lmd-primary-color);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .lmd-drawer,
    .lmd-overlay,
    .lmd-submenu-container {
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .lmd-drawer,
    .lmd-overlay,
    .lmd-submenu-container {
        display: none !important;
    }
}
