/**
 * Synemai Modal System Styles
 * Drawer, Modal, and Overlay components for AI-first e-commerce
 */

/* ============================================
   BODY SCROLL LOCK
   ============================================ */

body.modal-open {
    overflow: hidden;
}

/* ============================================
   MODAL BACKDROP
   ============================================ */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    transition: opacity var(--duration-base) var(--ease-out);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-backdrop.visible {
    opacity: 1;
}

/* ============================================
   DRAWER (Slide from Right)
   ============================================ */

.modal-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    background: var(--bg-primary);
    z-index: var(--z-modal);
    transform: translateX(100%);
    transition: transform var(--duration-base) var(--ease-out);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    max-width: 100vw;
    overflow: hidden;
}

.modal-drawer.drawer-left {
    right: auto;
    left: 0;
    transform: translateX(-100%);
}

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

/* Drawer Header */
.drawer-header {
    padding: var(--space-4) var(--space-4) var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.drawer-header h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-dark);
}

.drawer-close {
    background: none;
    border: none;
    font-size: var(--text-base);
    cursor: pointer;
    color: var(--text-dark-gray);
    padding: var(--space-1);
    line-height: 1;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    background-color: #fff;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.drawer-close:hover {
    background: var(--bg-secondary-hover);
    color: var(--text-dark);
}

/* Drawer Body */
.drawer-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 var(--space-4) var(--space-4) var(--space-4);
    -webkit-overflow-scrolling: touch;
    min-height: 0; /* Important for flexbox overflow */
}

/* Drawer Footer */
.drawer-footer {
    padding: var(--space-5);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.drawer-register {
    padding: var(--space-5) var(--space-6);
    background: var(--bg-secondary);
    flex-shrink: 0;
    text-align: center;
}

@media (min-width: 1200px) {
    .drawer-register {
        display: none;
    }
}

/* ============================================
   CENTER MODAL
   ============================================ */

.modal-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--bg-primary);
    z-index: var(--z-modal);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    opacity: 0;
    transition: all var(--duration-base) var(--ease-out);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-center.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Modal Sizes */
.modal-center.modal-small {
    width: 400px;
    max-width: 95vw;
}

.modal-center.modal-medium {
    width: 600px;
    max-width: 95vw;
}

.modal-center.modal-large {
    overflow-y: auto;
    overflow-x: hidden;
    width: 900px;
    max-width: 95vw;
}

.modal-center.modal-large .modal-header,
.modal-center.modal-large .checkout-header {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 1;
}

/* Modal Header */
.modal-header {
    padding: var(--space-2) var(--space-4);
    display: flex;
    border-bottom: 1px dotted var(--border-color);
    justify-content: flex-end;
}

.modal-close {
    background: var(--bg-secondary);
    border: none;
    font-size: var(--text-2xl);
    cursor: pointer;
    color: var(--text-dark-gray);
    padding: var(--space-2);
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.modal-close:hover {
    background: var(--bg-secondary-hover);
    color: var(--text-dark);
}

/* Modal Body */
.modal-body {
    padding: 0 var(--space-6) var(--space-6);
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Modal Footer */
.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    flex-shrink: 0;
}

/* ============================================
   DRAWER CONTENT WRAPPERS
   ============================================ */

.cart-drawer-content,
.product-catalog-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* ============================================
   CART DRAWER SPECIFIC
   ============================================ */

.cart-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    background: linear-gradient(136deg, #edecec 0%, #bcbcbc 100%);
    flex-shrink: 0;
    overflow: hidden;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-category {
    font-size: var(--text-xs);
    color: var(--text-light-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-1);
}

.cart-item-name {
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-1);
    color: var(--text-dark);
}

.cart-item-price {
    color: var(--primary);
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.cart-item-quantity .quantity-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2) var(--space-3);
    color: var(--text-dark-gray);
    font-size: var(--text-lg);
    transition: var(--transition-fast);
}

.cart-item-quantity .quantity-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-dark);
}

.cart-item-quantity .quantity-value {
    padding: 0 var(--space-2);
    font-weight: var(--font-medium);
    min-width: 24px;
    text-align: center;
}

.cart-item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    background-color: #fff;
    border-radius: var(--radius-full);
    color: var(--danger);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-base);
}

