﻿.checkout-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.checkout-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.checkout-container {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 24px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10001;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.checkout-header {
    padding: 32px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px 24px 0 0;
    position: relative;
    flex-shrink: 0;
}

.checkout-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkout-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.checkout-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkout-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.checkout-content {
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

/* Ocultar contenido principal cuando se muestra loading, success o error */
.checkout-container:has(.checkout-loading.active) .checkout-main-content,
.checkout-container:has(.checkout-success.active) .checkout-main-content,
.checkout-container:has(.checkout-error.active) .checkout-main-content {
    display: none !important;
}

/* Mejoras para el scroll en el contenido */
.checkout-content::-webkit-scrollbar {
    width: 8px;
}

.checkout-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.checkout-content::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

.checkout-content::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

.appointment-summary {
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.summary-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 18px 0;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.summary-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-value {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
}

.summary-total {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid rgba(102, 126, 234, 0.2);
}

.summary-total .summary-label {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.summary-total .summary-value {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.payment-section {
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}

.payment-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 16px 0;
}

.payment-info {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.payment-info p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.6;
}

#paypal-button-container {
    margin-top: 20px;
    min-height: 150px;
    position: relative;
    z-index: 1;
}

/* Asegurar que el iframe de PayPal sea scrollable */
#paypal-button-container iframe {
    max-width: 100% !important;
}

.checkout-loading {
    display: none;
    text-align: center;
    padding: 40px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.checkout-loading.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.checkout-success {
    display: none;
    text-align: center;
    padding: 40px 30px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.checkout-success.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Scrollbar para el modal de éxito */
.checkout-success::-webkit-scrollbar {
    width: 8px;
}

.checkout-success::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.checkout-success::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

.checkout-success::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    animation: successPop 0.5s ease;
    flex-shrink: 0;
}

.success-icon .iconify,
.success-icon svg,
.success-icon i {
    font-size: 48px !important;
    color: #ffffff !important;
    fill: #ffffff !important;
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.success-title {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 0 0 8px 0;
}

.success-message {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.success-details {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
    width: 100%;
    flex-shrink: 0;
}

.success-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.success-detail-label {
    color: rgba(255, 255, 255, 0.85);
}

/* Discord Instructions */
.discord-instructions {
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.15) 0%, rgba(114, 137, 218, 0.15) 100%);
    border: 2px solid rgba(88, 101, 242, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin: 24px 0;
    text-align: left;
    width: 100%;
}

.discord-instructions-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.discord-instructions-header .iconify {
    font-size: 24px;
    color: #5865F2;
}

.discord-instructions-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.discord-instructions-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.discord-instructions-content strong {
    color: #5865F2;
    font-weight: 700;
}

.discord-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.discord-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #5865F2 0%, #7289DA 100%);
    border-radius: 50%;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.btn-discord {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #5865F2 0%, #7289DA 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-discord:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(88, 101, 242, 0.4);
}

.btn-discord .iconify {
    font-size: 20px;
}

.btn-success-close {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 16px;
    flex-shrink: 0;
}

.btn-success-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.checkout-error {
    display: none;
    text-align: center;
    padding: 40px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.checkout-error.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
}

.error-icon .iconify {
    font-size: 48px;
    color: #ffffff;
}

.error-title {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 0 0 8px 0;
}

.error-message {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    margin: 0 0 24px 0;
}

.btn-retry {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 12px;
}

.btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 768px) {
    .checkout-modal.active {
        padding: 0;
        align-items: flex-end;
    }

    .checkout-container {
        max-width: 100%;
        width: 100%;
        border-radius: 24px 24px 0 0;
        max-height: 95vh;
        margin: 0;
        animation: modalSlideUpMobile 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        flex-direction: column;
    }

    @keyframes modalSlideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .checkout-header {
        padding: 24px 20px;
        border-radius: 24px 24px 0 0;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .checkout-header::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .checkout-close-btn {
        top: 28px;
        right: 20px;
        min-width: 44px;
        min-height: 44px;
    }

    .checkout-title {
        font-size: 20px;
        margin-top: 8px;
    }

    .checkout-content {
        padding: 20px;
        padding-bottom: 100px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .appointment-summary {
        padding: 16px;
        margin-bottom: 16px;
    }

    .payment-section {
        padding: 16px;
        margin-bottom: 0;
    }
    
    /* Asegurar que PayPal tenga suficiente espacio */
    #paypal-button-container {
        margin-bottom: 20px;
        min-height: 200px;
    }

    .summary-total {
        position: sticky;
        bottom: 0;
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        padding: 16px 20px;
        margin: 0 -20px -20px -20px;
        border-top: 1px solid rgba(102, 126, 234, 0.3);
        border-radius: 0 0 24px 24px;
        z-index: 101;
    }

    .summary-total .summary-value {
        font-size: 24px;
    }

    .form-group input:invalid:focus {
        border-color: #ff3b30;
        animation: shake 0.3s ease;
    }

    @keyframes shake {
        0%, 100% { transform: translateX(0); }
        25% { transform: translateX(-10px); }
        75% { transform: translateX(10px); }
    }

    .form-group input:valid:focus {
        border-color: #34c759;
    }

    .btn-submit-checkout {
        min-height: 56px;
        font-size: 18px;
        font-weight: 700;
        position: relative;
        overflow: hidden;
    }

    .btn-submit-checkout:active:not(:disabled) {
        transform: scale(0.98);
    }

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

    .btn-submit-checkout.loading::after {
        content: '';
        position: absolute;
        width: 20px;
        height: 20px;
        top: 50%;
        left: 50%;
        margin: -10px 0 0 -10px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-top-color: #fff;
        border-radius: 50%;
        animation: spinner 0.8s linear infinite;
    }

    @keyframes spinner {
        to { transform: rotate(360deg); }
    }

    /* Discord instructions responsive */
    .discord-instructions {
        padding: 16px;
        margin: 16px 0;
    }

    .discord-instructions-header h4 {
        font-size: 16px;
    }

    .discord-instructions-content p {
        font-size: 13px;
    }

    .discord-step {
        padding: 8px 10px;
        font-size: 13px;
    }

    .step-number {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .btn-discord {
        padding: 12px 20px;
        font-size: 14px;
    }

    .checkout-success {
        padding: 30px 20px;
    }

    .success-icon {
        width: 70px;
        height: 70px;
    }

    .success-icon .iconify,
    .success-icon svg,
    .success-icon i {
        font-size: 40px !important;
        color: #ffffff !important;
        fill: #ffffff !important;
    }

    .success-title {
        font-size: 20px;
    }

    .success-message {
        font-size: 14px;
    }
}

.coupon-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    border: 2px dashed rgba(102, 126, 234, 0.3);
}

.coupon-input-group {
    display: flex;
    gap: 10px;
}

.coupon-input {
    flex: 1;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.coupon-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.1);
}

.coupon-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
    text-transform: none;
}

.btn-apply-coupon {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-apply-coupon:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-apply-coupon:active {
    transform: translateY(0);
}

.coupon-message {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.coupon-message.success {
    background: rgba(52, 199, 89, 0.2);
    color: #34c759;
    border: 1px solid #34c759;
}

.coupon-message.error {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
    border: 1px solid #ff3b30;
}

#discount-row {
    display: none;
}

.discount-label {
    color: #34c759 !important;
}

.discount-value {
    color: #34c759 !important;
    font-weight: 700;
}

/* Scrollbar removido de checkout-container ya que ahora el scroll está en checkout-content */