/**
 * WooCommerce Thank You Modal - Styles
 */

/* Overlay */
.wc-thankyou-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wc-thankyou-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal */
.wc-thankyou-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.wc-thankyou-modal-overlay.active .wc-thankyou-modal {
    transform: scale(1);
}

.wc-thankyou-modal-content {
    padding: 40px 30px;
    text-align: center;
}

/* Estados */
.modal-state {
    display: none;
}

.modal-state.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Iconos */
.modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 25px;
}

.modal-icon svg {
    width: 100%;
    height: 100%;
}

/* Loading spinner */
.modal-icon-loading .spinner {
    animation: rotate 2s linear infinite;
}

.modal-icon-loading .spinner .path {
    stroke: #2271b1;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Success checkmark */
.modal-icon-success .checkmark-circle {
    stroke: #00a650;
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.modal-icon-success .checkmark-check {
    stroke: #00a650;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.4s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

/* Pending icon */
.modal-icon-pending circle {
    stroke: #f7a623;
    fill: none;
}

.modal-icon-pending path {
    stroke: #f7a623;
}

/* Error icon */
.modal-icon-error circle {
    stroke: #f23d4f;
    fill: none;
}

.modal-icon-error path {
    stroke: #f23d4f;
}

/* Cancelled icon */
.modal-icon-cancelled circle {
    stroke: #999;
    fill: none;
}

.modal-icon-cancelled path {
    stroke: #999;
}

/* Refunded icon */
.modal-icon-refunded circle {
    stroke: #2271b1;
    fill: none;
}

.modal-icon-refunded path {
    stroke: #2271b1;
}

.modal-icon-refunded text {
    fill: #2271b1;
}

/* Títulos y textos */
.wc-thankyou-modal h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 15px;
    line-height: 1.3;
}

.wc-thankyou-modal p {
    font-size: 16px;
    color: #666;
    margin: 0 0 15px;
    line-height: 1.6;
}

.modal-message {
    font-size: 16px;
    color: #444;
}

/* Progress bar */
.modal-progress {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.modal-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2271b1, #135e96);
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-animation 2s ease-in-out infinite;
}

@keyframes progress-animation {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

/* Info boxes */
.modal-info-box {
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: left;
}

.modal-info-box p {
    margin: 0 0 10px;
    font-size: 14px;
}

.modal-info-box p:last-child {
    margin-bottom: 0;
}

.modal-info-success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}

.modal-info-success p {
    color: #2e7d32;
}

.modal-info-warning {
    background: #fff8e1;
    border: 1px solid #ffe082;
}

.modal-info-warning p {
    color: #f57c00;
}

.modal-info-error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
}

.modal-info-error p {
    color: #c62828;
}

/* Countdown */
.redirect-countdown {
    font-weight: 600;
    color: #2e7d32 !important;
}

#redirect-countdown {
    display: inline-block;
    min-width: 20px;
    font-size: 18px;
}

/* Content sections */
.modal-content-section {
    margin: 20px 0;
}

/* Downloads list */
.modal-downloads-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

.modal-download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.modal-download-item .download-name {
    font-weight: 500;
    color: #1a1a1a;
    flex: 1;
    text-align: left;
}

.modal-download-item .download-btn {
    background: #2271b1;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.modal-download-item .download-btn:hover {
    background: #135e96;
    color: #fff;
}

/* Ticket info */
.modal-ticket-info {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.modal-ticket-info p {
    color: #1565c0;
    margin-bottom: 10px;
}

/* Buttons */
.modal-btn {
    display: inline-block;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    margin: 5px;
}

.modal-btn-primary {
    background: #00a650;
    color: #fff !important;
}

.modal-btn-primary:hover {
    background: #008c44;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 166, 80, 0.3);
}

.modal-btn-secondary {
    background: #f0f0f0;
    color: #333 !important;
}

.modal-btn-secondary:hover {
    background: #e0e0e0;
    color: #333 !important;
}

.modal-btn-danger {
    background: #f23d4f;
    color: #fff !important;
}

.modal-btn-danger:hover {
    background: #d32f2f;
    color: #fff !important;
}

/* Actions container */
.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
}

/* Close button */
.modal-close-btn {
    background: transparent;
    border: none;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    margin-top: 20px;
    padding: 10px;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #333;
}

/* Loading state for buttons */
.modal-btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.modal-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: button-loading 0.8s linear infinite;
}

@keyframes button-loading {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .wc-thankyou-modal-content {
        padding: 30px 20px;
    }
    
    .wc-thankyou-modal h2 {
        font-size: 20px;
    }
    
    .modal-icon {
        width: 60px;
        height: 60px;
    }
    
    .modal-btn {
        width: 100%;
        padding: 12px 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-download-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .modal-download-item .download-name {
        text-align: center;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .wc-thankyou-modal {
        background: #1a1a1a;
    }
    
    .wc-thankyou-modal h2 {
        color: #fff;
    }
    
    .wc-thankyou-modal p {
        color: #ccc;
    }
    
    .modal-download-item {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .modal-download-item .download-name {
        color: #fff;
    }
}

/* Animation for approved state */
.modal-state#modal-state-approved.active .modal-icon-success {
    animation: bounce 0.5s ease 0.8s;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Pulse animation for pending */
.modal-state#modal-state-pending.active .modal-icon-pending {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Shake animation for error */
.modal-state#modal-state-failed.active .modal-icon-error {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

/* Ticket / Pago en efectivo styles */
.modal-ticket-info {
    margin: 20px 0;
}

.modal-info-ticket {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid #2196f3;
    text-align: center;
}

.modal-info-ticket p {
    color: #1565c0;
}

.modal-info-ticket strong {
    color: #0d47a1;
}

.modal-btn-ticket {
    background: linear-gradient(135deg, #2196f3, #1976d2) !important;
    margin-top: 15px;
    font-size: 16px !important;
    padding: 14px 28px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: pulse-ticket 2s ease-in-out infinite;
}

.modal-btn-ticket:hover {
    background: linear-gradient(135deg, #1976d2, #1565c0) !important;
    transform: scale(1.05);
}

@keyframes pulse-ticket {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(33, 150, 243, 0.7);
    }
}

.ticket-barcode {
    font-family: 'Courier New', monospace;
    font-size: 18px !important;
    background: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 15px 0 !important;
    border: 2px dashed #2196f3;
    word-break: break-all;
}

.ticket-verification {
    font-size: 14px !important;
    margin-top: 10px !important;
}

.modal-ticket-note {
    font-size: 13px;
    color: #666;
    margin-top: 15px;
    font-style: italic;
}

#modal-ticket-details {
    margin: 10px 0;
}
