:root {
    --sidebar-open-width: 284px;
    --sidebar-closed-width: 88px;
    --sidebar-radius: 28px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.24s ease;
}

/* =========================================================
   GLOBAL LAYOUT FIX
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.layout {
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
}

/* =========================================================
   SIDEBAR BASE
   ========================================================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-open-width);
    height: 100vh;
    max-height: 100vh;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    overflow: visible;
    background:
            radial-gradient(circle at 28% 8%, rgba(255, 240, 245, 0.20), transparent 28%),
            linear-gradient(180deg, #7A1E35 0%, #541323 100%);
    border-right: 1px solid rgba(216, 181, 109, 0.28);
    box-shadow: 12px 0 40px rgba(84, 19, 35, 0.16);
    transition:
            width var(--transition-base),
            padding var(--transition-base),
            left var(--transition-base),
            transform var(--transition-base),
            box-shadow var(--transition-base);
}

.admin-sidebar {
    background:
            radial-gradient(circle at 26% 8%, rgba(255, 240, 245, 0.14), transparent 28%),
            linear-gradient(180deg, #4A1020 0%, #2D0712 100%);
}

.main-content {
    min-width: 0;
    margin-left: var(--sidebar-open-width);
    width: calc(100% - var(--sidebar-open-width));
    max-width: calc(100vw - var(--sidebar-open-width));
    overflow-x: hidden;
    transition:
            margin-left var(--transition-base),
            width var(--transition-base);
}

/* =========================================================
   BRAND
   ========================================================= */

.brand {
    min-height: 68px;
    padding: 12px 10px 18px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(216, 181, 109, 0.22);
    display: flex;
    align-items: center;
    gap: 13px;
    flex-shrink: 0;
}

.brand-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 18px;
    background: linear-gradient(135deg, #FFF7E8, #D8B56D);
    color: #541323;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    font-weight: 900;
    box-shadow: 0 12px 24px rgba(216, 181, 109, 0.24);
}

.brand-text h2,
.brand h2 {
    color: #FFF9F0;
    font-size: 22px;
    line-height: 1.1;
    margin: 0;
}

.brand-text p,
.brand p {
    color: rgba(255, 241, 214, 0.72);
    font-size: 13px;
    margin: 5px 0 0;
}

/* =========================================================
   MENU
   ========================================================= */

.menu {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
    padding-right: 6px;
    padding-bottom: 26px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    scrollbar-width: none;
    scrollbar-color: rgba(216, 181, 109, 0.18) transparent;
    -ms-overflow-style: none;
}

.menu::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.sidebar:hover .menu {
    scrollbar-width: thin;
}

.sidebar:hover .menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar:hover .menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar:hover .menu::-webkit-scrollbar-thumb {
    background: rgba(216, 181, 109, 0.18);
    border-radius: 999px;
}

.sidebar:hover .menu::-webkit-scrollbar-thumb:hover {
    background: rgba(216, 181, 109, 0.32);
}

.menu a {
    position: relative;
    min-height: 46px;
    padding: 0 14px 0 12px;
    border-radius: 17px;
    color: rgba(255, 248, 238, 0.78);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.1px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    flex-shrink: 0;
    transition:
            background var(--transition-fast),
            color var(--transition-fast),
            transform var(--transition-fast),
            box-shadow var(--transition-fast);
}

.menu a::before {
    content: attr(data-icon) !important;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.10);
    color: #F7DFA8;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    font-weight: 900;
    transition:
            background var(--transition-fast),
            color var(--transition-fast),
            transform var(--transition-fast);
}

.menu a:hover {
    background: rgba(255, 255, 255, 0.11);
    color: #FFF9F0;
    transform: translateX(3px);
}

.menu a:hover::before {
    background: rgba(216, 181, 109, 0.24);
    color: #FFF7E8;
}

.menu a.active {
    background: linear-gradient(135deg, rgba(255, 249, 240, 0.96), rgba(255, 232, 238, 0.90));
    color: #7A1E35;
    box-shadow: 0 12px 26px rgba(84, 19, 35, 0.18);
}

.menu a.active::before {
    background: linear-gradient(135deg, #7A1E35, #541323);
    color: #F7DFA8;
}

/* =========================================================
   COLLAPSE BUTTON
   ========================================================= */

.sidebar-collapse-btn {
    position: absolute;
    top: 50%;
    right: -19px;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 16px;
    border: 1px solid rgba(216, 181, 109, 0.9);
    background: linear-gradient(135deg, #FFF7E8, #D8B56D);
    color: #541323;
    font-size: 17px;
    font-weight: 900;
    box-shadow: 0 12px 26px rgba(84, 19, 35, 0.24);
    transition:
            transform var(--transition-fast),
            box-shadow var(--transition-fast),
            background var(--transition-fast);
}

.sidebar-collapse-btn:hover {
    background: #FFF9F0;
    transform: translateY(-50%) scale(1.04);
    box-shadow: 0 16px 32px rgba(84, 19, 35, 0.30);
}

/* =========================================================
   COLLAPSED SIDEBAR
   ========================================================= */

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-closed-width);
    padding: 24px 13px;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-closed-width);
    width: calc(100% - var(--sidebar-closed-width));
    max-width: calc(100vw - var(--sidebar-closed-width));
}

