/* Cart Page Styles - Flutter Design Port */
/* Based on Flutter cart_screen.dart (Line 580-1114) */

/* ==================== VARIABLES ==================== */
:root {
    --primary-pink: #FF69B4;
    --accent: #6C63FF;
    --primary-text: #2D3142;
    --secondary-text: #9597A6;
    --light-gray: #E8E8E8;
    --background-color: #F5F5F5;
    --card-background: #FFFFFF;
}

/* ==================== PAGE LAYOUT ==================== */
.cart-page {
    min-height: calc(100vh - 200px);
    background-color: var(--background-color);
    padding: 20px 0 40px;
}

.cart-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Desktop: 2 column layout (items + summary sidebar) */
@media (min-width: 992px) {
    .cart-grid-container {
        display: grid;
        grid-template-columns: 1fr 380px;
        gap: 24px;
        align-items: start;
    }

    .cart-summary-column {
        position: sticky;
        top: 80px;
    }

    .cart-bottom {
        margin: 0;
    }
}

/* ==================== CART HEADER ==================== */
.cart-header {
    padding: 16px 0 20px;
}

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

.cart-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-text);
    margin: 0;
}

.cart-item-count {
    font-size: 14px;
    color: var(--secondary-text);
    margin: 4px 0 0 0;
}

.cart-clear-btn {
    width: 48px;
    height: 48px;
    background: rgba(255, 105, 180, 0.1);
    border: none;
    border-radius: 12px;
    color: var(--primary-pink);
    cursor: pointer;
    transition: all 0.3s;
}

.cart-clear-btn:hover {
    background: rgba(255, 105, 180, 0.2);
    transform: scale(1.05);
}

.cart-clear-btn i {
    font-size: 18px;
}

/* ==================== LOADING STATE ==================== */
.cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--light-gray);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.cart-loading p {
    font-size: 16px;
    color: var(--secondary-text);
}

/* ==================== EMPTY STATE ==================== */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    text-align: center;
    padding: 32px;
    animation: fadeIn 0.6s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.empty-icon {
    width: 120px;
    height: 120px;
    background: rgba(232, 232, 232, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.empty-icon i {
    font-size: 60px;
    color: rgba(149, 151, 166, 0.6);
}

.empty-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-text);
    margin: 0 0 8px 0;
}

.empty-text {
    font-size: 16px;
    color: var(--secondary-text);
    line-height: 1.5;
    margin: 0 0 32px 0;
}

.empty-btn {
    width: 100%;
    max-width: 300px;
    height: 50px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s;
}

.empty-btn:hover {
    background: #5a51e6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.3);
}

/* ==================== CART CONTENT ==================== */
.cart-content {
    animation: fadeIn 0.6s ease-in-out;
}

/* ==================== CART ITEMS ==================== */
.cart-items {
    margin-bottom: 16px;
}

.cart-item {
    background: var(--card-background);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 10px rgba(232, 232, 232, 0.1);
    display: flex;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.cart-item:hover {
    box-shadow: 0 6px 16px rgba(232, 232, 232, 0.2);
    transform: translateY(-2px);
}

.cart-item-image {
    width: 90px;
    height: 90px;
    border-radius: 16px;
    background: rgba(232, 232, 232, 0.1);
    overflow: hidden;
    flex-shrink: 0;
}

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

.cart-item-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(232, 232, 232, 0.1);
}

.cart-item-image-placeholder i {
    font-size: 40px;
    color: rgba(108, 99, 255, 0.5);
}

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

.cart-item-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-text);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cart-item-category {
    font-size: 13px;
    color: var(--secondary-text);
    margin: 0 0 8px 0;
}

.cart-item-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-item-old-price {
    font-size: 14px;
    color: var(--secondary-text);
    text-decoration: line-through;
}

.cart-item-discount-badge {
    padding: 2px 6px;
    background: var(--primary-pink);
    color: white;
    font-size: 10px;
    font-weight: bold;
    border-radius: 4px;
}

.cart-item-price {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent);
}

.cart-item-quantity {
    flex-shrink: 0;
}