.cart-item-remove:hover {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

.cart-item-remove svg {
    fill: currentColor;
}

/* Cart Totals */
.cart-totals {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-4);
    color: var(--text-dark);
}

.cart-totals .total-label {
    color: var(--text-dark-gray);
    font-weight: var(--font-medium);
}

.cart-totals .total-value {
    color: var(--primary);
}

/* Empty Cart State */
.empty-cart {
    text-align: center;
    padding: var(--space-12) var(--space-4);
}

.empty-cart-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
}

.empty-cart p {
    color: var(--text-dark-gray);
    margin-bottom: var(--space-6);
    font-size: var(--text-lg);
}

/* ============================================
   PRODUCT CATALOG DRAWER
   ============================================ */

.product-filters {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    padding-top: var(--space-4);
}

.filter-btn {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-dark-gray);
    transition: var(--transition-fast);
    font-family: var(--font-primary);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--gradient-brand);
    color: var(--white);
    border-color: transparent;
}

.product-search-row {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    z-index: 10;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.products-panel .product-search-row {
    background: var(--bg-secondary);
    max-height: 77px;
}

.product-search {
    flex: 1;
    min-width: 0;
}

.catalog-close-btn {
    display: none;
}

@media (min-width: 1200px) {
    .catalog-close-btn {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: var(--space-2);
        border: 2px solid var(--primary);
        border-radius: 9999px;
        background: transparent;
        color: var(--primary);
        cursor: pointer;
        transition: var(--transition-fast);
    }

    .catalog-close-btn:hover {
        background: var(--primary);
        color: var(--white);
    }
}


.product-search input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-family: var(--font-primary);
    transition: var(--transition-fast);
}

.product-search input:focus {
    outline: none;
    border-color: var(--cta);
    box-shadow: var(--focus-ring);
}

.product-search input::placeholder {
    color: var(--text-light);
}

/* Compact Product Grid */
.product-grid-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.product-card-mini {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-base);
    border: 1px solid var(--border-color);
}

.product-card-mini:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.product-card-mini-image {
    aspect-ratio: 1;
    background: linear-gradient(136deg, #edecec 0%, #bcbcbc 100%);
    overflow: hidden;
}

.product-card-mini-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card-mini-info {
    padding: var(--space-3);
    background-color: var(--bg-secondary);
}

.product-card-mini-category {
    font-size: var(--text-xs);
    color: var(--text-light-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-1);
}

.product-card-mini-name {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    margin-bottom: var(--space-1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-dark);
    line-height: var(--leading-snug);
}

.product-card-mini-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-card-mini-price {
    font-weight: var(--font-bold);
    color: var(--primary);
    font-size: var(--text-base);
}

.mini-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: background 0.2s;
}

.mini-cart-btn .icon-cart,
.mini-cart-btn .icon-plus {
    position: absolute;
    font-size: 11px;
    transition: opacity 0.15s, transform 0.15s;
}

.mini-cart-btn .icon-cart {
    opacity: 1;
    transform: scale(1);
}

.mini-cart-btn .icon-plus {
    opacity: 0;
    transform: scale(0.6);
}

.mini-cart-btn:hover .icon-cart {
    opacity: 0;
    transform: scale(0.6);
}

.mini-cart-btn:hover .icon-plus {
    opacity: 1;
    transform: scale(1);
}

.mini-cart-btn:hover {
    background: var(--primary-dark, #07312d);
}

.mini-detail-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 13px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.mini-detail-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Skeleton Loading Grid */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.skeleton-grid.hidden {
    display: none;
}

.product-grid-compact.loading {
    display: none;
}

.skeleton-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.skeleton-image {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #d1d1d1 0%, #9a9a9a 100%);
    position: relative;
    overflow: hidden;
}

.skeleton-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    animation: shimmer 1.5s infinite;
}

.skeleton-info {
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
}

.skeleton-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
    animation: shimmer 1.5s infinite;
}

.skeleton-line.short {
    width: 40%;
}

.skeleton-line.medium {
    width: 70%;
}

.skeleton-line.price {
    width: 30%;
    height: 16px;
    margin-top: var(--space-1);
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================
   PRODUCT QUICKVIEW MODAL
   ============================================ */

.product-quickview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    align-items: center;
    padding-top: var(--space-3);
}

