/* ========================================
   NAWARA CUSTOM CART - COMPLETE STYLING
   Version: 1.3.0 - Final Fixed
======================================== */

:root {
    --burgundy: #973243;
    --dark-burgundy: #7B1325;
    --green: #10b981;
    --dark: #1A1A1A;
    --light: #666666;
    --border: #E0E0E0;
}

/* ===== CART TRIGGERS (FOR HEADER) ===== */

/* Common trigger styles */
.nawara-cart-trigger {
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Minimal Style */
.nawara-cart-minimal {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: transparent;
    border-radius: 50%;
}

.nawara-cart-minimal:hover {
    background: rgba(151, 50, 67, 0.1);
    transform: scale(1.05);
}

.nawara-cart-minimal i {
    font-size: 22px;
    color: var(--burgundy);
}

.nawara-cart-minimal .nawara-cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
}

/* Button Style */
.nawara-cart-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--burgundy), var(--dark-burgundy));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(151, 50, 67, 0.25);
}

.nawara-cart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(151, 50, 67, 0.35);
}

.nawara-cart-button i {
    font-size: 16px;
    color: white;
}

.nawara-cart-button span {
    color: white;
}

.nawara-cart-button .nawara-cart-count {
    background: white;
    color: var(--burgundy);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-right: -5px;
}

/* Full Style (Icon + Text + Price) - REDESIGNED */
.nawara-cart-full {
    display: inline-flex;
    align-items: center;
    background: white;
    border: 2px solid var(--border);
    border-radius: 50px;
    overflow: visible !important;
    height: 50px;
    padding-right: 4px;
    gap: 0;
}

.nawara-cart-full:hover {
    border-color: var(--burgundy);
    box-shadow: 0 4px 15px rgba(151, 50, 67, 0.2);
    transform: translateY(-1px);
}

.nawara-cart-full-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 1px;
    padding: 0 14px 0 0;
    background: transparent;
    order: 1;
}

.nawara-cart-full-right {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--burgundy), var(--dark-burgundy));
    position: relative;
    border-radius: 50%;
    overflow: visible !important;
    flex-shrink: 0;
    order: 2;
}

.nawara-cart-full-right i {
    font-size: 18px;
    color: white !important;
    z-index: 1;
}

.nawara-cart-label {
    font-size: 10px;
    color: var(--light);
    font-weight: 500;
    line-height: 1;
    text-align: right;
}

.nawara-cart-total {
    font-size: 14px;
    color: var(--dark);
    font-weight: 700;
    line-height: 1;
    text-align: right;
    white-space: nowrap;
}

/* Cart Badge - Universal */
.nawara-cart-badge {
    position: absolute;
    background: linear-gradient(135deg, var(--burgundy), var(--dark-burgundy));
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(151, 50, 67, 0.4);
    animation: cartPulse 0.3s ease;
}

/* Badge for full style */
.nawara-cart-full-right .nawara-cart-badge {
    position: absolute !important;
    top: -6px !important;
    right: -6px !important;
    background: #DC2626 !important;
    color: white !important;
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.5) !important;
    border: 2px solid white !important;
    z-index: 1000 !important;
}

@keyframes cartPulse {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ===== SLIDE-OUT CART PANEL ===== */

/* Overlay */
.nawara-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.nawara-cart-overlay.active {
    background: rgba(0, 0, 0, 0.5);
    opacity: 1;
    visibility: visible;
}

/* Side Panel */
.nawara-cart-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    background: white;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
}

.nawara-cart-panel.active {
    transform: translateX(0);
}

/* Panel Header */
.nawara-cart-header {
    background: linear-gradient(135deg, var(--burgundy), var(--dark-burgundy));
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.nawara-cart-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.nawara-cart-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.nawara-cart-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Panel Body */
.nawara-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Custom Scrollbar */
.nawara-cart-body::-webkit-scrollbar {
    width: 6px;
}

.nawara-cart-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.nawara-cart-body::-webkit-scrollbar-thumb {
    background: var(--burgundy);
    border-radius: 10px;
}

.nawara-cart-body::-webkit-scrollbar-thumb:hover {
    background: var(--dark-burgundy);
}

/* Cart Items */
.nawara-cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nawara-cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #FAFAFA;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.nawara-cart-item:hover {
    background: #F5F5F5;
}

.nawara-cart-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.nawara-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nawara-cart-item-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.nawara-cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nawara-cart-item-title {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
    line-height: 1.3;
}

