/* cart/style.css */

/* --- CART PAGE --- */
.cart-page main { padding: 4rem 0; }
.empty-cart-message {
    text-align: center;
    padding: 4rem 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.empty-cart-message h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 1rem;
}
.cart-header {
    display: grid;
    grid-template-columns: 100px 2fr 1.5fr 1fr 50px;
    gap: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
    font-weight: 500;
    color: #666;
    margin-bottom: 1rem;
    align-items: center;
}
.cart-header span:nth-child(3), .cart-header span:nth-child(4) {
    text-align: center;
}

.cart-item {
    display: grid;
    grid-template-columns: 100px 2fr 1.5fr 1fr 50px;
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.cart-item-image { width: 100px; height: 100px; object-fit: cover; border-radius: 8px; }
.cart-item-name {
    font-weight: 500;
    font-size: 1.1rem;
    text-decoration: none;
    color: var(--dark-text);
}
.cart-item-name:hover { color: var(--copper); }
.cart-item-price { color: #888; }
.cart-item-quantity { display: flex; justify-content: center; align-items: center; }
.quantity-btn {
    border: 1px solid #ddd;
    background: #f9f9f9;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    border-radius: 50%;
}
.quantity-value { padding: 0 1rem; font-size: 1.1rem; }
.cart-item-total { font-weight: bold; text-align: center; }
.cart-item-remove {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}
.cart-item-remove:hover { color: red; }

.cart-summary {
    width: 100%;
    max-width: 450px;
    margin-left: auto;
    margin-top: 3rem;
    background: var(--beige);
    padding: 2rem;
    border-radius: 12px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}
.summary-row.total-row {
    font-weight: bold;
    font-size: 1.3rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    color: var(--dark-copper);
}
.checkout-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 1.2rem;
    font-size: 1.1rem;
}

/* --- ORDER CONFIRMATION PAGE --- */
.order-confirmation-page .container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6rem 2rem;
}
.confirmation-box {
    background: #fff;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 600px;
}
.confirmation-box h1 {
    font-family: var(--font-heading);
    color: var(--dark-copper);
    margin: 1.5rem 0 1rem;
}
.order-id-label { margin-top: 2rem; color: #666; }
.order-id-display { font-size: 1.5rem; font-weight: bold; font-family: monospace; }
.confirmation-box .cta-button { margin-top: 2rem; }

/* SVG Checkmark Animation */
.checkmark { width: 80px; height: 80px; border-radius: 50%; display: block; stroke-width: 3; stroke: #4CAF50; stroke-miterlimit: 10; margin: 0 auto; box-shadow: inset 0px 0px 0px #4CAF50; animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both; }
.checkmark__circle { stroke-dasharray: 166; stroke-dashoffset: 166; stroke-width: 3; stroke-miterlimit: 10; stroke: #4CAF50; fill: #fff; animation: stroke .6s cubic-bezier(0.65, 0, 0.45, 1) forwards; }
.checkmark__check { transform-origin: 50% 50%; stroke-dasharray: 48; stroke-dashoffset: 48; animation: stroke .3s cubic-bezier(0.65, 0, 0.45, 1) .8s forwards; }
@keyframes stroke { 100% { stroke-dashoffset: 0; } }
@keyframes scale { 0%, 100% { transform: none; } 50% { transform: scale3d(1.1, 1.1, 1); } }
@keyframes fill { 100% { box-shadow: inset 0px 0px 0px 40px #4CAF50; } }

/* --- CHECKOUT MODAL (REFINED & STABILIZED) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    padding: 1rem; /* Use padding for spacing on small screens */
}
.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background: var(--light-bg);
    padding: 2.5rem;
    border-radius: 15px;
    width: 100%;
    max-width: 650px; /* Slightly narrower for a better look */
    max-height: 90vh; /* Limits height to 90% of the viewport */
    overflow-y: auto; /* IMPORTANT: Only vertical scrollbar if needed */
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}
.modal-overlay.visible .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Custom scrollbar for a cleaner look */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}


.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    transition: color 0.2s, transform 0.2s;
}
.close-modal:hover {
    color: var(--dark-text);
    transform: rotate(90deg);
}

/* Modal Form Styles */
.modal-content h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--dark-copper);
}
.form-section {
    margin-bottom: 2.5rem;
}
.form-section h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--dark-text);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.form-group.full-width {
    grid-column: 1 / -1;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: #475569; /* Softer text color */
}
.form-group input {
    padding: 0.8rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--copper);
    box-shadow: 0 0 0 3px rgba(184, 115, 51, 0.15);
}

/* Payment Method Styles */
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.payment-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e2e8f0; /* Thicker, clearer border */
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.payment-option:hover {
    border-color: #cbd5e1;
}
.payment-option.selected {
    border-color: var(--copper);
    background-color: #fdfaf6; /* Use light-bg for subtle highlight */
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.payment-option input[type="radio"] {
    margin-right: 1rem;
    flex-shrink: 0;
    accent-color: var(--copper); /* Modern way to style radio buttons */
    width: 1.2em;
    height: 1.2em;
}
.payment-option span {
    display: flex;
    flex-direction: column;
}
.payment-option small {
    color: #64748b;
    font-size: 0.85rem;
}


#place-order-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 1.1rem;
    font-size: 1.1rem;
}
#place-order-btn:disabled {
    background-color: #94a3b8;
    cursor: wait;
}

.form-status-message {
    text-align: center;
    color: #dc2626; /* Error red */
    min-height: 20px;
    margin-bottom: 1rem;
    font-weight: 500;
}


/* --- RESPONSIVE FOR CART & MODAL --- */
@media(max-width: 768px) {
    /* Cart page responsive */
    .cart-header { display: none; }
    .cart-item {
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto auto auto;
        position: relative;
    }
    .cart-item-image { grid-row: 1 / 4; }
    .cart-item-details { grid-column: 2; }
    .cart-item-quantity { grid-column: 2; grid-row: 2; justify-content: flex-start; margin: 0.5rem 0;}
    .cart-item-total { grid-column: 2; grid-row: 3; text-align: left; }
    .cart-item-remove { position: absolute; top: 1rem; right: 0; }

    /* Modal responsive */
    .modal-overlay {
        padding: 0; /* Remove padding to make modal full-screen */
        align-items: flex-end; /* Align modal to bottom for better mobile UX */
    }
    .modal-content {
        max-height: 85vh; /* Take up more of the screen */
        border-radius: 20px 20px 0 0; /* Rounded corners only at the top */
        padding: 2rem 1.5rem; /* Adjust padding for mobile */
        transform: translateY(100%); /* Start off-screen at the bottom */
    }
    .modal-overlay.visible .modal-content {
        transform: translateY(0); /* Slide in from bottom */
    }
    .modal-content h2 {
        font-size: 1.8rem;
    }
    .form-section h3 {
        font-size: 1.3rem;
    }
    .form-grid {
        grid-template-columns: 1fr; /* Stack form fields */
    }
}