body.sidebar-collapsed .brand {
    justify-content: center;
    padding: 12px 0 18px;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .brand > div:not(.brand-icon) {
    display: none;
}

body.sidebar-collapsed .brand-icon {
    flex-basis: 48px;
    width: 48px;
    height: 48px;
    border-radius: 17px;
}

body.sidebar-collapsed .menu {
    align-items: center;
    gap: 9px;
    padding-right: 0;
    padding-bottom: 26px;
}

body.sidebar-collapsed .sidebar:hover .menu::-webkit-scrollbar {
    width: 3px;
}

body.sidebar-collapsed .sidebar:hover .menu::-webkit-scrollbar-thumb {
    background: rgba(216, 181, 109, 0.14);
}

body.sidebar-collapsed .menu a {
    width: 52px;
    height: 52px;
    min-height: 52px;
    padding: 0;
    justify-content: center;
    border-radius: 18px;
    font-size: 0;
    gap: 0;
    transform: none;
}

body.sidebar-collapsed .menu a::before,
body.sidebar-collapsed .admin-sidebar .menu a::before {
    content: attr(data-icon) !important;
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border-radius: 14px;
    background: transparent;
    font-size: 15px;
}

body.sidebar-collapsed .menu a:hover {
    transform: translateY(-2px);
}

body.sidebar-collapsed .menu a.active {
    background: linear-gradient(135deg, rgba(255, 249, 240, 0.96), rgba(255, 232, 238, 0.92));
}

body.sidebar-collapsed .menu a.active::before {
    background: transparent;
    color: #7A1E35;
}

/* =========================================================
   MOBILE SIDEBAR
   ========================================================= */

@media (max-width: 950px) {
    .mobile-topbar {
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        background: rgba(255, 249, 240, 0.88);
        border-bottom: 1px solid rgba(216, 181, 109, 0.32);
        box-shadow: 0 10px 28px rgba(84, 19, 35, 0.08);
    }

    .hamburger {
        background: linear-gradient(135deg, #FFF7E8, #D8B56D);
        color: #541323;
        border: 1px solid rgba(216, 181, 109, 0.72);
        box-shadow: 0 10px 22px rgba(84, 19, 35, 0.14);
    }

    .sidebar,
    body.sidebar-collapsed .sidebar {
        left: -110%;
        z-index: 2400;
        width: min(84vw, 318px);
        height: 100dvh;
        max-height: 100dvh;
        padding: 24px 18px;
        border-top-right-radius: 28px;
        border-bottom-right-radius: 28px;
        box-shadow: 18px 0 46px rgba(84, 19, 35, 0.28);
        transition:
                left 0.28s ease,
                transform 0.28s ease;
    }

    #menu-toggle:checked ~ .layout .sidebar,
    body.mobile-sidebar-open .sidebar {
        left: 0;
    }

    .main-content,
    body.sidebar-collapsed .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }

    .mobile-overlay {
        z-index: 2200;
        background: rgba(45, 7, 18, 0.38);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
    }

    #menu-toggle:checked ~ .mobile-overlay,
    body.mobile-sidebar-open .mobile-overlay {
        display: block;
    }

    .brand,
    body.sidebar-collapsed .brand {
        justify-content: flex-start;
        padding: 16px 10px 18px;
    }

    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .brand > div:not(.brand-icon) {
        display: block;
    }

    .menu,
    body.sidebar-collapsed .menu {
        align-items: stretch;
        padding-right: 6px;
        padding-bottom: 72px;
        -webkit-overflow-scrolling: touch;
    }

    .menu a,
    body.sidebar-collapsed .menu a {
        width: auto;
        height: 48px;
        min-height: 48px;
        padding: 0 14px 0 12px;
        justify-content: flex-start;
        border-radius: 18px;
        font-size: 14.5px;
        gap: 12px;
    }

    .menu a::before,
    body.sidebar-collapsed .menu a::before {
        flex: 0 0 30px;
        width: 30px;
        height: 30px;
        border-radius: 13px;
        background: rgba(255, 255, 255, 0.10);
    }

    .sidebar .sidebar-collapse-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        right: -23px;
        width: 46px;
        height: 46px;
        border-radius: 18px;
        z-index: 2600;
        border: 1px solid rgba(216, 181, 109, 0.85);
        font-size: 20px;
        pointer-events: auto;
    }
}

/* =========================================================
   PRODUCT CARDS
   ========================================================= */

.products-grid,
.product-grid {
    align-items: stretch;
}

.product-card {
    position: relative;
    overflow: hidden;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(216, 181, 109, 0.42);
    box-shadow: 0 18px 42px rgba(122, 30, 53, 0.08);
    transition:
            transform 0.22s ease,
            box-shadow 0.22s ease,
            border-color 0.22s ease;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 26px 58px rgba(122, 30, 53, 0.14);
    border-color: rgba(216, 181, 109, 0.72);
}

