/* ========================================
   CART PAGE - MOBILE RESPONSIVE DESIGN
   Inspired by comparison-new.html approach
   ======================================== */

/* ========================================
   DESKTOP STYLES (Base)
   ======================================== */

.cart-items-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.cart-item:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ========================================
   CART SUMMARY (Sidebar)
   ======================================== */

.cart-summary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    position: sticky;
    top: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-row:last-child {
    border-bottom: none;
}

/* ========================================
   TABLET OPTIMIZATION (768px - 1024px)
   ======================================== */

@media (max-width: 1024px) {
    .cart-layout {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }
    
    .cart-summary {
        position: static;
        width: 100%;
    }
}

/* ========================================
   MOBILE OPTIMIZATION (max-width: 768px)
   Card-based layout for better mobile UX
   ======================================== */

@media (max-width: 768px) {
    /* Container adjustments */
    .cart-container {
        padding: 1rem !important;
    }
    
    /* Welcome banner mobile */
    .welcome-banner {
        padding: 1.5rem 1rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .welcome-banner h1 {
        font-size: 1.75rem !important;
    }
    
    .welcome-banner p {
        font-size: 0.9rem !important;
    }
    
    /* Cart items - Card style */
    .cart-items-container {
        gap: 1rem;
    }
    
    .cart-item {
        padding: 1.25rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Item header (image + name) */
    .cart-item-header {
        display: flex;
        align-items: flex-start;
        gap: 1rem;
        padding-bottom: 1rem;
        border-bottom: 2px solid rgba(99, 102, 241, 0.2);
    }
    
    .cart-item-image {
        width: 60px !important;
        height: 60px !important;
        border-radius: 8px;
        flex-shrink: 0;
    }
    
    .cart-item-name {
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        color: #6366f1 !important;
        line-height: 1.3;
    }
    
    /* Item details - Stack vertically */
    .cart-item-details {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .cart-item-detail-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
    }
    
    .cart-item-detail-label {
        font-size: 0.75rem;
        font-weight: 700;
        color: #888;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .cart-item-detail-value {
        font-size: 0.95rem;
        font-weight: 600;
        color: #fff;
        text-align: right;
    }
    
    /* Detail items - NO ICONS */
    .detail-item {
        display: flex;
        align-items: center;
        font-size: 0.9rem;
        padding: 0.5rem 0;
    }
    
    .detail-item strong {
        color: #fff;
    }
    
    /* Hide service icon boxes */
    .service-icon {
        display: none;
    }
    
    /* Service details grid on mobile */
    .service-details {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-top: 1rem;
    }
    
    /* Price styling */
    .cart-item-price {
        font-size: 1.5rem !important;
        font-weight: 800 !important;
        color: #6366f1 !important;
    }
    
    .cart-item-price-free {
        font-size: 1.5rem !important;
        font-weight: 800 !important;
        color: #10b981 !important;
    }
    
    /* Specs list mobile */
    .cart-item-specs {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 8px;
        padding: 1rem;
        margin: 0.5rem 0;
    }
    
    .cart-item-specs ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .cart-item-specs li {
        padding: 0.5rem 0;
        font-size: 0.875rem;
        line-height: 1.6;
        color: rgba(255, 255, 255, 0.9);
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    /* Remove button mobile */
    .cart-item-remove {
        width: 100% !important;
        padding: 0.875rem !important;
        margin-top: 0.5rem;
        border-radius: 8px !important;
        font-weight: 700 !important;
        font-size: 0.9rem !important;
        background: rgba(239, 68, 68, 0.1) !important;
        color: #ef4444 !important;
        border: 1px solid rgba(239, 68, 68, 0.3) !important;
        transition: all 0.3s ease;
    }
    
    .cart-item-remove:hover {
        background: rgba(239, 68, 68, 0.2) !important;
        border-color: rgba(239, 68, 68, 0.5) !important;
        transform: scale(0.98);
    }
    
    /* Cart summary mobile */
    .cart-summary {
        padding: 1.25rem;
        margin-top: 1.5rem;
        border: 2px solid rgba(99, 102, 241, 0.3);
        background: rgba(99, 102, 241, 0.05);
    }
    
    .cart-summary h3 {
        font-size: 1.25rem !important;
        margin-bottom: 1rem !important;
    }
    
    .summary-row {
        padding: 0.875rem 0;
        font-size: 0.95rem;
    }
    
    .summary-row-total {
        padding-top: 1rem;
        margin-top: 0.5rem;
        border-top: 2px solid rgba(255, 255, 255, 0.2) !important;
    }
    
    .summary-row-total .summary-value {
        font-size: 1.75rem !important;
        font-weight: 800 !important;
        color: #6366f1 !important;
    }
    
    /* Checkout button mobile */
    .checkout-button {
        width: 100% !important;
        padding: 1.125rem !important;
        margin-top: 1rem;
        font-size: 1rem !important;
        font-weight: 700 !important;
        border-radius: 12px !important;
        background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
        box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4) !important;
        transition: all 0.3s ease;
    }
    
    .checkout-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5) !important;
    }
    
    /* Empty cart mobile */
    .empty-cart {
        padding: 3rem 1.5rem !important;
        text-align: center;
    }
    
    .empty-cart i {
        font-size: 4rem !important;
        margin-bottom: 1rem;
    }
    
    .empty-cart h3 {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .empty-cart p {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
    }
}

/* ========================================
   SMALL MOBILE (max-width: 480px)
   ======================================== */

@media (max-width: 480px) {
    .cart-container {
        padding: 0.75rem !important;
    }
    
    .welcome-banner {
        padding: 1.25rem 0.875rem !important;
    }
    
    .welcome-banner h1 {
        font-size: 1.5rem !important;
    }
    
    .cart-item {
        padding: 1rem;
    }
    
    .cart-item-header {
        gap: 0.75rem;
    }
    
    .cart-item-image {
        width: 50px !important;
        height: 50px !important;
    }
    
    .cart-item-name {
        font-size: 1rem !important;
    }
    
    .cart-item-price {
        font-size: 1.25rem !important;
    }
    
    .cart-item-specs {
        padding: 0.875rem;
    }
    
    .cart-item-specs li {
        font-size: 0.8rem;
        padding: 0.375rem 0;
    }
    
    /* Service details stacks vertically on small mobile */
    .service-details {
        grid-template-columns: 1fr;
    }
    
    /* Keep icons readable */
    .detail-item {
        font-size: 0.85rem;
    }
    
    .detail-item i {
        width: 18px;
    }
    
    .service-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 1.25rem;
    }
    
    .cart-summary {
        padding: 1rem;
    }
    
    .summary-row {
        font-size: 0.875rem;
    }
    
    .summary-row-total .summary-value {
        font-size: 1.5rem !important;
    }
    
    .checkout-button {
        padding: 1rem !important;
        font-size: 0.95rem !important;
    }
}