.quickview-image {
    aspect-ratio: 1;
    background: linear-gradient(136deg, #edecec 0%, #bcbcbc 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.quickview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quickview-info {
    display: flex;
    flex-direction: column;
}

.quickview-info .product-category {
    font-size: var(--text-sm);
    color: var(--text-light-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-2);
}

.quickview-info h2 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin: 0 0 var(--space-3);
    color: var(--text-dark);
    line-height: var(--leading-tight);
}

.quickview-info .product-price {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-4);
}

.quickview-info .product-description {
    color: var(--text-dark-gray);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-6);
    flex: 1;
}

.quickview-info .product-stock {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.quickview-info .product-stock.in-stock {
    background: var(--success-light);
    color: var(--success-dark);
}

.quickview-info .product-stock.out-of-stock {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.quickview-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}


/* ============================================
   CHECKOUT MODAL
   ============================================ */

.checkout-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkout-header h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
}

.checkout-progress {
    display: flex;
    justify-content: center;
    padding: var(--space-6);
    gap: var(--space-2);
    background: var(--bg-secondary);
}

.checkout-progress .step {
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    color: var(--text-dark-gray);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    transition: var(--transition-fast);
}

.checkout-progress .step-number {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
}

.checkout-progress .step.active {
    border: 2px solid var(--primary);
    background: var(--gradient-brand);
    color: var(--white);
}

.checkout-progress .step.active .step-number {
    background: rgba(255, 255, 255, 0.3);
}

.checkout-progress .step.completed {
    border: 2px solid var(--primary);
    background: var(--primary);
    color: var(--white);
}

.checkout-progress .step.completed .step-number {
    background: rgba(255, 255, 255, 0.3);
    color: transparent;
    position: relative;
}

.checkout-progress .step.completed .step-number::after {
    content: '\2713';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: var(--text-xs);
}

.checkout-content {
    padding: var(--space-6);
    max-height: 50vh;
    overflow-y: auto;
}

.checkout-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
}

/* Checkout Form Styles */
.checkout-form .form-group {
    margin-bottom: var(--space-4);
}

.checkout-form .form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.checkout-form label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: var(--font-medium);
    color: var(--text-dark);
    font-size: var(--text-sm);
}

.checkout-form input,
.checkout-form select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-primary);
    transition: var(--transition-fast);
}

.checkout-form input:focus,
.checkout-form select:focus {
    outline: none;
    border-color: var(--cta);
    box-shadow: var(--focus-ring);
}

/* Checkout Confirmation */
.checkout-confirmation {
    text-align: center;
    padding: var(--space-8) var(--space-4);
}

.confirmation-icon {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--white);
    margin: 0 auto var(--space-6);
    animation: scaleIn 0.5s var(--ease-out);
}

.checkout-confirmation h2 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-4);
    color: var(--text-dark);
}

.checkout-confirmation .order-number {
    font-size: var(--text-lg);
    margin-bottom: var(--space-4);
    color: var(--text-dark-gray);
}

.checkout-confirmation .demo-notice {
    background: var(--warning-light);
    color: var(--warning-dark);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
}

/* ============================================
   BUTTONS (for modals)
   ============================================ */

.btn-block {
    border-radius: var(--radius-full);
    border: 2px solid var(--primary);
    width: 100%;
    display: block;
}

.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

