/* CHECKOUT PAGE STYLES */

/* --- HEADER OVERRIDES (Match Cart Page) --- */
body.checkout-page .main-header {
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

body.checkout-page .brand-logo-text,
body.checkout-page .brand-logo-text a,
body.checkout-page .nav-link, 
body.checkout-page .cart-icon {
    color: #31262A !important; 
}

body.checkout-page .brand-logo-text {
    font-size: 2.5rem;
    padding-top: 10px;
}

body.checkout-page .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(49, 38, 42, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* --- PAGE LAYOUT --- */
body.checkout-page {
    background-color: #FFEAEA;
    padding-top: 40px;
}

.checkout-container {
    max-width: 1200px;
    padding-bottom: 80px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #31262A;
    text-decoration: none;
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.back-link:hover {
    color: #E68A8A;
}

/* --- CARDS & FORMS --- */
.checkout-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
}

.checkout-section-title {
    font-family: "Playfair Display", serif;
    font-size: 1.5rem;
    color: #31262A;
    margin-bottom: 25px;
    text-align: center;
}

.form-label {
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #31262A;
    margin-bottom: 8px;
}

.form-control {
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 12px 15px;
    font-size: 0.9rem;
    color: #555;
    font-family: "Montserrat", sans-serif;
}

.form-control::placeholder {
    color: #ccc;
}

.form-control:focus {
    box-shadow: 0 0 0 3px rgba(230, 138, 138, 0.2);
    border-color: #E68A8A;
}

/* --- PAYMENT DETAILS --- */
.payment-selection {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.payment-option {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s;
}

.payment-option:has(input:checked) {
    border-color: #31262A;
    background-color: #fafafa;
}

.form-check-input:checked {
    background-color: #31262A;
    border-color: #31262A;
}

.btn-complete-purchase {
    background-color: #FFEAEA;
    color: #31262A;
    border: none;
    border-radius: 8px;
    padding: 15px;
    font-family: "Playfair Display", serif;
    font-weight: 600;
    font-size: 1.2rem;
    transition: all 0.3s;
    border: 1px solid #FFEAEA;
}

.btn-complete-purchase:hover {
    background-color: #E68A8A;
    color: white;
    border-color: #E68A8A;
}

.terms-text {
    font-size: 0.75rem;
    color: #888;
}

/* --- STICKY ORDER SUMMARY --- */

/* Key to Sticky:
   1. The Parent Column must not have overflow:hidden.
   2. top: value must account for the fixed header height (~90px usually).
*/
.sticky-wrapper {
    position: -webkit-sticky; /* Safari */
    position: sticky;
    top: 230px; /* Adjust based on header height */
    z-index: 5;
}

.order-summary-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.summary-title {
    font-family: "Playfair Display", serif;
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: #31262A;
}

.checkout-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.checkout-item-img {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 15px;
}

.checkout-item-info h5 {
    font-family: "Playfair Display", serif;
    font-size: 1rem;
    margin-bottom: 5px;
    color: #31262A;
}

.checkout-item-info p {
    font-size: 0.85rem;
    margin-bottom: 0;
    color: #777;
}

.checkout-item-price {
    margin-left: auto;
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #31262A;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-family: "Playfair Display", serif;
    color: #555;
    font-size: 1rem;
}

.summary-total {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: #31262A;
}

/* Mobile Adjustments */
@media (max-width: 991px) {
    .sticky-wrapper {
        position: static; /* Disable sticky on mobile stack */
        margin-top: 30px;
    }
}

/* --- PROOF OF PAYMENT UPLOAD --- */
.proof-of-payment-section {
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px dashed #e0e0e0;
}

.upload-area {
    position: relative;
    border: 2px dashed #d4d4d4;
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.upload-area:hover {
    border-color: #E68A8A;
    background: linear-gradient(135deg, #fff5f5 0%, #ffefef 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(230, 138, 138, 0.15);
}

.upload-area.drag-over {
    border-color: #E68A8A;
    background: linear-gradient(135deg, #fff0f0 0%, #ffe8e8 100%);
    transform: scale(1.02);
}

.upload-icon-wrapper {
    width: 70px;
    height: 70px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, #FFEAEA 0%, #ffdddd 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.upload-icon-wrapper i {
    font-size: 28px;
    color: #E68A8A;
}

.upload-area:hover .upload-icon-wrapper {
    transform: scale(1.1);
    background: linear-gradient(135deg, #E68A8A 0%, #d47070 100%);
}

.upload-area:hover .upload-icon-wrapper i {
    color: white;
}

.upload-text {
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    color: #31262A;
    font-size: 0.95rem;
}

.upload-content small {
    font-family: "Montserrat", sans-serif;
    font-size: 0.8rem;
}

/* Preview State */
.upload-preview {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-preview img {
    max-height: 180px;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 3px solid #fff;
}

.remove-preview-btn {
    position: absolute;
    top: -10px;
    right: calc(50% - 100px);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ff4d4d;
    color: white;
    border: 3px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 77, 77, 0.4);
}

.remove-preview-btn:hover {
    background: #ff3333;
    transform: scale(1.1);
}

.preview-filename {
    margin-top: 12px;
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    color: #666;
    background: #f0f0f0;
    padding: 6px 16px;
    border-radius: 20px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Success Badge */
.upload-success-badge {
    margin-top: 15px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-radius: 25px;
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile adjustments for upload */
@media (max-width: 576px) {
    .upload-area {
        padding: 25px 15px;
    }
    
    .upload-icon-wrapper {
        width: 60px;
        height: 60px;
    }
    
    .upload-icon-wrapper i {
        font-size: 24px;
    }
    
    .remove-preview-btn {
        right: calc(50% - 80px);
    }
}

/* --- QR CODE WARNING OVERLAY --- */
.qr-code-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    display: inline-block; /* Fits content */
    width: 100%;
    max-width: 250px; /* Adjust as needed */
}

/* 
   We want the image to be blurred by default.
   Instead of a separate overlay div, we can just style the image or a container.
   But to be safe and allow a "Click to Reveal" button on top, let's use a container.
*/

.qr-code-wrapper img {
    filter: blur(8px);
    transition: filter 0.3s ease;
    width: 100%;
    display: block;
}

.qr-code-wrapper.revealed img {
    filter: none;
}

.qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.qr-code-wrapper.revealed .qr-overlay {
    opacity: 0;
    pointer-events: none;
}

.btn-reveal-qr {
    background-color: #31262A;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.btn-reveal-qr:hover {
    background-color: #E68A8A;
    transform: translateY(-2px);
}

/* --- DELIVERY SCHEDULE INPUTS --- */
input[type="date"].form-control,
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-color: #fff;
}

/* Custom dropdown arrow for select */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2331262A' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

/* Calendar picker icon styling */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background-color: #FFEAEA;
}

/* Date input focus state */
input[type="date"].form-control:focus,
select.form-control:focus {
    box-shadow: 0 0 0 3px rgba(230, 138, 138, 0.2);
    border-color: #E68A8A;
    outline: none;
}

/* Date picker calendar popup (WebKit browsers) */
input[type="date"]::-webkit-datetime-edit {
    font-family: "Montserrat", sans-serif;
    color: #555;
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

input[type="date"]::-webkit-datetime-edit-text {
    color: #aaa;
    padding: 0 3px;
}

input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
    color: #555;
}

/* Placeholder style for empty date input */
input[type="date"]:invalid::-webkit-datetime-edit {
    color: #ccc;
}

/* Small helper text */
.checkout-card small.text-muted {
    font-family: "Montserrat", sans-serif;
    font-size: 0.75rem;
    margin-top: 5px;
    display: block;
}

/* Mobile adjustments for delivery schedule */
@media (max-width: 576px) {
    input[type="date"].form-control,
    select.form-control {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
}