/* ========================================
   EXTRA SMALL MOBILE (max-width: 360px)
   ======================================== */

@media (max-width: 360px) {
    .cart-container {
        padding: 0.5rem !important;
    }
    
    .cart-item {
        padding: 0.875rem;
    }
    
    .cart-item-image {
        width: 45px !important;
        height: 45px !important;
    }
    
    .cart-item-name {
        font-size: 0.95rem !important;
    }
    
    .cart-item-detail-label {
        font-size: 0.7rem;
    }
    
    .cart-item-detail-value {
        font-size: 0.85rem;
    }
}

/* ========================================
   LANDSCAPE MODE OPTIMIZATION
   ======================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .welcome-banner {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .cart-item {
        padding: 1rem;
    }
    
    .cart-summary {
        position: static;
    }
}

/* ========================================
   LOADING STATES & ANIMATIONS
   ======================================== */

@media (max-width: 768px) {
    .cart-item {
        animation: slideInUp 0.4s ease-out;
    }
    
    @keyframes slideInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Stagger animation for multiple items */
    .cart-item:nth-child(1) { animation-delay: 0.1s; }
    .cart-item:nth-child(2) { animation-delay: 0.2s; }
    .cart-item:nth-child(3) { animation-delay: 0.3s; }
    .cart-item:nth-child(4) { animation-delay: 0.4s; }
}

/* ========================================
   TOUCH OPTIMIZATION
   ======================================== */

@media (max-width: 768px) {
    .cart-item {
        -webkit-tap-highlight-color: rgba(99, 102, 241, 0.1);
    }
    
    .cart-item-remove,
    .checkout-button {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Better touch targets */
    .cart-item-remove {
        min-height: 44px;
    }
    
    .checkout-button {
        min-height: 48px;
    }
}

/* ========================================
   HIGH DPI SCREENS (Retina)
   ======================================== */

@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2),
       (max-width: 768px) and (min-resolution: 192dpi) {
    .cart-item,
    .cart-summary {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ========================================
   BADGE STYLING FOR MOBILE
   ======================================== */

@media (max-width: 768px) {
    .badge-free {
        display: inline-block;
        padding: 0.375rem 0.875rem;
        background: rgba(16, 185, 129, 0.15);
        color: #10b981;
        border-radius: 8px;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
    
    .badge-premium {
        display: inline-block;
        padding: 0.375rem 0.875rem;
        background: rgba(99, 102, 241, 0.15);
        color: #6366f1;
        border-radius: 8px;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
}
