/* Checkout.css - Optimized styles for checkout.html  */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #F7F7FF;
    color: #1E2348;
    line-height: 1.5;
}

/* Header */
.header {
    background: #F7F7FF;
    padding: 20px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Logo sizing */
.logo img {
    width: 200px;
    height: auto;
    max-width: 100%;
}

/* Main Content - Mobile First */
.main-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Desktop: 2 column layout */
@media (min-width: 768px) {
    .main-container {
        margin: 60px auto;
        padding: 0 40px;
        display: grid;
        grid-template-columns: 1fr 400px;
        gap: 80px;
    }
    
    .header-container {
        padding: 0 40px;
        justify-content: space-between;
    }
    
    .logo img {
        width: 242px;
        height: 33px;
    }
}

/* Mobile: Price details appear first */
.price-details {
    background: #DF563B;
    padding: 12px; 
    border-radius: 16px;
    color: #F7F7FF;
    margin-bottom: 20px;
    order: 1;
}

.checkout-form {
    background: #F7F7FF;
    padding: 0;
    order: 2;
}

/* Desktop: Reorder and adjust */
@media (min-width: 768px) {
    .price-details {
        padding: 40px;
        height: fit-content;
        position: sticky;
        top: 40px;
        margin-bottom: 0;
        order: 2;
    }
    
    .checkout-form {
        order: 1;
    }
}

.back-btn {
    font-size: 16px;
    font-weight: 500;
    color: #1E2348;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.back-btn:hover {
    color: #DF563B;
}

h1 {
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 700;
    font-size: 32px;
    color: #1E2348;
    margin-bottom: 40px;
    line-height: 1.1;
}

/* Desktop h1 */
@media (min-width: 768px) {
    h1 {
        font-size: 48px;
        margin-bottom: 60px;
    }
}

.form-section {
    margin-bottom: 32px;
}

/* Desktop form sections */
@media (min-width: 768px) {
    .form-section {
        margin-bottom: 48px;
    }
}

.section-title {
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #1E2348;
    margin-bottom: 16px;
}

/* Desktop section titles */
@media (min-width: 768px) {
    .section-title {
        font-size: 20px;
        margin-bottom: 24px;
    }
}



.form-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}


/* Desktop form rows */
@media (min-width: 768px) {
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        flex-direction: row;
    }
}

.form-row-triple {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

/* Desktop triple rows */
@media (min-width: 768px) {
    .form-row-triple {
        display: grid;
        grid-template-columns: 1fr 1fr;
        flex-direction: row;
    }
}

input, textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    background: #E5E7EB;
    transition: all 0.2s ease;
    color: #6c757d;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #DF563B;
    color: #212529;
}

input::placeholder {
    color: #6c757d;
    font-weight: 400;
}

/* Input validation states */
input.invalid {
    border-color: #dc3545;
}

input.valid {
    border-color: #28a745;
}

/* Override autofill styling to maintain consistency */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #E5E7EB inset !important;
    -webkit-text-fill-color: #6c757d !important;
}

input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px #E5E7EB inset !important;
    -webkit-text-fill-color: #212529 !important;
}

.billing-question {
    color: #1E2348;
    font-weight: 500;
    font-size: 16px;
    margin: 24px 0 16px 0;
}

/* Desktop billing question */
@media (min-width: 768px) {
    .billing-question {
        margin: 32px 0 24px 0;
    }
}

/* Address/Product Toggle Styles */
.address-toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    border: none;
}

/* Desktop address toggle */
@media (min-width: 768px) {
    .address-toggle {
        margin-bottom: 32px;
    }
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: #DF563B;
}

.toggle-option label {
    font-weight: 500;
    color: #1E2348;
    cursor: pointer;
}

/* Delivery Address Section */
.delivery-address-section {
    display: none;
    margin-bottom: 32px;
}

/* Desktop delivery section */
@media (min-width: 768px) {
    .delivery-address-section {
        margin-bottom: 48px;
    }
}

/* Google Pay Button Styling */
#google-pay-button {
    margin-bottom: 20px;
}

.payment-divider {
    text-align: center;
    margin: 24px 0;
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.payment-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e9ecef;
    z-index: 1;
}

.payment-divider span {
    background: #F7F7FF;
    padding: 0 16px;
    position: relative;
    z-index: 2;
}

#card-element {
    padding: 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #E5E7EB;
    transition: all 0.2s ease;
}

#card-element:focus-within {
    border-color: #DF563B;
    background: #E5E7EB;
}

#card-errors {
    color: #dc3545;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 500;
}

