/**
 * Production-Compatible SMS Subscription Modal Styles
 * Enhanced styles that work with fatoorix.com existing design
 * Includes SMS + Nafath authentication integration
 */

/* Enhanced Modal Base Styles */
.sms-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.sms-modal.active {
    display: flex;
}

.sms-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    cursor: pointer;
}

.sms-modal-container {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 10000;
    animation: modalSlideIn 0.4s ease-out;
}

/* Enhanced Content Container */
.sms-enhanced-content {
    padding: 0;
}

/* Modal Header */
.sms-modal-header {
    position: relative;
    padding: 24px 24px 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

.sms-modal-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
}

.sms-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sms-modal-close:hover {
    background: #f1f5f9;
    color: #334155;
}

/* Progress Indicator */
.sms-progress-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 32px;
    margin-bottom: 32px;
    padding: 0 24px;
}

.sms-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: all 0.3s ease;
    position: relative;
}

.sms-progress-step.active {
    opacity: 1;
}

.sms-progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 100%;
    width: 32px;
    height: 2px;
    background: #e2e8f0;
    transition: background-color 0.3s ease;
}

.sms-progress-step.active:not(:last-child)::after {
    background: #4f46e5;
}

.sms-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.sms-progress-step.active .sms-step-circle {
    background: #4f46e5;
    color: white;
}

.sms-progress-step span {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    transition: color 0.3s ease;
}

.sms-progress-step.active span {
    color: #1e293b;
}

/* Modal Content */
.sms-modal-content {
    padding: 0 24px 24px;
}

.sms-step-content {
    display: none;
}

.sms-step-content.active {
    display: block;
}

/* Step Headers */
.sms-step-header {
    text-align: center;
    margin-bottom: 32px;
}

.sms-step-header h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.sms-plan-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #475569;
    margin-top: 8px;
}

.sms-plan-summary span:first-child {
    font-weight: 600;
    color: #4f46e5;
}

/* Form Styles */
.sms-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sms-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sms-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.sms-form-group input,
.sms-form-group select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: white;
}

.sms-form-group input:focus,
.sms-form-group select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.sms-phone-input {
    display: flex;
    gap: 8px;
}

.sms-country-code {
    flex: 0 0 120px;
}

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

.sms-password-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* Enhanced Authentication Options */
.sms-auth-options {
    margin: 24px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.sms-auth-options h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.sms-auth-choice {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sms-radio-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.sms-radio-label:hover {
    border-color: #4f46e5;
    background: #fefeff;
}

.sms-radio-label input[type="radio"] {
    margin: 2px 0 0 0;
    accent-color: #4f46e5;
}

.sms-radio-label span:first-of-type {
    font-weight: 500;
    color: #1e293b;
    font-size: 14px;
}

.sms-radio-label small {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-top: 2px;
}

/* OTP Input Group */
.otp-input-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 16px 0;
}

.otp-digit {
    width: 48px !important;
    height: 56px !important;
    text-align: center;
    font-size: 20px !important;
    font-weight: 600;
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    transition: all 0.2s ease;
}

.otp-digit:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.otp-digit.filled {
    border-color: #10b981 !important;
    background: #f0fdf4;
    color: #059669;
}

.otp-countdown {
    text-align: center;
    font-size: 14px;
    color: #64748b;
    margin-top: 12px;
}

/* Nafath Verification Styles */
.nafath-container {
    text-align: center;
    padding: 32px 24px;
}

.nafath-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.nafath-container h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.nafath-container p {
    color: #64748b;
    margin-bottom: 24px;
}

.nafath-status {
    margin: 24px 0;
}

.nafath-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.nafath-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.nafath-success .success-icon {
    font-size: 32px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Button Styles */
.sms-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border: 2px solid transparent;
}

.sms-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sms-btn-primary {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

.sms-btn-primary:hover:not(:disabled) {
    background: #4338ca;
    border-color: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sms-btn-secondary {
    background: white;
    color: #4f46e5;
    border-color: #4f46e5;
}

.sms-btn-secondary:hover:not(:disabled) {
    background: #4f46e5;
    color: white;
}

.sms-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

/* Verification Actions */
.sms-verification-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.nafath-actions {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

/* Success Content */
.sms-success-content {
    text-align: center;
    padding: 32px 24px;
}

.sms-success-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.sms-success-content h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 700;
    color: #059669;
}

.sms-success-content p {
    color: #64748b;
    margin-bottom: 32px;
    font-size: 16px;
}

.sms-instance-info {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.sms-instance-info h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #059669;
}

.sms-instance-details p {
    margin: 8px 0;
    font-size: 14px;
    color: #064e3b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sms-verification-info {
    text-align: center;
    color: #64748b;
    margin-bottom: 24px;
    line-height: 1.5;
}

#smsPhoneDisplay {
    font-weight: 600;
    color: #4f46e5;
}

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .sms-modal-container {
        width: 95%;
        max-height: 95vh;
        margin: 16px;
    }

    .sms-progress-indicator {
        gap: 16px;
    }

    .sms-progress-step:not(:last-child)::after {
        width: 16px;
    }

    .sms-verification-actions {
        flex-direction: column;
    }

    .otp-input-group {
        gap: 8px;
    }

    .otp-digit {
        width: 40px !important;
        height: 48px !important;
        font-size: 18px !important;
    }

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

    .sms-country-code {
        flex: none;
    }

    .sms-auth-choice {
        gap: 8px;
    }

    .sms-radio-label {
        padding: 12px;
    }
}

/* Production-specific overrides */
.fatoorix-website .sms-modal {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Integration with existing modal system */
#sms-subscription-modal .sms-enhanced-content {
    display: block;
}

/* Ensure compatibility with existing production styles */
.sms-modal * {
    box-sizing: border-box;
}

/* High specificity overrides for production conflicts */
body.modal-open .sms-modal {
    display: flex !important;
}

/* Accessibility improvements */
.sms-modal:focus {
    outline: none;
}

.sms-modal [aria-hidden="true"] {
    display: none !important;
}

/* Print styles */
@media print {
    .sms-modal {
        display: none !important;
    }
}