:root {
    --primary: #e30613;
    --primary-dark: #b0050e;
    --secondary: #0f172a;
    --accent: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Nav */
nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    height: 80px;
    display: flex;
    align-items: center;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    cursor: pointer;
    height: 100%;
}

.logo-anim {
    position: relative;
    width: 140px;
    height: 48px;
    display: flex;
    align-items: center;
}

.logo-anim img {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 100%;
    width: auto;
    object-fit: contain;
}

.logo-main {
    animation: fadeMain 5s infinite;
}

.logo-alt {
    animation: fadeAlt 5s infinite;
    opacity: 0;
}

@keyframes fadeMain {

    0%,
    40% {
        opacity: 1;
    }

    60%,
    80% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes fadeAlt {

    0%,
    40% {
        opacity: 0;
    }

    60%,
    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.search-bar {
    flex: 0 1 500px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.3s;
}

.search-bar input:focus {
    background: white;
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-account-area {
    display: flex;
    align-items: center;
}

.user-trigger {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #1e293b;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.user-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
}

.user-trigger img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    z-index: 2;
}

.avatar-letter {
    font-size: 16px;
    font-weight: 800;
    color: white;
    z-index: 1;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
}

.user-trigger.authenticated {
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
}

.user-role-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    background: #10b981;
}

.user-role-dot.wholesale {
    background: #f59e0b;
}

.user-role-dot.admin {
    background: #ef4444;
}

.cart-trigger {
    background: var(--secondary);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    position: relative;
    cursor: pointer;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Hero */
.hero {
    padding: 3rem 0;
}

.hero-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    color: var(--text-muted);
}

/* Layout */
.shop-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

.sidebar {
    position: sticky;
    top: 100px;
    min-width: 0;
}

.side-box {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    min-width: 0;
}

.box-title {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.cat-item {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.cat-item:hover {
    background: var(--bg);
    color: var(--secondary);
}

.cat-item.active {
    background: var(--primary);
    color: white;
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.img-wrap {
    aspect-ratio: 1;
    padding: 1.5rem;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-body {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-sku {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 700;
    cursor: pointer;
}

.card-name {
    font-size: 0.95rem;
    height: 2.8rem;
    overflow: hidden;
    margin-bottom: 1rem;
    cursor: pointer;
    font-weight: 600;
    line-height: 1.4;
}

.card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-price {
    font-weight: 800;
    font-size: 1.25rem;
    font-family: var(--font-heading);
}

.buy-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.buy-btn:hover {
    background: var(--primary);
    color: white;
}

.sale-tag {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 800;
    border-radius: 4px;
    z-index: 10;
}

/* Detail Overlay */
.detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    z-index: 2000;
    display: none;
    padding: 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.detail-modal {
    background: white;
    max-width: 1000px;
    margin: 2rem auto;
    border-radius: var(--radius-lg);
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.detail-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--border);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: 0.2s;
}

.detail-close:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.detail-container {
    display: grid;
    grid-template-columns: 42% 58%;
    gap: 0;
}

.detail-images {
    padding: 2.5rem;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    height: fit-content;
}

.main-img-wrap {
    width: 100%;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.main-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gallery-strip {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    overflow-x: auto;
    padding: 0.3rem;
    width: 100%;
    justify-content: center;
}

.gallery-img {
    width: 55px;
    height: 55px;
    border: 2px solid var(--border);
    border-radius: 8px;
    object-fit: contain;
    cursor: pointer;
    background: white;
    padding: 3px;
    transition: 0.2s;
    flex-shrink: 0;
}

.gallery-img:hover {
    border-color: var(--primary);
}

.detail-info {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    max-height: 80vh;
    overflow-y: visible;
}

@media (max-width: 900px) {
    .detail-container {
        grid-template-columns: 1fr;
    }

    .detail-images {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1.5rem;
    }

    .detail-info {
        padding: 2rem;
        max-height: none;
    }

    .main-img-wrap {
        height: 280px;
    }
}

.detail-breadcrumbs {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.detail-title {
    font-size: 1.6rem;
    margin-bottom: 1.25rem;
    line-height: 1.3;
    font-family: var(--font-heading);
    color: var(--secondary);
}

.detail-sku-box {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.sku-pill {
    padding: 0.6rem 1.2rem;
    background: #f1f5f9;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.sku-pill.old {
    background: #fee2e2;
    color: #991b1b;
}

.detail-price-box {
    background: #f8fafc;
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.detail-tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid var(--border);
    margin-top: 2rem;
}

.tab-btn {
    padding: 1rem 0;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
}

.tab-btn.active {
    color: var(--secondary);
    border-bottom-color: var(--primary);
}

.specs-table {
    width: 100%;
    margin-top: 1.5rem;
    border-collapse: collapse;
}

.specs-table td {
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    line-height: 1.4;
    vertical-align: top;
}

.specs-table td:first-child {
    color: var(--text-muted);
    width: 40%;
    padding-right: 1rem;
}

.specs-table td:last-child {
    font-weight: 600;
    text-align: left;
    color: var(--secondary);
    word-break: break-word;
}

.doc-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.2rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--secondary);
    font-size: 0.9rem;
    font-weight: 600;
    transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.doc-link:hover {
    background: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    color: var(--primary);
}

/* Dynamic Filters */
.filter-select {
    padding: 0.55rem 2rem 0.55rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.85rem;
    color: var(--text);
    background: white;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    max-width: 220px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.1);
}

.filter-select option:first-child {
    color: var(--text-muted);
}

.filter-clear-btn {
    padding: 0.55rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: rgba(227, 6, 19, 0.06);
    color: var(--primary);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-clear-btn:hover {
    background: var(--primary);
    color: white;
}

@media (max-width: 768px) {
    .filter-select {
        min-width: 0;
        flex: 1 1 calc(50% - 0.4rem);
        font-size: 0.8rem;
        max-width: none;
    }

    .filter-clear-btn {
        flex: 1 1 100%;
    }
}

.doc-link i {
    width: 18px;
    color: var(--primary);
}

/* Loader */
.loading-screen {
    position: fixed;
    inset: 0;
    background: white;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader-logo {
    width: 120px;
    height: auto;
    margin-bottom: 2rem;
    animation: pulseLogo 2s ease-in-out infinite;
}

.loader-line {
    width: 60px;
    height: 3px;
    background: #f1f5f9;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.loader-line::after {
    content: '';
    position: absolute;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    animation: loadLine 1.5s infinite linear;
}

.loader-text {
    margin-top: 1.5rem;
    font-weight: 800;
    color: var(--secondary);
    font-family: var(--font-heading);
    letter-spacing: 2px;
    font-size: 0.9rem;
    text-transform: uppercase;
}

@keyframes pulseLogo {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

@keyframes loadLine {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* Cart Drawer */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    visibility: hidden;
    opacity: 0;
    z-index: 3000;
    transition: 0.3s;
    backdrop-filter: blur(4px);
}

.drawer-overlay.active {
    visibility: visible;
    opacity: 1;
}

.drawer {
    position: fixed;
    right: -420px;
    top: 0;
    bottom: 0;
    width: 420px;
    background: white;
    z-index: 3001;
    transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.drawer.active {
    right: 0;
}

.drawer-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-close {
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
}

.drawer-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem;
}

.cart-item {
    display: flex;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
}

.item-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 5px;
}

.item-info {
    flex-grow: 1;
}

.item-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.qty-control {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    margin-top: auto;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.qty-btn:hover {
    background: #f1f5f9;
}

.drawer-footer {
    padding: 2rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

.total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.total-label {
    font-weight: 600;
    color: var(--text-muted);
}

.total-amount {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--secondary);
    font-family: var(--font-heading);
}

.checkout-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 1.1rem;
    border-radius: 16px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    letter-spacing: 0.5px;
    transition: 0.2s;
}

.checkout-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--border);
    margin-top: 5rem;
    padding: 5rem 0 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 4rem;
}

.footer-static-logo {
    margin-bottom: 2rem;
}

.footer-static-logo img {
    height: 48px;
    width: auto;
    display: block;
}

.footer-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 400px;
}

.footer-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: var(--secondary);
}

.footer-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-nav li {
    font-size: 0.95rem;
    color: var(--text);
    cursor: pointer;
    transition: color 0.2s;
}

.footer-nav li:hover {
    color: var(--primary);
}

.footer-contact p {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.footer-phone {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    margin: 1.5rem 0 0.5rem !important;
}

.footer-email {
    color: var(--text-muted) !important;
}

.footer-bottom {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Mobile Adaptations --- */

/* ===== TABLET (up to 900px) ===== */
@media (max-width: 900px) {
    .container {
        padding: 0 1rem;
    }

    .shop-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: 0;
        margin-bottom: 1rem;
    }

    .detail-tabs {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
}

/* ===== MOBILE (up to 768px) ===== */
@media (max-width: 768px) {

    /* === Container === */
    .container {
        padding: 0 0.75rem;
    }

    /* === Top Info Bar === */
    .top-info-bar {
        font-size: 0.7rem !important;
        padding: 0.4rem 0 !important;
    }

    .top-info-container {
        flex-direction: column !important;
        gap: 0.4rem !important;
        padding: 0.3rem 0 !important;
    }

    .top-info-left {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        align-items: center;
        justify-content: center;
        font-size: 0.65rem !important;
    }

    .top-info-right {
        padding: 3px 8px !important;
        gap: 0.5rem !important;
        font-size: 0.65rem !important;
        justify-content: center;
    }

    .info-item {
        justify-content: center;
        font-size: 0.65rem !important;
    }

    /* === Navigation === */
    nav {
        height: auto;
        padding: 0.6rem 0;
    }

    .nav-content {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .logo {
        order: 1;
    }

    .nav-actions {
        order: 2;
    }

    .search-bar {
        order: 3;
        flex: 1 1 100%;
        margin-top: 0;
    }

    .search-bar input {
        padding: 0.6rem 0.8rem 0.6rem 2.5rem;
        font-size: 0.85rem;
        border-radius: 12px;
    }

    .search-icon {
        left: 0.75rem;
    }

    .logo-anim {
        width: 90px;
        height: 32px;
    }

    .cart-trigger {
        padding: 0.6rem 1rem;
        border-radius: 12px;
    }

    /* === Hero === */
    .hero {
        padding: 1rem 0;
        text-align: center;
        hyphens: auto;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .hero-title {
        font-size: 1.3rem;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 0.85rem;
    }

    /* === Layout === */
    .shop-layout {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .sidebar {
        position: static;
    }

    .side-box {
        padding: 1rem;
        border-radius: 12px;
    }

    /* Horizontal scrollable categories */
    #catWrap {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding-left: 1rem;
        padding-right: 2rem;
        scrollbar-width: none;
    }

    #catWrap::-webkit-scrollbar {
        display: none;
    }

    .cat-item {
        flex: 0 0 auto;
        white-space: nowrap;
        background: #f1f5f9;
        border-radius: 20px;
        padding: 0.5rem 1rem;
        border: 1px solid var(--border);
        font-size: 0.8rem;
    }

    .cat-item.active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }

    .box-title {
        border-bottom: none;
        margin-bottom: 0.5rem;
        font-size: 1rem;
    }

    /* Help box on mobile */
    .side-box[style*="linear-gradient"] {
        display: none;
    }

    /* === Filters === */
    .filters-bar {
        flex-direction: column !important;
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
    }

    .filters-bar select {
        width: 100% !important;
        min-width: 0 !important;
        padding: 0.7rem 0.8rem !important;
        font-size: 0.85rem !important;
        border-radius: 10px !important;
        background-color: #f8fafc;
    }

    /* === Product Grid === */
    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .card {
        border-radius: 12px;
    }

    .card:hover {
        transform: none;
        box-shadow: none;
    }

    .img-wrap {
        padding: 0.75rem;
        aspect-ratio: 1;
    }

    .card-body {
        padding: 0.75rem;
    }

    .card-sku {
        font-size: 0.6rem;
        margin-bottom: 0.3rem;
    }

    .card-name {
        font-size: 0.75rem;
        height: 2.2rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }

    .card-price {
        font-size: 1rem;
    }

    .buy-btn {
        width: 34px;
        height: 34px;
        border-radius: 8px;
    }

    .card-footer {
        gap: 0.3rem;
    }

    .sale-tag {
        top: 0.5rem;
        left: 0.5rem;
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    /* === Detail Modal === */
    .detail-overlay {
        padding: 0;
    }

    .detail-modal {
        margin: 0;
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
        overflow-y: auto;
    }

    .detail-container {
        display: block;
        width: 100%;
    }

    .detail-images {
        padding: 1.25rem !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border);
    }

    .main-img-wrap {
        height: 220px;
    }

    .gallery-strip {
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        margin-top: 1rem;
    }

    .gallery-img {
        width: 45px;
        height: 45px;
    }

    .detail-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 38px;
        height: 38px;
    }

    .detail-info {
        padding: 1.25rem;
        display: block;
        width: 100%;
        box-sizing: border-box;
        max-height: none;
        overflow-y: visible;
    }

    .detail-breadcrumbs {
        font-size: 0.65rem;
        margin-bottom: 0.4rem;
        text-transform: none;
    }

    .detail-title {
        font-size: 1.15rem;
        margin-bottom: 0.75rem;
        line-height: 1.3;
    }

    .detail-sku-box {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .sku-pill {
        padding: 0.45rem 0.8rem;
        font-size: 0.75rem;
        white-space: normal;
        word-break: break-word;
        text-align: center;
    }

    .detail-price-box {
        padding: 1rem;
    }

    .detail-price-box>div:first-child {
        font-size: 1.8rem !important;
    }

    .detail-tabs {
        gap: 0;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .detail-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .specs-table td {
        padding: 0.6rem 0.3rem;
        font-size: 0.85rem;
    }

    .specs-table td:first-child {
        width: 45%;
        padding-right: 0.5rem;
    }

    .doc-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }

    /* === Cart Drawer === */
    .drawer {
        width: 100%;
        right: -100%;
    }

    .drawer-header {
        padding: 1rem 1.25rem;
    }

    .drawer-header h2 {
        font-size: 1.2rem !important;
    }

    .drawer-content {
        padding: 1rem 1.25rem;
    }

    .cart-item {
        gap: 0.8rem;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

    .item-img {
        width: 55px;
        height: 55px;
        border-radius: 10px;
    }

    .item-name {
        font-size: 0.85rem;
        margin-bottom: 0.3rem;
    }

    .drawer-footer {
        padding: 1rem 1.25rem;
    }

    .total-amount {
        font-size: 1.3rem;
    }

    .checkout-btn {
        padding: 0.9rem;
        border-radius: 12px;
        font-size: 0.9rem;
    }

    /* === Checkout Form === */
    .checkout-form-overlay {
        padding: 1rem !important;
        top: 55px !important;
    }

    .checkout-form-overlay h3 {
        font-size: 1.1rem !important;
    }

    .checkout-form-overlay input,
    .checkout-form-overlay textarea {
        padding: 0.7rem !important;
        font-size: 0.85rem !important;
        border-radius: 10px !important;
    }

    .checkout-form-overlay label {
        font-size: 0.8rem !important;
    }

    /* === Export Buttons === */
    .drawer-footer>div[style*="flex"] {
        flex-direction: row !important;
        gap: 6px !important;
    }

    #exportPdf,
    #exportExcel {
        font-size: 0.75rem !important;
        padding: 0.6rem !important;
        border-radius: 8px !important;
    }

    /* === Footer === */
    .footer {
        padding: 2rem 0 1.5rem;
        margin-top: 2rem;
        text-align: center;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-static-logo {
        display: flex;
        justify-content: center;
        margin-bottom: 1rem;
    }

    .footer-static-logo img {
        height: 36px;
    }

    .footer-desc {
        margin: 0 auto;
        font-size: 0.85rem;
    }

    .footer-title {
        margin-bottom: 0.75rem;
        font-size: 1rem;
    }

    .footer-nav ul {
        align-items: center;
        gap: 0.75rem;
    }

    .footer-nav li {
        font-size: 0.85rem;
    }

    .footer-contact p {
        font-size: 0.85rem;
    }

    .footer-phone {
        font-size: 1.1rem;
        margin-top: 0.5rem !important;
    }

    .footer-bottom {
        margin-top: 2rem;
        padding-top: 1rem;
        font-size: 0.8rem;
    }

    /* === Empty Message === */
    #emptyMsg {
        padding: 3rem 0 !important;
    }

    #emptyMsg h2 {
        font-size: 1.2rem;
    }

    #emptyMsg p {
        font-size: 0.85rem;
    }
}

/* ===== EXTRA SMALL (up to 360px) ===== */
@media (max-width: 360px) {
    .container {
        padding: 0 0.5rem;
    }

    .hero-title {
        font-size: 1.15rem;
    }

    .hero-subtitle {
        font-size: 0.75rem;
    }

    .products-grid {
        gap: 0.35rem;
    }

    .card-name {
        font-size: 0.7rem;
        height: 2rem;
    }

    .card-price {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 0.5rem;
    }

    .img-wrap {
        padding: 0.5rem;
    }

    .detail-info {
        padding: 0.75rem;
    }

    .detail-title {
        font-size: 1rem;
    }

    .detail-price-box {
        padding: 0.75rem;
    }

    .detail-price-box>div:first-child {
        font-size: 1.5rem !important;
    }

    .specs-table td {
        font-size: 0.8rem;
        padding: 0.5rem 0.25rem;
    }

    .drawer-header h2 {
        font-size: 1rem !important;
    }

    .total-amount {
        font-size: 1.1rem;
    }
}

/* Competitor price widget spinner */
@keyframes compSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== TELEGRAM AUTH UI ===== */

/* User trigger button in nav */
.user-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    position: relative;
    border: 2px solid transparent;
}

.user-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(42, 171, 238, 0.4);
}

.user-trigger.authenticated {
    background: none;
    border: 2px solid var(--primary);
    overflow: hidden;
}

.user-trigger.authenticated img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-trigger .user-role-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    font-size: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
}

.user-role-dot.retail {
    background: #10b981;
}

.user-role-dot.wholesale {
    background: #f59e0b;
}

.user-role-dot.admin {
    background: #e30613;
}

/* Telegram Login Modal */
.tg-login-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.tg-login-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
}

