/**
 * OTP Modal Styles
 * Design moderne et accessible pour la vérification 2FA
 */

/* ========================================
   Modal Container
======================================== */

.otp-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.otp-modal.show {
    opacity: 1;
    visibility: visible;
}

.otp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.otp-modal-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s ease;
}

.otp-modal.show .otp-modal-container {
    transform: scale(1) translateY(0);
}

.otp-modal-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
}

.otp-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.otp-modal-close:hover {
    background: #f1f5f9;
    color: #475569;
}

/* ========================================
   Header
======================================== */

.otp-header {
    text-align: center;
    margin-bottom: 28px;
}

.otp-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 16px;
    color: white;
}

.otp-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
}

.otp-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* ========================================
   Channels Selection
======================================== */

.otp-channels {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.otp-channel {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.otp-channel:hover:not(.disabled) {
    border-color: #3b82f6;
    background: #eff6ff;
}

.otp-channel.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.otp-channel.loading {
    pointer-events: none;
}

.otp-channel.loading .otp-channel-icon {
    animation: pulse 1s infinite;
}

.otp-channel-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.otp-channel-icon.email {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.otp-channel-icon.sms {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.otp-channel-icon.whatsapp {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.otp-channel-info {
    flex: 1;
    min-width: 0;
}

.otp-channel-name {
    display: block;
    font-weight: 600;
    color: #1e293b;
    font-size: 15px;
}

.otp-channel-dest {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.otp-channel-badge {
    font-size: 11px;
    padding: 4px 8px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    font-weight: 500;
}

/* ========================================
   Code Input
======================================== */

.otp-sent-info {
    text-align: center;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: #f0fdf4;
    border-radius: 10px;
    color: #166534;
    font-size: 14px;
}

.otp-input-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.otp-input-container.shake {
    animation: shake 0.5s ease;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.2s ease;
    caret-color: #3b82f6;
}

.otp-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.otp-input::-webkit-outer-spin-button,
.otp-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ========================================
   Error Message
======================================== */

.otp-error {
    text-align: center;
    padding: 10px 16px;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

/* ========================================
   Buttons
======================================== */

.otp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.otp-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.otp-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

.otp-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.otp-btn-secondary:hover {
    background: #e2e8f0;
}

.otp-btn-link {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.otp-btn-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.otp-btn-link:disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

/* ========================================
   Resend Section
======================================== */

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

.otp-countdown {
    color: #3b82f6;
    font-weight: 500;
}

.otp-change-method {
    display: block;
    margin: 16px auto 0;
    font-size: 13px;
}

/* ========================================
   Loading & Empty States
======================================== */

.otp-channels-loading,
.otp-no-channels,
.otp-error-state {
    text-align: center;
    padding: 32px 16px;
    color: #64748b;
}

.otp-channels-loading p,
.otp-no-channels p,
.otp-error-state p {
    margin: 12px 0 0;
}

.otp-hint {
    font-size: 13px;
    color: #94a3b8;
}

.otp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

.otp-spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   Animations
======================================== */

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   Dark Mode
======================================== */

[data-theme="dark"] .otp-modal-content {
    background: #1e293b;
}

[data-theme="dark"] .otp-title {
    color: #f1f5f9;
}

[data-theme="dark"] .otp-subtitle {
    color: #94a3b8;
}

[data-theme="dark"] .otp-channel {
    background: #334155;
    border-color: #475569;
}

[data-theme="dark"] .otp-channel:hover:not(.disabled) {
    background: #3b4f6b;
    border-color: #3b82f6;
}

[data-theme="dark"] .otp-channel-name {
    color: #f1f5f9;
}

[data-theme="dark"] .otp-input {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

[data-theme="dark"] .otp-input:focus {
    background: #1e293b;
    border-color: #3b82f6;
}

[data-theme="dark"] .otp-sent-info {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

[data-theme="dark"] .otp-error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

[data-theme="dark"] .otp-modal-close:hover {
    background: #334155;
    color: #f1f5f9;
}

/* ========================================
   Responsive
======================================== */

@media (max-width: 480px) {
    .otp-modal-content {
        padding: 24px 20px;
    }
    
    .otp-input {
        width: 42px;
        height: 50px;
        font-size: 20px;
    }
    
    .otp-input-container {
        gap: 6px;
    }
    
    .otp-channel {
        padding: 14px;
    }
    
    .otp-channel-icon {
        width: 42px;
        height: 42px;
    }
}