.nawara-cart-item-title a {
    color: var(--dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nawara-cart-item-title a:hover {
    color: var(--burgundy);
}

.nawara-cart-item-price {
    color: var(--burgundy);
    font-weight: 700;
    font-size: 1rem;
}

/* Quantity Controls */
.nawara-cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
}

.nawara-qty-btn {
    width: 30px;
    height: 30px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    color: var(--burgundy);
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.nawara-qty-btn:hover {
    background: var(--burgundy);
    color: white;
    border-color: var(--burgundy);
    transform: scale(1.05);
}

.nawara-qty-btn:active {
    transform: scale(0.95);
}

.nawara-qty-input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    background: white;
    color: var(--dark);
    pointer-events: none;
    user-select: none;
    -moz-appearance: textfield;
}

.nawara-qty-input::-webkit-outer-spin-button,
.nawara-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.nawara-cart-item-remove {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 24px;
    height: 24px;
    background: #FEE2E2;
    color: #DC2626;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.nawara-cart-item-remove:hover {
    background: #DC2626;
    color: white;
    transform: scale(1.1);
}

/* Empty Cart - FIXED */
.nawara-cart-empty {
    text-align: center;
    padding: 3rem 1.5rem;
}

.nawara-cart-empty i {
    font-size: 4rem;
    color: var(--border);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.nawara-cart-empty h4 {
    font-size: 1.2rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.nawara-cart-empty p {
    color: var(--light);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* THIS IS THE KEY FIX FOR EMPTY CART BUTTON */
.nawara-cart-empty .nawara-cart-btn {
    display: inline-flex !important;
    width: auto !important;
    max-width: 180px !important;
    margin: 0 auto !important;
    padding: 0.75rem 1.5rem !important;
    font-size: 0.9rem !important;
}

/* Panel Footer */
.nawara-cart-footer {
    padding: 1.5rem;
    border-top: 2px solid var(--border);
    flex-shrink: 0;
    background: white;
}

.nawara-cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.nawara-cart-subtotal-label {
    font-size: 1rem;
    color: var(--dark);
    font-weight: 600;
}

.nawara-cart-subtotal-amount {
    font-size: 1.5rem;
    color: var(--burgundy);
    font-weight: 700;
}

.nawara-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nawara-cart-btn {
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.nawara-cart-btn-primary {
    background: linear-gradient(135deg, var(--burgundy), var(--dark-burgundy));
    color: white;
    box-shadow: 0 4px 12px rgba(151, 50, 67, 0.25);
}

.nawara-cart-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(151, 50, 67, 0.35);
    color: white;
}

.nawara-cart-btn-secondary {
    background: white;
    color: var(--burgundy);
    border: 2px solid var(--burgundy);
}

.nawara-cart-btn-secondary:hover {
    background: var(--burgundy);
    color: white;
}

/* Loading State */
.nawara-cart-loading {
    text-align: center;
    padding: 2rem;
}

.nawara-cart-loading i {
    font-size: 2rem;
    color: var(--burgundy);
    animation: spin 1s linear infinite;
}

.nawara-cart-error {
    text-align: center;
    padding: 2rem;
    color: #DC2626;
    font-size: 1rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 480px) {
    .nawara-cart-panel {
        max-width: 100%;
    }
    
    .nawara-cart-full-left {
        padding: 0 10px 0 0;
    }
    
    .nawara-cart-full-right {
        width: 40px;
        height: 40px;
    }
    
    .nawara-cart-full-right i {
        font-size: 16px;
    }
    
    .nawara-cart-label {
        font-size: 9px;
    }
    
    .nawara-cart-total {
        font-size: 13px;
    }
    
    .nawara-cart-header {
        padding: 1.25rem;
    }
    
    .nawara-cart-body {
        padding: 1rem;
    }
    
    .nawara-cart-footer {
        padding: 1.25rem;
    }
    
    .nawara-cart-item {
        padding: 0.875rem;
    }
    
    .nawara-cart-item-image {
        width: 70px;
        height: 70px;
    }
    
    .nawara-cart-empty .nawara-cart-btn {
        max-width: 160px !important;
        padding: 0.7rem 1.25rem !important;
        font-size: 0.85rem !important;
    }
}

/* Prevent body scroll when cart is open */
body.nawara-cart-open {
    overflow: hidden !important;
}