.tg-login-content {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.tg-login-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #475569;
    transition: 0.2s;
}

.tg-login-close:hover {
    background: #e2e8f0;
}

.tg-login-header {
    text-align: center;
    margin-bottom: 1rem;
}

.tg-login-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    margin: 1rem 0 0.5rem;
    color: var(--secondary);
}

.tg-login-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.tg-login-benefits {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.tg-benefit {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #475569;
    font-weight: 500;
}

.tg-benefit i {
    color: #2AABEE;
}

/* User Dropdown */
.user-dropdown {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 300px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    z-index: 9999;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

.user-dropdown-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--secondary) 0%, #334155 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-dropdown-header img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.user-dropdown-header .user-info {
    flex: 1;
}

.user-dropdown-header .user-info h4 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.user-dropdown-header .user-info span {
    font-size: 0.8rem;
    opacity: 0.8;
}

.user-dropdown-body {
    padding: 12px;
}

.user-dropdown-item {
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #475569;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-dropdown-logout {
    cursor: pointer;
    color: #ef4444;
    font-weight: 600;
    transition: 0.2s;
}

.user-dropdown-logout:hover {
    background: #fef2f2;
}

/* Role badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.retail {
    background: #ecfdf5;
    color: #065f46;
}

.role-badge.wholesale {
    background: #fffbeb;
    color: #92400e;
}

.role-badge.admin {
    background: #fef2f2;
    color: #991b1b;
}

/* User discount banner on page */
.user-discount-banner {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    padding: 10px 20px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== WELCOME POPUP ===== */
.welcome-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
}