.product-image {
    height: 210px;
    background:
            radial-gradient(circle at 28% 20%, rgba(216, 181, 109, 0.28), transparent 28%),
            linear-gradient(135deg, #FFF7E8, #F9E8EC);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image span {
    color: #7A1E35;
    font-size: 28px;
    font-weight: 900;
    text-align: center;
    line-height: 1.25;
    padding: 0 22px;
}

.material-image {
    background:
            radial-gradient(circle at 72% 22%, rgba(216, 181, 109, 0.24), transparent 30%),
            linear-gradient(135deg, #FFF9F0, #F5E1E7);
}

.product-content {
    min-height: 360px;
    padding: 26px;
    display: flex;
    flex-direction: column;
}

.product-type {
    width: fit-content;
    margin: 0 0 14px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(216, 181, 109, 0.18);
    border: 1px solid rgba(216, 181, 109, 0.42);
    color: #7A1E35;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.product-content h3 {
    color: #7A1E35;
    font-size: 28px;
    line-height: 1.2;
    margin: 0 0 10px;
}

.product-short {
    color: #1F1519;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.45;
    margin: 0 0 16px;
}

.product-desc {
    color: #7C6A6A;
    line-height: 1.7;
    margin: 0;
}

.product-stock {
    margin-top: auto;
    padding-top: 18px;
    color: #7C6A6A;
}

.product-stock strong {
    color: #7A1E35;
    font-size: 18px;
}

.product-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(216, 181, 109, 0.28);
}

.product-bottom strong {
    color: #4A1020;
    font-size: 26px;
    white-space: nowrap;
}

.product-bottom .small-btn {
    min-width: 118px;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 12px 24px rgba(122, 30, 53, 0.16);
}

.product-bottom .small-btn:hover {
    transform: translateY(-2px);
}

.disabled-btn {
    background: #E5E7EB !important;
    color: #6B7280 !important;
    cursor: not-allowed;
    box-shadow: none !important;
    pointer-events: none;
}

@media (max-width: 1200px) {
    .product-image {
        height: 190px;
    }

    .product-content h3 {
        font-size: 25px;
    }

    .product-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-bottom .small-btn {
        width: 100%;
    }
}

@media (max-width: 950px) {
    .product-card {
        border-radius: 26px;
    }

    .product-image {
        height: 170px;
    }

    .product-image span {
        font-size: 24px;
    }

    .product-content {
        min-height: auto;
        padding: 22px;
    }

    .product-content h3 {
        font-size: 24px;
    }

    .product-short {
        font-size: 16px;
    }

    .product-bottom strong {
        font-size: 24px;
    }
}

/* =========================================================
   CART COUNT BADGE IN SIDEBAR
   ========================================================= */

.menu-cart-link {
    justify-content: flex-start;
}

.menu-label {
    min-width: 0;
}

.cart-count-badge {
    margin-left: auto;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #FFF7E8, #D8B56D);
    color: #541323;
    font-size: 12px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(216, 181, 109, 0.22);
}

.menu a.active .cart-count-badge {
    background: linear-gradient(135deg, #7A1E35, #541323);
    color: #F7DFA8;
}

body.sidebar-collapsed .menu-cart-link {
    position: relative;
}

body.sidebar-collapsed .menu-cart-link .menu-label {
    display: none;
}

body.sidebar-collapsed .cart-count-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 0;
    font-size: 10px;
    z-index: 2;
}

@media (max-width: 950px) {
    body.sidebar-collapsed .menu-cart-link .menu-label {
        display: inline;
    }

    body.sidebar-collapsed .cart-count-badge {
        position: static;
        min-width: 24px;
        height: 24px;
        padding: 0 8px;
        margin-left: auto;
        font-size: 12px;
    }
}

/* =========================================================
   SOCIAL LOGIN
   ========================================================= */

.social-login-divider {
    margin: 18px 0 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(122, 30, 53, 0.72);
    font-size: 13px;
    font-weight: 900;
}

.social-login-divider::before,
.social-login-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(216, 181, 109, 0.42);
}

.social-login-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.social-login-btn {
    min-height: 46px;
    border-radius: 999px;
    border: 1px solid rgba(216, 181, 109, 0.48);
    background: rgba(255, 249, 240, 0.96);
    color: #7A1E35;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 900;
    transition:
            transform 0.18s ease,
            box-shadow 0.18s ease,
            background 0.18s ease;
}

.social-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(122, 30, 53, 0.12);
    background: #FFFFFF;
}

.social-login-btn span {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #FFFFFF;
    color: #7A1E35;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    border: 1px solid rgba(216, 181, 109, 0.42);
}

.social-login-btn.facebook span {
    background: #1877F2;
    color: #FFFFFF;
    border-color: #1877F2;
}

.register-side .social-login-divider {
    color: rgba(255, 247, 232, 0.78);
}

.register-side .social-login-divider::before,
.register-side .social-login-divider::after {
    background: rgba(247, 223, 168, 0.34);
}

.register-side .social-login-btn {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(247, 223, 168, 0.38);
    color: #F7DFA8;
}

@media (max-width: 700px) {
    .social-login-row {
        grid-template-columns: 1fr;
    }
}