.submit-btn {
    background: #DF563B;
    color: white;
    padding: 18px 32px;
    border: none;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 24px;
    width: 100%;
}

/* Desktop submit button */
@media (min-width: 768px) {
    .submit-btn {
        margin-top: 32px;
        width: auto;
    }
}

.submit-btn:hover {
    background: #DF563B;
    transform: translateY(-1px);
    opacity: 0.8;
}

.submit-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
}

/* Loading states - Button with spinner */
.submit-btn.loading {
    cursor: not-allowed;
    opacity: 0.9;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Price Details Sidebar */
.price-details h2 {
    display: none; /* Hidden on mobile */
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 20px;
    margin-bottom: 24px;
}

/* Desktop price details h2 */
@media (min-width: 768px) {
    .price-details h2 {
        display: block; /* Show on desktop */
        font-size: 24px;
        margin-bottom: 32px;
    }
}

.product-item {
    margin-bottom: 0; /* Remove bottom margin on mobile */
}

/* Desktop product item */
@media (min-width: 768px) {
    .product-item {
        margin-bottom: 32px;
    }
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.product-name {
    font-weight: 600;
    font-size: 16px;
}

.product-price {
    font-weight: 700;
    font-size: 20px;
}

.product-description {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.delivery-section {
    display: none; /* Hidden on mobile */
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 24px;
    margin-bottom: 24px;
}

.delivery-section h3 {
    display: none; /* Hidden on mobile */
}

/* Desktop delivery section */
@media (min-width: 768px) {
    .delivery-section {
        display: block; /* Show on desktop */
        padding-top: 32px;
        margin-bottom: 32px;
    }
    
    .delivery-section h3 {
        display: block !important; /* Show on desktop */
        font-size: 20px !important;
        margin-bottom: 24px !important;
    }
}

.delivery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.delivery-name {
    font-weight: 600;
    font-size: 16px;
}

.delivery-price {
    font-weight: 600;
    font-size: 16px;
}

.guarantee-section {
    display: none; /* Hidden on mobile */
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 24px;
    align-items: flex-start;
    gap: 16px;
}

/* Desktop guarantee section */
@media (min-width: 768px) {
    .guarantee-section {
        display: flex; /* Show on desktop */
        padding-top: 32px;
    }
}

.guarantee-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 4px;
}

.guarantee-text h3 {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
}

.guarantee-text p {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

/* Loading and Messages */
.loading {
    display: none; 
    text-align: center;
    margin-top: 16px;
    color: #6c757d;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.success-message {
    display: none;
    background: #d1e7dd;
    color: #0f5132;
    padding: 24px;
    border-radius: 12px;
    margin-top: 24px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    text-align: center;
    border: 1px solid #badbcc;
}

.error-message {
    display: none;
    background: #f8d7da;
    color: #842029;
    padding: 24px;
    border-radius: 12px;
    margin-top: 24px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    border: 1px solid #f5c2c7;
}

/* Google Pay availability message */
.google-pay-unavailable {
    display: none;
    background: #fff3cd;
    color: #856404;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #ffeaa7;
}

/* Skeleton loader for Google Pay */
.google-pay-skeleton {
    height: 50px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 20px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Footer Styles */
.footer {
    background: #DF563B;
    color: #F7F7FF;
    margin-top: 80px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

@media (min-width: 768px) {
    .footer-container {
        flex-direction: row;
        justify-content: space-between;
        padding: 60px 40px 40px;
    }
}

.footer-logo img {
    width: 160px;
    height: auto;
    margin-bottom: 12px;
}

.footer-tagline {
    font-size: 14px;
    opacity: 0.9;
}

.footer-contact h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.footer-contact a {
    color: #F7F7FF;
    text-decoration: none;
    font-size: 16px;
    transition: opacity 0.2s ease;
}

.footer-contact a:hover {
    opacity: 0.8;
}

.footer-bottom-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 768px) {
    .footer-bottom-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 24px 40px;
    }
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 768px) {
    .footer-links {
        flex-direction: row;
        gap: 32px;
    }
}

.footer-links a {
    color: #F7F7FF;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.2s ease;
}

.footer-links a:hover {
    opacity: 0.8;
}

.footer-copyright {
    font-size: 14px;
    opacity: 0.9;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus management */
.focus-trap {
    outline: 2px solid #DF563B;
    outline-offset: 2px;
}

/* Hide Quick Checkout title on mobile */
#payment-form > .form-section:first-child .section-title {
    display: none;
}

/* Show Quick Checkout title on desktop */
@media (min-width: 768px) {
    #payment-form > .form-section:first-child .section-title {
        display: block;
    }
}