/**
 * Wave Auth - WhatsApp Authentication Styles
 * Enhanced OTP verification UI
 * 
 * @package WaveAuth
 * @version 2.0.0
 */

/* ============================================
   Base Container Styles
   ============================================ */

.wave-login-wrap {
    max-width: 420px;
    margin: 30px auto;
    padding: 40px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
}

.wave-login-wrap h3 {
    margin: 0 0 24px 0;
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
}

/* ============================================
   Phone Input Section
   ============================================ */

.wave-phone-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.wave-country-select {
    flex: 0 0 auto;
    width: 100px;
    padding: 12px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
}

.wave-country-select:focus {
    outline: none;
    border-color: #25D366;
}

.wave-phone-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.wave-phone-input:focus {
    outline: none;
    border-color: #25D366;
}

.wave-phone-input::placeholder {
    color: #999;
}

/* ============================================
   Primary Button Styles
   ============================================ */

.wave-login-btn,
.wave-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.wave-login-btn {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
}

.wave-login-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #20BA5A 0%, #0F7A6E 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.wave-login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.wave-login-btn svg,
.wave-whatsapp-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* ============================================
   OTP Display Section
   ============================================ */

#wave-code-display {
    animation: fadeSlideIn 0.3s ease-out;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wave-code-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 24px;
    border-radius: 12px;
    margin: 20px 0;
    border: 2px dashed #dee2e6;
}

#wave-verification-code {
    display: block;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 6px;
    color: #25D366;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.05);
}

.wave-code-instructions {
    margin-top: 16px;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* ============================================
   OTP Input Styles
   ============================================ */

.wave-otp-input-container {
    margin: 24px 0;
}

#wave-code-input {
    width: 100%;
    padding: 16px;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    text-transform: uppercase;
    transition: all 0.2s;
    box-sizing: border-box;
}

#wave-code-input:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

#wave-code-input.wave-input-error {
    border-color: #dc3232;
    animation: shake 0.4s ease-in-out;
}

#wave-code-input.wave-input-success {
    border-color: #46b450;
    background: #f0fff4;
}

/* Shake animation for errors */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

.wave-shake {
    animation: shake 0.4s ease-in-out;
}

/* ============================================
   Verify Button
   ============================================ */

#wave-verify-code {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
}

#wave-verify-code:hover:not(:disabled) {
    background: #20BA5A;
}

#wave-verify-code:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   Timer and Status
   ============================================ */

.wave-timer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.wave-expiry-label {
    font-size: 13px;
    color: #666;
}

#wave-expiry-timer {
    font-size: 14px;
    font-weight: 600;
    color: #25D366;
    font-family: 'Monaco', 'Menlo', monospace;
}

#wave-expiry-timer.wave-timer-warning {
    color: #dc3232;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ============================================
   Status Messages
   ============================================ */

#wave-status,
.wave-status-text {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.wave-status-error {
    background: #fff5f5;
    color: #dc3232;
    border: 1px solid #fed7d7;
}

.wave-status-success {
    background: #f0fff4;
    color: #38a169;
    border: 1px solid #c6f6d5;
}

.wave-status-info {
    background: #ebf8ff;
    color: #3182ce;
    border: 1px solid #bee3f8;
}

/* ============================================
   Resend and Secondary Actions
   ============================================ */

.wave-secondary-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

#wave-resend-code,
#wave-back-to-phone {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

#wave-resend-code:hover:not(:disabled),
#wave-back-to-phone:hover {
    border-color: #25D366;
    color: #25D366;
}

#wave-resend-code:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   WhatsApp Link Button
   ============================================ */

#wave-qr-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    margin-top: 16px;
    background: #fff;
    border: 2px solid #25D366;
    border-radius: 8px;
    color: #25D366;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

#wave-qr-link:hover {
    background: #25D366;
    color: white;
}

#wave-qr-link svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   Separator
   ============================================ */

.wave-separator {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #999;
    font-size: 13px;
    text-transform: uppercase;
}

.wave-separator::before,
.wave-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.wave-separator span {
    padding: 0 16px;
}

/* ============================================
   Loading States
   ============================================ */

.wave-loading {
    position: relative;
    pointer-events: none;
}

.wave-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Attempts Indicator
   ============================================ */

.wave-attempts {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.wave-attempt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: background 0.2s;
}

.wave-attempt-dot.used {
    background: #dc3232;
}

.wave-attempt-dot.success {
    background: #46b450;
}

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

@media (max-width: 480px) {
    .wave-login-wrap {
        max-width: 100%;
        margin: 15px;
        padding: 24px 20px;
        border-radius: 10px;
    }

    .wave-login-wrap h3 {
        font-size: 20px;
    }

    #wave-verification-code {
        font-size: 26px;
        letter-spacing: 4px;
    }

    #wave-code-input {
        font-size: 20px;
        letter-spacing: 6px;
        padding: 14px;
    }

    .wave-phone-container {
        flex-direction: column;
    }

    .wave-country-select {
        width: 100%;
    }

    .wave-secondary-actions {
        flex-direction: column;
    }

    #wave-resend-code,
    #wave-back-to-phone {
        width: 100%;
    }
}

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

@media (prefers-color-scheme: dark) {
    .wave-login-wrap {
        background: #1a1a2e;
        border-color: #333;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .wave-login-wrap h3 {
        color: #f0f0f0;
    }

    .wave-code-box {
        background: linear-gradient(135deg, #252538 0%, #1a1a2e 100%);
        border-color: #444;
    }

    #wave-code-input,
    .wave-phone-input,
    .wave-country-select {
        background: #252538;
        border-color: #444;
        color: #f0f0f0;
    }

    #wave-code-input:focus,
    .wave-phone-input:focus,
    .wave-country-select:focus {
        border-color: #25D366;
    }

    .wave-code-instructions,
    .wave-expiry-label {
        color: #aaa;
    }

    #wave-resend-code,
    #wave-back-to-phone {
        border-color: #444;
        color: #aaa;
    }

    .wave-separator::before,
    .wave-separator::after {
        background: #444;
    }
}

/* ============================================
   Accessibility
   ============================================ */

.wave-login-wrap:focus-within {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

#wave-code-input:focus,
#wave-verify-code:focus,
.wave-login-btn:focus {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

/* Screen reader only */
.wave-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}