/**
 * Cart Sidebar CSS - Tash Baby Care
 * Version: Compact Footer & Purple Theme
 */

:root {
    --cart-primary: #c86ae2;       /* Brand Purple */
    --cart-primary-hover: #b55cd0; /* Darker Purple */
    --cart-dark: #111827;
    --cart-light: #f9fafb;
    --cart-border: #e5e7eb;
}

/* ==================== 1. Layout ==================== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -450px;
    width: 420px;
    height: 100vh;
    background: #ffffff;
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    transform: translateX(-450px);
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(3px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile */
@media (max-width: 480px) {
    .cart-sidebar { width: 100%; right: -100%; }
    .cart-sidebar.active { transform: translateX(-100%); }
}

/* ==================== 2. Header ==================== */
.cart-sidebar-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--cart-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.cart-sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cart-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-count-badge {
    background: var(--cart-primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.cart-close-btn {
    background: var(--cart-light);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
}

.cart-close-btn:hover {
    background: #e5e7eb;
    color: var(--cart-dark);
    transform: rotate(90deg);
}

/* ==================== 3. Body & Items ==================== */
.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fafafa;
}

.cart-item {
    background: white;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(0,0,0,0.04);
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--cart-light);
    flex-shrink: 0;
}

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

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-right: 20px;
}

.cart-item-title a {
    text-decoration: none;
    color: var(--cart-dark);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
    display: block;
}

.cart-item-variant {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 2px 0 8px 0;
}

.cart-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-item-price {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--cart-dark);
}

/* Remove Button */
.remove-btn-floating {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
}
.remove-btn-floating:hover { color: #ef4444; }

/* Pill Quantity Control */
.quantity-control-pill {
    display: flex;
    align-items: center;
    background: var(--cart-light);
    border-radius: 20px;
    padding: 2px;
    height: 32px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.qty-input {
    width: 30px;
    background: transparent;
    border: none;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 2px;
}

/* ==================== 4. Compact Footer ==================== */
.cart-sidebar-footer {
    background: white;
    padding: 16px 24px;
    border-top: 1px solid var(--cart-border);
    box-shadow: 0 -4px 15px rgba(0,0,0,0.03);
}

.cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 12px;
}

.cart-subtotal-label {
    font-size: 0.95rem;
    color: #6b7280;
    font-weight: 500;
}

.cart-subtotal-amount {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--cart-dark);
}

.cart-delivery-notice {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    color: #166534;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Button Grid */
.cart-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Side by Side */
    gap: 10px;
    margin-bottom: 10px;
}

/* Button Styles */
.cart-btn-primary {
    background: var(--cart-primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.cart-btn-primary:hover {
    background: var(--cart-primary-hover);
    transform: translateY(-1px);
}

.cart-btn-dark {
    background: var(--cart-dark);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
}

.cart-btn-dark:hover {
    background: #000;
    transform: translateY(-1px);
}

.cart-btn-link {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    padding: 8px;
    transition: color 0.2s;
    text-decoration: underline;
}

.cart-btn-link:hover {
    color: var(--cart-dark);
}

/* ==================== 5. Empty State ==================== */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 70%;
    text-align: center;
}

.cart-empty-icon {
    font-size: 3.5rem;
    color: #e5e7eb;
    margin-bottom: 1rem;
}

.cart-empty-text {
    color: var(--cart-dark);
    font-weight: 600;
    margin-bottom: 5px;
}

.cart-empty-subtext {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* The button in empty state uses the primary class */
.cart-empty .cart-btn-primary {
    padding: 10px 30px;
    box-shadow: 0 4px 15px rgba(200, 106, 226, 0.3);
}

/* Loading */
.cart-loading { display: flex; justify-content: center; padding: 40px; }
.cart-loading-spinner {
    width: 30px; height: 30px;
    border: 3px solid #f3f4f6;
    border-top-color: var(--cart-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }