/* =======================================================
   LUXURY SIDE CART DRAWER CSS
   ======================================================= */

.side-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

.side-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic Mobile Viewport Height */
    background: #ffffff;
    z-index: 99999;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.side-cart-drawer.active {
    transform: translateX(0);
}

/* FLEXBOX LAYOUT CONTAINER */
.side-cart-inner,
#side-cart-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* 1. FIXED HEADER */
.side-cart-header {
    flex: 0 0 auto;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.side-cart-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.side-cart-badge {
    color: #64748b;
    font-weight: 500;
    font-size: 1rem;
}

.side-cart-close-btn {
    background: #f8fafc;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.side-cart-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* 2. SCROLLABLE BODY */
.side-cart-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 24px;
    min-height: 0; /* CRITICAL FOR FLEX SCROLLING */
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar */
.side-cart-body::-webkit-scrollbar {
    width: 5px;
}
.side-cart-body::-webkit-scrollbar-track {
    background: #f8fafc;
}
.side-cart-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.side-cart-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Empty State */
.side-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 10px;
}

/* Item Card */
.side-cart-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    margin-bottom: 14px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.side-cart-card:hover {
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.side-cart-card-img-wrap {
    width: 76px;
    height: 76px;
    min-width: 76px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.side-cart-item-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.side-cart-card-content {
    flex: 1 1 auto;
    min-width: 0;
}

.side-cart-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.side-cart-card-title a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.side-cart-card-title a:hover {
    color: #0284c7;
}

.side-cart-remove-btn {
    background: none;
    border: none;
    padding: 4px;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.side-cart-remove-btn:hover {
    color: #ef4444;
}

.side-cart-card-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

/* Quantity Pill */
.side-cart-qty-pill {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 2px 4px;
}

.side-cart-qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.side-cart-qty-btn:hover {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.side-cart-qty-input {
    width: 30px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
    -moz-appearance: textfield;
}

.side-cart-qty-input::-webkit-outer-spin-button,
.side-cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 3. FIXED FOOTER */
.side-cart-footer {
    flex: 0 0 auto;
    padding: 20px 24px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

.side-cart-subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.subtotal-label {
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
}

.subtotal-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.side-cart-shipping-note {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 16px;
}

.side-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.side-cart-btn-primary {
    display: block;
    width: 100%;
    padding: 13px 20px;
    text-align: center;
    background: #0f172a;
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 8px;
    text-decoration: none !important;
    transition: background 0.2s ease;
}

.side-cart-btn-primary:hover {
    background: #1e293b;
}

.side-cart-btn-secondary,
.side-cart-btn-outline {
    display: block;
    width: 100%;
    padding: 12px 20px;
    text-align: center;
    background: #ffffff;
    color: #0f172a !important;
    border: 1.5px solid #0f172a;
    font-weight: 600;
    font-size: 0.92rem;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.side-cart-btn-secondary:hover,
.side-cart-btn-outline:hover {
    background: #f8fafc;
}

/* Spinner Overlay */
.side-cart-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.75);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

.side-cart-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #0f172a;
    border-radius: 50%;
    animation: sideCartSpin 0.7s linear infinite;
}

@keyframes sideCartSpin {
    to { transform: rotate(360deg); }
}