/* ==========================================================================
   Layout — Header, user sidebar, footer, container, content grid
   ========================================================================== */

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
    position: fixed;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--header-bg);
    height: var(--header-height);
    width: 100%;
    padding: 0;
    margin: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.logo-title {
    display: flex;
    align-items: center;
    margin-left: var(--spacing-md);
    position: relative;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-speed);
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo {
    height: 45px;
    margin-right: var(--spacing-sm);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.site-name {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 26px;
    color: var(--header-text);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.site-name::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--header-text);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition-speed);
}

.logo-link:hover .site-name::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav-buttons {
    display: flex;
    margin-right: var(--spacing-md);
    align-items: center;
    gap: var(--spacing-md);
}

.nav-buttons a {
    position: relative;
    text-decoration: none;
    color: var(--header-text);
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase;
    padding: 8px 16px;
    transition: background-color var(--transition-speed);
    letter-spacing: 1px;
    white-space: nowrap;
    border-radius: 6px;
    background: transparent;
}

.nav-buttons a:hover {
    background: var(--header-hover);
}

.nav-buttons a.active {
    background: var(--header-hover);
    font-weight: 700;
}

/* ── Hamburger / menu toggle ─────────────────────────────────────────────── */
.menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.menu-toggle:hover,
.menu-toggle:focus-visible,
.menu-toggle.active {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.18);
    outline: none;
}

.hamburger-line {
    width: 22px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--header-text);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ── Cart count badge (header) ───────────────────────────────────────────── */
.cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--header-text);
    color: #ff8c00;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 6px;
    transition: all var(--transition-speed);
}

.nav-buttons a:hover .cart-count {
    transform: scale(1.1);
    color: #ff6b00;
}

/* ── Container / content grid ────────────────────────────────────────────── */
.container {
    background-color: var(--card-color);
    padding: var(--spacing);
    border-radius: var(--border-radius);
    width: calc(100% - var(--spacing) * 2);
    max-width: 1200px;
    margin: var(--spacing) auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
}

.content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing);
    align-items: start;
}

/* ── User sidebar ────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 350px;
    height: calc(100vh - var(--header-height));
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    z-index: 1500 !important;
    display: grid;
    grid-template-rows: auto 1fr;
    background: rgba(24, 24, 24, 0.94);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -16px 0 45px rgba(0, 0, 0, 0.5);
    color: var(--text-secondary);
    overflow: hidden;
    backdrop-filter: saturate(120%) blur(14px);
    -webkit-backdrop-filter: saturate(120%) blur(14px);
}

.sidebar.active {
    transform: translateX(0);
    pointer-events: auto;
}

.sidebar-glass {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 140, 0, 0.18), transparent 38%);
    pointer-events: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    font-size: 22px;
    color: var(--primary-color);
    filter: drop-shadow(0 2px 10px rgba(255, 140, 0, 0.35));
}

.sidebar-title {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    font-family: var(--font-main);
    letter-spacing: 0.2px;
    color: #fff;
    text-transform: uppercase;
    font-size: 0.95rem;
}

.sidebar-title strong {
    font-weight: 700;
}

.sidebar-title span {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.75rem;
    letter-spacing: 0.36em;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-ui);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 140, 0, 0.18);
    color: var(--primary-color);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-user-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-user-name {
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}

.sidebar-user-role {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sidebar-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 22px;
    overflow-y: auto;
    gap: 18px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.section-title {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-left: 6px;
    margin-bottom: 6px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-family: var(--font-ui);
    font-weight: 500;
    transition: background 0.22s ease, transform 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
    position: relative;
}

.sidebar-item i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
    transition: transform 0.22s ease;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-item:hover i {
    transform: scale(1.08);
}

.sidebar-item.active {
    background: rgba(255, 140, 0, 0.16);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255, 140, 0, 0.25);
}

.sidebar-item.logout {
    margin-top: 10px;
    color: var(--error-color);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    padding-top: 16px;
}

.sidebar-item.logout:hover {
    background: rgba(255, 68, 68, 0.12);
    color: var(--error-color);
}

.sidebar-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 0 4px;
}

.pill,
.sidebar-item .cart-count {
    margin-left: auto;
    background: var(--primary-color);
    color: #111;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    font-size: 0.82rem;
    font-weight: 700;
}

/* ── Footer (hidden) ─────────────────────────────────────────────────────── */
.footer,
.footer-content,
.footer-section,
.footer-bottom {
    display: none;
}

/* ── Layout responsive ───────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .container {
        padding: calc(var(--spacing) * 2);
        margin: calc(var(--spacing) * 2) auto;
    }

    .content {
        grid-template-columns: 1fr 350px;
        gap: var(--spacing);
    }
}

@media (max-width: 768px) {
    .site-name {
        display: none;
    }

    .nav-buttons a {
        font-size: 15px;
        padding: 8px 16px;
        letter-spacing: 0.5px;
    }

    .logo {
        height: 35px;
    }

    .sidebar {
        width: 100% !important;
        max-width: 320px !important;
        top: var(--header-height) !important;
        height: calc(100vh - var(--header-height)) !important;
    }

    .sidebar-nav {
        padding: var(--spacing-sm);
    }

    .sidebar-item {
        padding: 16px 0;
    }

    .hamburger-line {
        width: 22px;
        height: 2px;
    }

    .menu-toggle {
        padding: 6px;
    }
}

@media (max-width: 480px) {
    .container {
        width: calc(100% - var(--spacing));
        margin: calc(var(--spacing) / 2) auto;
    }

    .nav-buttons a {
        font-size: 14px;
        padding: 10px 16px;
    }

    .logo {
        height: 30px;
    }

    .sidebar {
        width: 100%;
        max-width: 100%;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
    }

    .sidebar-item {
        padding: 14px 0;
    }

    .sidebar-item i {
        font-size: 1.1rem;
    }

    .sidebar-item span {
        font-size: 0.95rem;
    }

    .hamburger-line {
        width: 20px;
        height: 2px;
    }
}
