/**
 * AutoSlate Checkout Modal - Mock Mode
 * 
 * Modal overlay styling to mimic Paddle Overlay checkout
 * Inherits WordPress theme fonts and colors where possible
 */

.as-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.as-modal * {
    box-sizing: border-box;
}

.as-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.as-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.as-modal-content {
    position: relative;
    background: #fff !important;
    color: #1f2937 !important;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    z-index: 1;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.as-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 20px;
    line-height: 32px;
    text-align: center;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.as-modal-close:hover {
    background: #e5e7eb;
    color: #1f2937;
    transform: rotate(90deg);
}

.as-modal-body {
    padding: 60px 48px 48px;
}

/* Loading spinner */
.as-modal-loading {
    text-align: center;
    padding: 60px 20px;
}

.as-modal-loading .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.as-modal-loading p {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

/* Success message */
.success-message {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: #10b981;
    color: white;
    font-size: 48px;
    line-height: 80px;
    border-radius: 50%;
    animation: successPop 0.5s ease;
}

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

.success-message h2 {
    margin: 0 0 12px;
    font-size: 28px;
    color: #1f2937;
}

.success-message p {
    color: #6b7280;
    font-size: 16px;
    margin: 0 0 8px;
}

.close-modal-btn {
    background: var(--wp--preset--color--primary, #2271b1);
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.close-modal-btn:hover {
    background: var(--wp--preset--color--primary-hover, #135e96);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Override simulator styles for modal */
.as-modal .as-simulator {
    max-width: 100%;
    margin: 0;
    padding: 20px 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.as-modal .as-mock-notice {
    display: none; /* Hide warning in modal */
}

.as-modal .mock-badge {
    display: none; /* Hide test badge in modal */
}

.as-modal .as-simulator h1 {
    font-size: 24px;
    margin: 0 0 8px;
    font-weight: 600;
    color: #1f2937 !important;
}

.as-modal .as-simulator .subtitle {
    font-size: 14px;
    margin: 0 0 24px;
    color: #6b7280 !important;
    line-height: 1.5;
}

.as-modal .plan-info {
    margin-bottom: 28px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.as-modal .plan-info h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #3b82f6;
}

.as-modal .plan-info .price {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.as-modal .plan-info .credits {
    margin-top: 8px;
    font-size: 14px;
    color: #6b7280;
}

/* Form styling for modal */
.as-modal .form-group {
    margin-bottom: 20px;
}

.as-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

.as-modal .form-group input[type="email"],
.as-modal .form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.as-modal .form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.as-modal .form-group input::placeholder {
    color: #9ca3af;
}

/* Submit button - use WordPress button styles */
.as-modal .submit-btn,
.as-modal button[type="submit"] {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

/* Try to inherit WordPress theme button styles, fallback to custom */
.as-modal .submit-btn,
.as-modal button[type="submit"] {
    background: var(--wp--preset--color--primary, #2271b1);
    color: #ffffff;
}

.as-modal .submit-btn:hover,
.as-modal button[type="submit"]:hover {
    background: var(--wp--preset--color--primary-hover, #135e96);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.as-modal .submit-btn:active,
.as-modal button[type="submit"]:active {
    transform: translateY(0);
}

.as-modal .submit-btn:disabled,
.as-modal button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Error message in modal */
.as-modal .notice.error {
    background: #fee2e2;
    border: 2px solid #ef4444;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .as-modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .as-modal-body {
        padding: 50px 24px 32px;
    }
    
    .as-modal-close {
        top: 16px;
        right: 16px;
        width: 28px;
        height: 28px;
        font-size: 18px;
        line-height: 28px;
    }
    
    .as-modal .as-simulator h1 {
        font-size: 20px;
    }
    
    .as-modal .plan-info {
        padding: 16px;
    }
    
    .as-modal .plan-info .price {
        font-size: 24px;
    }
    
    .as-modal .form-group input[type="email"],
    .as-modal .form-group input[type="text"] {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .as-modal .submit-btn,
    .as-modal button[type="submit"] {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .success-icon {
        width: 60px;
        height: 60px;
        font-size: 36px;
        line-height: 60px;
    }
    
    .success-message h2 {
        font-size: 22px;
    }
    
    .close-modal-btn {
        padding: 12px 32px;
        font-size: 15px;
    }
}
