/**
 * FitQ Checkout Modal Styles
 *
 * @package Geneto_Theme
 * @since 1.0.4
 */

/* Prevent body scroll when modal is open */
body.fitq-modal-open {
    overflow: hidden;
}

/* Modal overlay and container */
.fitq-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fitq-modal--visible {
    opacity: 1;
    visibility: visible;
}

.fitq-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Desktop modal container */
.fitq-modal__container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 900px;
    height: 85vh;
    max-height: 800px;
    background: #FAFAFA;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}

.fitq-modal--visible .fitq-modal__container {
    transform: translate(-50%, -50%) scale(1);
}

/* Mobile fullscreen modal */
.fitq-modal--mobile .fitq-modal__container {
    top: 0;
    left: 0;
    transform: translateY(100%);
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
}

.fitq-modal--mobile.fitq-modal--visible .fitq-modal__container {
    transform: translateY(0);
}

/* Close button */
.fitq-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: background 0.2s ease, transform 0.2s ease;
}

.fitq-modal__close:hover {
    background: #fff;
    transform: scale(1.05);
}

.fitq-modal__close:focus {
    outline: 2px solid #F5841F;
    outline-offset: 2px;
}

.fitq-modal__close svg {
    width: 20px;
    height: 20px;
}

/* Mobile close button positioning */
.fitq-modal--mobile .fitq-modal__close {
    top: 12px;
    right: 12px;
}

/* Loading spinner */
.fitq-modal__loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #666;
    font-size: 14px;
}

.fitq-modal__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #E0E0E0;
    border-top-color: #F5841F;
    border-radius: 50%;
    animation: fitq-spin 0.8s linear infinite;
}

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

/* Iframe */
.fitq-modal__iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #FAFAFA;
}

/* Toast notifications */
.fitq-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    font-size: 15px;
    font-weight: 500;
    z-index: 100000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.fitq-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.fitq-toast--success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #fff;
}

.fitq-toast--success svg {
    color: #fff;
}

.fitq-toast--error {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #fff;
}

.fitq-toast--error svg {
    color: #fff;
}

.fitq-toast--info {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: #fff;
}

.fitq-toast--info svg {
    color: #fff;
}

.fitq-toast svg {
    flex-shrink: 0;
}

/* Button loading state */
.fitq-checkout-btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .fitq-toast {
        bottom: 16px;
        left: 16px;
        right: 16px;
        transform: translateX(0) translateY(100px);
        width: auto;
    }

    .fitq-toast--visible {
        transform: translateX(0) translateY(0);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .fitq-modal__close {
        border: 2px solid #333;
    }

    .fitq-toast {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .fitq-modal,
    .fitq-modal__container,
    .fitq-toast,
    .fitq-modal__close {
        transition: none;
    }

    .fitq-modal__spinner,
    .fitq-checkout-btn.loading::after {
        animation: none;
    }
}
