/* Cart Styles - Using Global Theme Variables */

.main-container {
    min-height: 100vh;
    background-color: var(--background);
    transition: background-color 0.3s ease;
    padding-top: 2rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.cart-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: slideDown 0.5s ease;
}

.cart-header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.cart-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Cart Layout */
.cart-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    margin-bottom: 4rem;
}

.cart-items-section h2,
.cart-summary h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* Cart Items Container */
.cart-items-container {
    display: grid;
    gap: 1rem;
    animation: fadeIn 0.5s ease;
}

.cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Single Cart Item */
.cart-item {
    display: grid;
    grid-template-columns: 120px 1fr 120px 120px 60px;
    gap: 1.5rem;
    align-items: center;
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow);
}

.cart-item:hover {
    box-shadow: 0 10px 25px var(--shadow);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.item-image {
    width: 120px;
    height: 120px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--surface-light);
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cart-item:hover .item-image img {
    transform: scale(1.05);
}

.item-details h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.item-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.item-specs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.spec {
    font-size: 0.75rem;
    background: var(--surface-light);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    color: var(--text-secondary);
}

/* Quantity Control */
.item-quantity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--surface-light);
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: var(--primary-light);
    color: white;
}

.qty-display {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-edit {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-edit:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

/* Price Display */
.item-price {
    text-align: right;
}

.unit-price {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.item-total {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
}

/* Item Actions */
.item-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-remove {
    background: transparent;
    border: 1px solid var(--error);
    color: var(--error);
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: var(--error);
    color: white;
}

/* Empty Cart */
.empty-cart {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    animation: fadeIn 0.5s ease;
}

.empty-cart-content {
    text-align: center;
    padding: 3rem;
}

.empty-cart-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-cart-content h2 {
    font-size: 1.875rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-cart-content p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Cart Summary */
.cart-summary {
    background: var(--surface);
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    height: fit-content;
    position: sticky;
    top: 100px;
    box-shadow: 0 4px 12px var(--shadow);
}

.summary-content {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.summary-row.total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-bottom: 0;
}

.summary-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.summary-row.total span:last-child {
    color: var(--primary-light);
}

/* Buttons in Summary */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-light);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 122, 82, 0.3);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-large {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Promo Section */
.promo-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.promo-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.promo-input-group {
    display: flex;
    gap: 0.5rem;
}

.promo-input-group input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--surface-light);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.promo-input-group input::placeholder {
    color: var(--text-secondary);
}

.promo-input-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(255, 122, 82, 0.1);
}

#promoMessage {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.promo-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.promo-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Related Products Section */
.related-products {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 2px solid var(--border-color);
}

.related-products h2 {
    margin-bottom: 2rem;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--surface);
    margin: 10% auto;
    padding: 2rem;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px var(--shadow);
    animation: slideUp 0.3s ease;
}

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

@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover {
    color: var(--text-primary);
}

/* Quantity Selector in Modal */
.quantity-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    background: var(--surface-light);
    padding: 1rem;
    border-radius: 0.5rem;
}

.quantity-selector input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    text-align: center;
    font-weight: 600;
    font-size: 1.125rem;
    background: var(--surface);
    color: var(--text-primary);
}

.quantity-selector input:focus {
    outline: none;
    border-color: var(--primary-light);
}

.quantity-selector .qty-btn {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
}

/* Modal Actions */
.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Success Modal */
.success-modal {
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1rem;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.success-modal h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.success-modal p {
    margin-bottom: 1.5rem;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px var(--shadow);
    z-index: 2000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary-light);
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification-success {
    border-left-color: var(--success);
    color: var(--success);
}

.notification-error {
    border-left-color: var(--error);
    color: var(--error);
}

.notification-warning {
    border-left-color: var(--accent);
    color: var(--accent);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .cart-content {
        grid-template-columns: 1fr;
    }

    .cart-summary {
        position: static;
        top: auto;
    }

    .cart-item {
        grid-template-columns: 100px 1fr 80px 80px 50px;
        gap: 1rem;
    }

    .item-image {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 768px) {
    .cart-header h1 {
        font-size: 1.875rem;
    }

    .cart-item {
        display: grid;
        grid-template-columns: 80px 1fr;
        grid-template-areas: 
            "img details"
            "img price"
            "actions qty";
        gap: 0.75rem;
        padding: 1rem;
        align-items: center;
    }

    .item-image {
        grid-area: img;
        width: 80px;
        height: 80px;
        align-self: start;
    }

    .item-details {
        grid-area: details;
    }

    .item-price {
        grid-area: price;
        text-align: left;
    }
    
    .price-breakdown {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .unit-price {
        margin: 0;
    }

    .item-total {
        font-size: 1.1rem;
    }

    .item-quantity {
        grid-area: qty;
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
    }

    .item-actions {
        grid-area: actions;
        justify-content: flex-start;
    }

    .item-details h3 {
        font-size: 1rem;
    }

    .item-description {
        font-size: 0.75rem;
    }

    .item-specs {
        gap: 0.25rem;
    }

    .spec {
        font-size: 0.65rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .modal-content {
        width: 95%;
        margin: 50% auto;
    }

    .cart-summary {
        padding: 1.5rem;
    }

    .cart-summary h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .summary-row {
        font-size: 0.875rem;
    }

    .btn-large {
        padding: 0.75rem;
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .cart-header {
        margin-bottom: 2rem;
    }

    .cart-header h1 {
        font-size: 1.5rem;
    }

    .cart-subtitle {
        font-size: 0.95rem;
    }

    .cart-item {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "img"
            "details"
            "price"
            "qty"
            "actions";
        text-align: center;
    }

    .item-image {
        width: 120px;
        height: 120px;
        margin: 0 auto;
    }

    .item-price {
        text-align: center;
    }
    
    .price-breakdown {
        justify-content: center;
    }

    .item-quantity {
        justify-content: center;
    }

    .item-actions {
        justify-content: center;
    }

    .item-details h3 {
        font-size: 0.95rem;
    }

    .empty-cart-icon {
        font-size: 3rem;
    }

    .empty-cart-content h2 {
        font-size: 1.5rem;
    }
}