.welcome-popup {
    position: relative;
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 440px;
    width: 92%;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
}

.welcome-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    color: #475569;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-popup-close:hover {
    background: #e2e8f0;
}

.welcome-popup-logo {
    text-align: center;
    margin-bottom: 0.5rem;
}

.welcome-popup-title {
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    color: var(--secondary);
    margin: 0.5rem 0;
}

.welcome-popup-desc {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.welcome-benefits {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 1rem;
}

.welcome-benefit-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
}

.wb-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.welcome-benefit-item strong {
    font-size: 0.85rem;
    color: var(--secondary);
}

.welcome-benefit-item small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.welcome-skip-btn {
    width: 100%;
    margin-top: 1.2rem;
    padding: 12px;
    border: 1px solid #e2e8f0;
    background: transparent;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 600;
}

.welcome-skip-btn:hover {
    background: #f8fafc;
    color: var(--secondary);
}

/* ===== PERSONAL CABINET ===== */
.cabinet-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: flex-end;
}

.cabinet-container {
    width: 520px;
    max-width: 100%;
    height: 100%;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    animation: slideFromRight 0.3s ease;
}

@keyframes slideFromRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.cabinet-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cabinet-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.cabinet-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cabinet-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.cabinet-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cabinet-profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.cab-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 800;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cab-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.cab-user-info {
    flex: 1;
}

.cab-user-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--secondary);
}

.cab-username {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 2px 0 8px;
}

.cabinet-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.cab-stat-card {
    background: white;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cab-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cab-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--secondary);
}

.cab-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.cabinet-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    background: white;
    border-radius: 12px;
    padding: 6px;
    border: 1px solid #e2e8f0;
}

.cab-tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cab-tab:hover {
    background: #f1f5f9;
}

.cab-tab.active {
    background: var(--secondary);
    color: white;
}

.cab-tab-content {
    background: white;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.cab-empty {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
}

.cab-empty p {
    margin: 1rem 0 0.3rem;
    font-weight: 600;
}

.cab-empty small {
    font-size: 0.8rem;
}

.cab-order-item {
    padding: 14px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cab-order-item:last-child {
    border-bottom: none;
}

.cab-order-id {
    font-weight: 700;
    font-family: monospace;
    color: var(--secondary);
}

.cab-order-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cab-order-total {
    font-weight: 800;
    color: var(--primary);
}

.cab-form-group {
    margin-bottom: 16px;
}

.cab-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 6px;
}

.cab-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: 0.2s;
    box-sizing: border-box;
    background: #f8fafc;
}

.cab-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.1);
}

.cab-save-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
}

.cab-save-btn:hover {
    background: var(--primary-dark);
}

.cab-setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
}

.cab-setting-item strong {
    font-size: 0.85rem;
    color: var(--secondary);
}

.cab-setting-item small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cab-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    display: inline-block;
}

.cab-toggle input {
    display: none;
}

.cab-toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    cursor: pointer;
    transition: 0.3s;
}

.cab-toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cab-toggle input:checked+.cab-toggle-slider {
    background: #10b981;
}

.cab-toggle input:checked+.cab-toggle-slider::before {
    left: 25px;
}

.cab-logout-btn {
    width: 100%;
    padding: 12px;
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cab-logout-btn:hover {
    background: #fee2e2;
}

@media (max-width: 768px) {
    .user-trigger {
        width: 36px;
        height: 36px;
    }

    .welcome-popup {
        padding: 1.5rem;
        max-width: 95%;
        border-radius: 20px;
    }

    .cabinet-container {
        width: 100%;
    }

    .cabinet-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .cab-stat-card {
        padding: 12px;
    }

    .cabinet-tabs {
        flex-wrap: wrap;
    }

    .cab-tab {
        font-size: 0.75rem;
        padding: 8px;
    }
}