/* Simplified Checkout Styles */

/* Override header styles for checkout */
header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 70px;
}

.navbar {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo img {
    height: 40px;
    width: auto;
}

.checkout-header-text {
    margin-left: auto;
}

.checkout-header-text h1 {
    font-size: 24px;
    color: #2f61ab;
    font-weight: 600;
    margin: 0;
}

.checkout-main {
    min-height: calc(100vh - 70px);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 40px 20px;
    margin-top: 70px; /* Account for fixed header */
}

.checkout-container {
    max-width: 900px;
    margin: 0 auto;
    display: block;
    padding-top: 20px;
}

/* Main Content Area */
.checkout-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(47, 97, 171, 0.08);
}

/* Selected Plan Card */
.selected-plan-card {
    background: linear-gradient(135deg, #50bed0 0%, #2f61ab 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.selected-plan-card h2 {
    font-size: 18px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.plan-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.plan-name {
    font-size: 24px;
    font-weight: 700;
}

.plan-description {
    font-size: 16px;
    opacity: 0.95;
}

.additional-bottles-info {
    font-size: 14px;
    margin-top: 5px;
    opacity: 0.9;
}

.plan-price-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.plan-price {
    font-size: 28px;
    font-weight: 700;
}

.billing-period {
    font-size: 16px;
    opacity: 0.9;
}

.regular-price-note {
    font-size: 14px;
    opacity: 0.85;
    font-weight: 500;
}

.promotion-badge {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.second-month-price {
    font-size: 15px;
    color: #ffffff;
    font-weight: 600;
    text-align: center;
    margin-top: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.second-month-price #second-month-label {
    display: inline;
    margin-right: 6px;
    opacity: 0.95;
}

.second-month-price #second-month-value {
    display: inline;
    font-weight: 700;
    font-size: 18px;
}

.dispenser-info {
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 14px;
}

.dispenser-label {
    opacity: 0.9;
}

.price-legal-note {
    width: 100%;
    margin-top: 10px;
    font-size: 12px;
    opacity: 0.85;
    line-height: 1.4;
}

.checkout-legal-info {
    background: #f5f7fa;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 30px;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.checkout-legal-info p {
    margin: 0 0 6px;
}

.checkout-legal-info p:last-child {
    margin-bottom: 0;
}

.checkout-legal-info a {
    color: #2f61ab;
    text-decoration: underline;
}

.terms-section {
    padding-bottom: 10px;
}

.terms-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.terms-checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.terms-checkbox-label a {
    color: #2f61ab;
    text-decoration: underline;
}

.express-checkout-container.disabled {
    opacity: 0.4;
    pointer-events: none;
    position: relative;
}

.express-checkout-container.disabled::after {
    content: 'Acepta las condiciones para pagar con Apple Pay / Google Pay';
    display: block;
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

/* Plan card billing switcher */
.plan-billing-switcher {
    margin-top: 15px;
    text-align: center;
}

.plan-billing-switcher .billing-switch-btn {
    background: white;
    color: #2f61ab;
    border: 2px solid white;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.plan-billing-switcher .billing-switch-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
    color: #2f61ab;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Plan card features */
.plan-features {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.plan-features .feature-item {
    color: white;
    font-size: 14px;
    margin-bottom: 8px;
    opacity: 0.95;
}

/* Contact Options Banner */
.contact-options-banner {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #50bed0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(80, 190, 208, 0.15);
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.banner-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #2f61ab;
}

.banner-icon {
    font-size: 24px;
}

.banner-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.banner-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.banner-btn.whatsapp {
    background-color: #25D366;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.banner-btn.whatsapp:hover {
    background-color: #20bd5a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.banner-btn.call {
    background-color: #007AFF;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    display: flex; /* Always show by default, JS will hide if outside hours */
}

.banner-btn.call:hover {
    background-color: #0066dd;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4);
}

.banner-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.banner-btn span:first-child {
    font-size: 18px;
}

/* Form Sections */
.form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e5e9f0;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: #2f61ab;
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    color: #333;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #50bed0;
    box-shadow: 0 0 0 3px rgba(80, 190, 208, 0.1);
}

.form-group input.error,
.form-group select.error {
    border-color: #e74c3c;
}

.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Phone Input */
.phone-input-container {
    display: flex;
    gap: 10px;
}

.phone-input-container select {
    width: 110px;
}

.phone-input-container input {
    flex: 1;
}

/* Payment Section */
.payment-section {
    background: #f9fbfd;
    padding: 25px;
    border-radius: 12px;
    margin-top: 30px;
}

.sepa-info {
    background: #e8f4fd;
    border-left: 4px solid #50bed0;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.sepa-info p {
    margin: 0;
    color: #2f61ab;
    font-size: 14px;
}

.iban-hint {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Mandate Section */
.mandate-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #dee2e6;
}

.mandate-section h4 {
    color: #2f61ab;
    font-size: 16px;
    margin-bottom: 15px;
}

.mandate-text {
    background: white;
    padding: 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.6;
}

.mandate-text p {
    margin-bottom: 10px;
}

.mandate-text p:last-child {
    margin-bottom: 0;
}

.mandate-description {
    color: #666;
    margin-top: 15px;
}

.mandate-checkbox {
    background: #fff8e1;
    padding: 15px;
    border: 1px solid #ffd54f;
    border-radius: 8px;
}

.mandate-checkbox label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.mandate-checkbox input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
}

/* Date Selector Styles */
.delivery-days-container {
    margin-top: 10px;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.day-box {
    background: white;
    border: 2px solid #e5e9f0;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.day-box:hover {
    border-color: #50bed0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(80, 190, 208, 0.15);
}

.day-box.selected {
    background: linear-gradient(135deg, #50bed0 0%, #2f61ab 100%);
    color: white;
    border-color: transparent;
}

.day-box-weekday {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 5px;
}

.day-box-date {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 3px;
}

.day-box-month {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.8;
}

.day-box.selected .day-box-weekday,
.day-box.selected .day-box-month {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .days-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }

    .day-box {
        min-height: 80px;
        padding: 10px;
    }

    .day-box-date {
        font-size: 20px;
    }
}

/* Additional Bottles Section */
#additional-bottles-section {
    background: #f9fbfd;
    padding: 20px;
    border-radius: 12px;
}

.additional-bottles-container {
    text-align: center;
}

.bottles-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.counter-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #50bed0;
    background: white;
    color: #50bed0;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.counter-btn:hover {
    background: #50bed0;
    color: white;
}

.counter-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#additional-bottles {
    width: 60px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #50bed0;
}

.additional-price {
    color: #666;
    font-size: 14px;
}

/* Submit Button */
.form-actions {
    margin-top: 30px;
    text-align: center;
}

.submit-btn {
    background: linear-gradient(135deg, #50bed0 0%, #2f61ab 100%);
    color: white;
    padding: 15px 50px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(47, 97, 171, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(47, 97, 171, 0.4);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.secure-payment {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

/* Order Summary Sidebar */
.order-summary-sidebar {
    position: sticky;
    top: 20px;
}

.summary-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 20px rgba(47, 97, 171, 0.08);
}

.summary-card h3 {
    color: #2f61ab;
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 600;
}

.summary-items {
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.summary-item:last-child {
    border-bottom: none;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.item-description {
    font-size: 13px;
    color: #666;
}

.item-price {
    font-weight: 600;
    color: #2f61ab;
}

.summary-divider {
    height: 1px;
    background: #dee2e6;
    margin: 20px 0;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.total-price {
    color: #2f61ab;
    font-size: 24px;
}

.summary-note {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.summary-note p {
    margin: 5px 0;
}

/* Billing period switcher */
.billing-switcher {
    margin-bottom: 20px;
    text-align: center;
}

.billing-switch-btn {
    background: #50bed0;
    color: white;
    border: 2px solid #50bed0;
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 2px 8px rgba(80, 190, 208, 0.3);
}

.billing-switch-btn:hover {
    background: #2f61ab;
    border-color: #2f61ab;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(47, 97, 171, 0.4);
}

.summary-features {
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.feature-item {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    padding-left: 5px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #50bed0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    color: #e74c3c;
    margin-bottom: 15px;
}

.modal-btn {
    background: #2f61ab;
    color: white;
    padding: 10px 30px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 15px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .checkout-container {
        max-width: 800px;
    }
}

@media (max-width: 768px) {
    .checkout-content {
        padding: 20px;
    }

    .plan-details {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .phone-input-container {
        flex-direction: column;
    }

    .phone-input-container select {
        width: 100%;
    }

    .submit-btn {
        width: 100%;
    }

    /* Contact banner mobile */
    .banner-content {
        flex-direction: column;
        align-items: stretch;
    }

    .banner-text {
        justify-content: center;
        text-align: center;
        font-size: 15px;
    }

    .banner-buttons {
        flex-direction: column;
        width: 100%;
    }

    .banner-btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }
}

/* ===================================
   STRIPE PAYMENT ELEMENT STYLES
   =================================== */

.payment-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #50BED0;
}

.payment-info p {
    margin: 0;
    color: #555;
    font-size: 14px;
}

/* Express Checkout Container (Apple Pay / Google Pay) */
.express-checkout-container {
    margin: 20px 0;
}

.payment-divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.payment-divider::before,
.payment-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #ddd;
}

.payment-divider::before {
    left: 0;
}

.payment-divider::after {
    right: 0;
}

.payment-divider span {
    background: white;
    padding: 0 15px;
    color: #666;
    font-size: 14px;
    position: relative;
    z-index: 1;
}

/* Stripe Payment Element Container */
.stripe-payment-element {
    margin: 20px 0;
    min-height: 200px;
}

/* Ensure Stripe iframe matches form styling */
#payment-element iframe {
    border: none !important;
}

/* Match the form section spacing */
.payment-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Payment Error Messages */
.payment-error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    background: #fff5f5;
    border: 1px solid #ffebee;
    display: none;
}

.payment-error-message:not(:empty) {
    display: block;
}

/* Payment Security Section */
.payment-security {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.security-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.security-badges .badge {
    display: inline-block;
    padding: 6px 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 13px;
    color: #495057;
    font-weight: 500;
}

.security-text {
    margin: 0;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.5;
}

.security-info-list {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.6;
}

.security-info-list li {
    margin-bottom: 8px;
}

.security-info-list li:last-child {
    margin-bottom: 0;
}

/* Stripe Element Styling Overrides */
.StripeElement {
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: white;
    transition: border-color 0.15s ease;
}

.StripeElement--focus {
    border-color: #50BED0;
    box-shadow: 0 0 0 3px rgba(80, 190, 208, 0.1);
}

.StripeElement--invalid {
    border-color: #dc3545;
}

/* Payment Request Button (Apple Pay / Google Pay) */
#payment-request-button button {
    width: 100%;
    height: 48px !important;
    border-radius: 8px !important;
    font-size: 16px !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .security-badges {
        flex-direction: column;
    }

    .security-badges .badge {
        text-align: center;
    }

    .payment-divider::before,
    .payment-divider::after {
        width: 35%;
    }
}

/* Hide Link authentication in Payment Element */
/* Targets the "Pago seguro y rápido con Link" section */
#payment-element [class*="LinkAuthenticationElement"],
#payment-element [class*="p-LinkAuthentication"],
#payment-element iframe[name*="link-authentication"],
#payment-element div[data-testid*="link"] {
    display: none !important;
}

/* Force vertical layout for card fields - card number on top, expiry and CVC below */
#payment-element {
    min-width: 100%;
    width: 100%;
}

.stripe-payment-element {
    width: 100%;
    min-height: 250px;
}

/* Ensure Stripe uses column layout on wide screens */
@media (min-width: 768px) {
    #payment-element {
        min-width: 500px; /* Force wide enough for Stripe to use vertical layout */
    }
}
/* Pago de hoy, desglosado (fianza incluida) */
.pago-hoy {
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid #d9eef2;
    border-radius: 10px;
    background: #f5fbfc;
    font-size: 14px;
}
.pago-hoy-titulo { font-weight: 600; margin-bottom: 8px; }
.pago-hoy-linea { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.pago-hoy-linea span:last-child { white-space: nowrap; }
.pago-hoy-linea small { display: block; color: #6b7280; font-size: 12px; }
.pago-hoy-total { border-top: 1px solid #d9eef2; margin-top: 6px; padding-top: 8px; font-weight: 700; }
.pago-hoy-nota { margin: 8px 0 0; color: #6b7280; font-size: 12px; }
.pago-hoy[hidden], .pago-hoy-linea[hidden] { display: none; }
