/* Checkout Page Styles */

.checkout-page {
    padding: 120px 0 40px 0;
    background: #f8fafc;
    min-height: 100vh;
}

/* Scope container to only checkout page content, not header/footer */
.checkout-page .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.checkout-header {
    margin-bottom: 40px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 10px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #64748b;
    font-size: 14px;
}

.breadcrumb a {
    color: #3b82f6;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #1d4ed8;
}

.breadcrumb .separator {
    color: #94a3b8;
}

.breadcrumb .current {
    color: #64748b;
    font-weight: 500;
}

/* Admin-controlled notification (production time & shipping) */
.checkout-notification {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
}
.checkout-notification i {
    color: #1d4ed8;
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}
.checkout-notification p {
    margin: 0;
    color: #1e3a8a;
    font-size: 15px;
    line-height: 1.5;
}

.checkout-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

/* Login required banner */
.checkout-login-required-banner {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
}
.checkout-login-required-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.checkout-login-required-content i {
    color: #1d4ed8;
    font-size: 1.25rem;
}
.checkout-login-required-content span {
    flex: 1;
    min-width: 200px;
    color: #1e3a8a;
    font-size: 15px;
}
.checkout-login-required-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.checkout-login-required-actions .btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* Scroll-to-field error highlight when "Completa ordine" validation fails */
.checkout-field-error-highlight {
    animation: checkout-field-error-pulse 0.6s ease-out;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.5);
    border-radius: 6px;
}
.checkout-field-error-highlight:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.7);
}
@keyframes checkout-field-error-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.5); }
}

/* Form Styles */
.checkout-form-section {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.checkout-form .form-section {
    margin-bottom: 40px;
}

.checkout-form .form-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 15px;
}

.checkout-form .form-section h3 i {
    color: #3b82f6;
    font-size: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1e3a8a;
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.12);
}

/* Checkbox Styles */
.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}

.checkbox-container input[type="checkbox"] {
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: #1e3a8a;
}

.checkbox-container label {
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    margin: 0;
}

.checkbox-container label a {
    color: #3b82f6;
    text-decoration: none;
}

.checkbox-container label a:hover {
    text-decoration: underline;
}

/* Delivery Address */
.delivery-address {
    margin-top: 20px;
}

#deliveryAddress {
    display: block;
    animation: slideDown 0.3s ease;
}

/* Billing Address */
.billing-address {
    margin-top: 20px;
}

#billingAddress {
    display: block;
    animation: slideDown 0.3s ease;
}

#sameAsDelivery:checked ~ .billing-address,
#sameAsDelivery:checked ~ #billingAddress {
    display: none !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Payment Methods */
.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.payment-option {
    position: relative;
}

.payment-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.payment-option label {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.payment-option label:hover {
    border-color: #93c5fd;
    background: #f8fbff;
}

.payment-option input[type="radio"]:checked + label {
    border-color: #1e3a8a;
    background: #f0f7ff;
}

.payment-option label i {
    font-size: 20px;
    color: #3b82f6;
}

.payment-option label span {
    font-weight: 600;
    color: #374151;
}

.payment-option label small {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Delivery Options */
.delivery-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.delivery-option {
    position: relative;
}

.delivery-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.delivery-option label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.delivery-option label span {
    color: #374151;
}

.delivery-option label span:last-child {
    font-size: 14px;
    color: #6b7280;
}

.delivery-option label .method-description {
    font-size: 14px;
    color: #64748b;
}

.delivery-option label .method-price {
    font-size: 16px;
    font-weight: 600;
    color: #1e3a8a;
    margin-left: auto;
    padding-left: 15px;
}

.delivery-option input[type="radio"]:checked + label {
    border-color: #1e3a8a;
    background: #f0f7ff;
}

.loading-shipping-methods,
.loading-payment-methods {
    text-align: center;
    padding: 20px;
    color: #6b7280;
}

.loading-shipping-methods i,
.loading-payment-methods i {
    margin-right: 8px;
}

/* Terms Section */
.form-section.terms {
    padding-top: 30px;
    border-top: 1px solid #e5e7eb;
}

/* Order Summary Sidebar */
.order-summary-section {
    position: sticky;
    top: 20px;
    align-self: flex-start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.order-summary {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.order-summary h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 15px;
}

.checkout-items {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.checkout-item:last-child {
    border-bottom: none;
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-name {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.item-quantity {
    font-size: 12px;
    color: #6b7280;
}

.item-price {
    font-size: 14px;
    font-weight: 600;
    color: #10b981;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row.total {
    font-size: 18px;
    padding: 15px 0 0 0;
    border-top: 2px solid #1e3a8a;
    margin-top: 10px;
    font-weight: 600;
}

.complete-order-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #1e3a8a;
    color: white;
    margin: 20px 0;
}

.complete-order-btn:hover {
    background: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.security-badges {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.security-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 12px;
    text-align: center;
}

.security-badge i {
    font-size: 20px;
    color: #10b981;
}

/* Responsive Design */
@media (max-width: 768px) {
    .checkout-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .order-summary-section {
        position: static;
        order: -1;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .checkout-form {
        padding: 20px;
    }

    .order-summary {
        padding: 20px;
    }

    .page-title {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .checkout-page .container {
        padding: 0 15px;
    }

    .checkout-form {
        padding: 15px;
    }

    .order-summary {
        padding: 15px;
    }

    .payment-option label,
    .delivery-option label {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .delivery-option label {
        flex-direction: row;
        align-items: center;
    }

    .security-badges {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