.btn-success:hover {
    background: var(--success-dark);
    border-color: var(--success-dark);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes slideInRight {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(30px);
        opacity: 0;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}


/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    /* Drawer takes full width on mobile */
    .modal-drawer {
        width: 100% !important;
    }

    /* Modal adjustments */
    .modal-center {
        width: 95vw !important;
        max-height: 90vh;
        border-radius: var(--radius-lg);
    }

    /* Fullscreen modal on mobile */
    .modal-center.modal-fullscreen-mobile {
        width: 100vw !important;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: translateY(100%);
    }

    .modal-center.modal-fullscreen-mobile.open {
        transform: translateY(0);
    }

    /* Product quickview single column */
    .product-quickview {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .quickview-image {
        max-height: 250px;
        aspect-ratio: 4/3;
    }

    .quickview-info h2 {
        font-size: var(--text-xl);
    }

    .quickview-info .product-price {
        font-size: var(--text-2xl);
    }

    /* Checkout form adjustments */
    .checkout-form .form-row {
        grid-template-columns: 1fr;
    }

    .checkout-progress {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .checkout-progress .step {
        flex: 1;
        justify-content: center;
        min-width: 100px;
    }


    .checkout-footer .btn {
        width: 100%;
    }

    /* Product grid single column on very small screens */
    .product-grid-compact {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    /* Drawer header matches navbar mobile padding */
    .drawer-header {
        padding: var(--space-2) var(--space-4) var(--space-2) var(--space-6);
        min-height: 62px;
    }

    /* Cart item adjustments */
    .cart-item {
        gap: var(--space-3);
        padding: var(--space-4) var(--space-2);
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
    }

    .cart-item-category {
        display: none;
    }

    .cart-item-actions {
        gap: var(--space-2);
        font-size: var(--text-sm);
    }

    .cart-item-quantity {
        gap: 0;
    }

    .cart-item-quantity .quantity-btn {
        padding: var(--space-1) var(--space-3);
    }

       .cart-item-price{
        font-size: var(--text-base);
    }
}

@media (max-width: 480px) {
    .product-grid-compact {
        gap: var(--space-2);
    }

    .drawer-header,
    .drawer-footer,
    .drawer-register {
        padding: var(--space-2) var(--space-4);
    }

    .drawer-body {
        padding: 0 var(--space-3) var(--space-3);
    }
}

/* ============================================
   LOADING STATES
   ============================================ */

.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
}

.modal-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   NOTIFICATION STYLES (fallback)
   ============================================ */

.modal-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    z-index: 9999;
    animation: slideInRight 0.3s var(--ease-out);
    box-shadow: var(--shadow-lg);
    font-weight: var(--font-medium);
}

.modal-notification.notification-success {
    background: var(--success);
    color: var(--white);
}

.modal-notification.notification-error {
    background: var(--danger);
    color: var(--white);
}

.notification-close {
    background: none;
    border: none;
    color: inherit;
    font-size: var(--text-xl);
    cursor: pointer;
    opacity: 0.8;
    transition: var(--transition-fast);
    padding: 0;
    line-height: 1;
}

.notification-close:hover {
    opacity: 1;
}

/* ============================================
   RECENTLY VIEWED SLIDER
   ============================================ */

.recently-viewed-slider {
    padding-top: var(--space-4);
    padding-bottom: var(--space-6);
    flex-shrink: 0;
}

.recently-viewed-header {
    margin-bottom: var(--space-3);
}

.recently-viewed-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-light-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recently-viewed-track {
    mask-image: linear-gradient(to right, transparent 0%, black 10% 90%, transparent 100%);
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    padding-bottom: var(--space-2);
    padding-top: var(--space-2) ;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.recently-viewed-track::-webkit-scrollbar {
    display: none;
}

.recently-viewed-track.dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.recently-viewed-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    cursor: pointer;
    transition: var(--transition-fast);
}

.recently-viewed-item:hover {
    transform: translateY(-2px);
}

.recently-viewed-thumb {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: var(--transition-fast);
    background: var(--bg-secondary);
}

.recently-viewed-item:hover .recently-viewed-thumb {
    border-color: #009e51;
}

.recently-viewed-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}

/* ============================================
   CHAT HISTORY DRAWER
   ============================================ */

.drawer-close-btn {
    background: none;
    border: 1px solid var(--border-color);
    font-size: var(--text-lg);
    cursor: pointer;
    color: var(--text-dark);
    padding: var(--space-2);
    line-height: 1;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-close-btn:hover {
    background: var(--bg-secondary-hover);
    color: var(--text-dark);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    padding: 0 var(--space-4) var(--space-4) var(--space-4)
}

.chat-history-list {
    display: flex;
    flex-direction: column;
}

.chat-history-item {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--bg-primary);
}

.chat-history-item:hover {
    background: var(--bg-secondary);
}

.chat-history-item:last-child {
    border-bottom: none;
}

.chat-history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-1);
    gap: var(--space-3);
}

.chat-history-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-dark);
    margin: 0;
    flex: 1;
    line-height: var(--leading-snug);
}

.chat-history-date {
    font-size: var(--text-xs);
    color: var(--text-light-gray);
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-history-preview {
    font-size: var(--text-sm);
    color: var(--text-dark-gray);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: var(--leading-relaxed);
}

.chat-history-last {
    font-size: var(--text-xs);
    color: var(--text-light-gray);
    margin: 0;
    font-style: italic;
}