.quantity-controls {
    background: rgba(232, 232, 232, 0.1);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.quantity-btn:hover {
    transform: scale(1.1);
}

.quantity-btn.remove {
    color: var(--primary-pink);
}

.quantity-display {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 50%;
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== CART BOTTOM SECTION ==================== */
.cart-bottom {
    background: white;
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 4px 15px rgba(232, 232, 232, 0.2);
}

/* Mobile: Full width at bottom */
@media (max-width: 991px) {
    .cart-bottom {
        margin: 12px -16px 0;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 15px rgba(232, 232, 232, 0.2);
    }
}

/* ==================== COUPON SECTION ==================== */
.coupon-section {
    margin-bottom: 12px;
}

.coupon-input-wrapper {
    background: rgba(232, 232, 232, 0.05);
    border: 1px solid rgba(232, 232, 232, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 6px 0 12px;
    gap: 8px;
}

.coupon-icon {
    color: var(--accent);
    font-size: 18px;
}

.coupon-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-text);
    text-transform: uppercase;
}

.coupon-input::placeholder {
    color: var(--light-gray);
    text-transform: none;
}

.coupon-input:focus {
    outline: none;
}

.coupon-apply-btn {
    height: 34px;
    padding: 0 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.coupon-apply-btn:hover {
    background: #5a51e6;
}

.coupon-apply-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==================== APPLIED COUPON ==================== */
.applied-coupon {
    padding: 12px;
    background: rgba(108, 99, 255, 0.1);
    border: 1.5px solid rgba(108, 99, 255, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.applied-coupon i.fa-check-circle {
    color: var(--accent);
    font-size: 20px;
}

.applied-coupon-info {
    flex: 1;
}

.applied-coupon-info strong {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 2px;
}

.applied-coupon-info span {
    font-size: 11px;
    color: var(--primary-text);
}

.coupon-remove-btn {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--light-gray);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coupon-remove-btn:hover {
    color: var(--primary-text);
}

/* ==================== PRICE SUMMARY ==================== */
.price-summary {
    padding: 12px;
    background: rgba(232, 232, 232, 0.05);
    border-radius: 12px;
    margin-bottom: 12px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--primary-text);
    margin-bottom: 8px;
}

.price-row:last-child {
    margin-bottom: 0;
}

.discount-row {
    color: var(--accent);
}

.discount-text {
    color: var(--accent);
    font-weight: 600;
}

.free-shipping-badge {
    padding: 3px 6px;
    background: rgba(108, 99, 255, 0.1);
    color: var(--accent);
    font-size: 10px;
    font-weight: bold;
    border-radius: 6px;
}

.price-divider {
    height: 1px;
    background: rgba(232, 232, 232, 0.3);
    margin: 10px 0;
}

.total-row {
    margin-top: 10px;
}

.total-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.total-label {
    font-size: 12px;
    color: var(--secondary-text);
}

.total-price {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-text);
}

.total-items {
    padding: 4px 10px;
    background: rgba(108, 99, 255, 0.1);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    border-radius: 16px;
}

/* ==================== CHECKOUT BUTTON ==================== */
.checkout-btn {
    width: 100%;
    height: 50px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.3);
}

.checkout-btn:hover {
    background: #5a51e6;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(108, 99, 255, 0.4);
}

.checkout-btn:active {
    transform: translateY(0);
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-text);
    margin: 0 0 12px 0;
}

.modal-text {
    font-size: 14px;
    color: var(--primary-text);
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    height: 44px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn-cancel {
    background: var(--background-color);
    color: var(--primary-text);
    border: 1px solid var(--light-gray);
}

.modal-btn-cancel:hover {
    background: #e0e0e0;
}

.modal-btn-danger {
    background: var(--primary-pink);
    color: white;
}

.modal-btn-danger:hover {
    background: #ff5a9d;
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Tablet */
@media (max-width: 991px) and (min-width: 769px) {
    .cart-container {
        max-width: 768px;
        padding: 0 16px;
    }

    .cart-content {
        display: block;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .cart-container {
        padding: 0 12px;
    }

    .cart-header {
        padding: 12px 0 16px;
    }

    .cart-title {
        font-size: 20px;
    }

    .cart-item {
        padding: 12px;
        gap: 12px;
    }

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

    .cart-item-name {
        font-size: 14px;
    }

    .cart-item-price {
        font-size: 16px;
    }

    .total-price {
        font-size: 20px;
    }

    .checkout-btn {
        height: 48px;
        font-size: 15px;
    }

    .cart-bottom {
        margin: 12px -12px 0;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .cart-container {
        padding: 0 8px;
    }

    .cart-title {
        font-size: 18px;
    }

    .cart-item {
        padding: 10px;
    }

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

    .cart-item-name {
        font-size: 13px;
    }

    .empty-icon {
        width: 100px;
        height: 100px;
    }

    .empty-icon i {
        font-size: 50px;
    }

    .empty-title {
        font-size: 20px;
    }

    .empty-text {
        font-size: 14px;
    }

    .quantity-controls {
        transform: scale(0.9);
    }
}

/* Desktop-specific quantity controls */
@media (min-width: 769px) {
    .quantity-controls {
        flex-direction: row;
        background: transparent;
        border: 1px solid var(--light-gray);
        border-radius: 20px;
        padding: 4px;
    }

    .quantity-display {
        background: transparent;
        color: var(--primary-text);
        width: 40px;
    }

    .quantity-btn {
        width: 32px;
        height: 32px;
        background: var(--background-color);
        border-radius: 50%;
    }

    .quantity-btn:hover {
        background: #e0e0e0;
        transform: scale(1.05);
    }
}
