/* ===== SIDE MENU STYLES ===== */

/* Hamburger Menu Button */
.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    z-index: 1001;
    position: relative;
}

.hamburger-menu:hover {
    background: rgba(59, 130, 246, 0.1);
}

.hamburger-menu:active {
    transform: scale(0.95);
}

.hamburger-line {
    width: 24px;
    height: 3px;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    margin: 3px 0;
    transform-origin: center;
}

.hamburger-menu:hover .hamburger-line {
    background: var(--color-primary);
}

/* Hamburger Animation - Open State */
.hamburger-menu.is-open .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger-menu.is-open .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.hamburger-menu.is-open .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Side Menu Container */
.side-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
}

.side-menu.is-open {
    transform: translateX(0);
}

/* Side Menu Header */
.side-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6) var(--space-5);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    position: relative;
    overflow: hidden;
    min-height: 80px;
}

.side-menu-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

.side-menu-logo {
    filter: brightness(0) invert(1);
    width: 100px;
    height: auto;
    position: relative;
    z-index: 1;
}

/* Close Button */
.close-menu {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--text-inverse);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.close-menu:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1) rotate(90deg);
}

.close-menu:active {
    transform: scale(0.95) rotate(90deg);
}

.close-menu svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Side Menu Navigation */
.side-menu-nav {
    padding: var(--space-6) var(--space-4);
    background: var(--bg-primary);
}

.side-menu-nav a {
    display: flex;
    align-items: center;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: var(--space-4) var(--space-4);
    border-radius: var(--radius-lg);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: var(--space-2);
    position: relative;
    background: transparent;
    border: 2px solid transparent;
}

.side-menu-nav a:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(74, 144, 226, 0.05));
    color: var(--color-primary);
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateX(-4px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.side-menu-nav a.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--text-inverse);
    border-color: var(--color-primary);
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(2, 60, 133, 0.25);
}

.side-menu-nav a.active::before {
    content: "←";
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.125rem;
    font-weight: bold;
}

/* Side Menu Backdrop */
.side-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: opacity, visibility;
}

.side-menu-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .side-menu {
        width: 100%;
        max-width: 100%;
    }

    .hamburger-menu {
        width: 40px;
        height: 40px;
    }

    .hamburger-line {
        width: 22px;
        height: 2.5px;
        margin: 2.5px 0;
    }

    .side-menu-header {
        padding: var(--space-5) var(--space-4);
        min-height: 70px;
    }

    .side-menu-logo {
        width: 90px;
    }

    .close-menu {
        width: 36px;
        height: 36px;
    }

    .side-menu-nav {
        padding: var(--space-5) var(--space-3);
    }

    .side-menu-nav a {
        font-size: 0.9375rem;
        padding: var(--space-3) var(--space-3);
    }
}

@media (max-width: 480px) {
    .hamburger-menu {
        width: 36px;
        height: 36px;
    }

    .hamburger-line {
        width: 20px;
        height: 2px;
        margin: 2px 0;
    }

    .side-menu-header {
        padding: var(--space-4) var(--space-3);
        min-height: 65px;
    }

    .side-menu-logo {
        width: 80px;
    }

    .close-menu {
        width: 32px;
        height: 32px;
    }

    .close-menu svg {
        width: 18px;
        height: 18px;
    }

    .side-menu-nav a {
        font-size: 0.875rem;
        padding: var(--space-3) var(--space-3);
    }
}