/*
 * KingOTP - Ultra Clean Mobile-First Design
 * Optimized for full-screen mobile experience
 */

/* Reset & Base */
.kingotp-auth-container,
.kingotp-auth-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.kingotp-auth-container {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1a202c;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0;
    background: #ffffff;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Card - Full Screen on Mobile */
.kingotp-auth-card {
    background: #ffffff;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* Desktop/Tablet adjustments */
@media (min-width: 768px) {
    .kingotp-auth-container {
        align-items: center;
        padding: 2rem;
        background: #f8fafc;
    }
    
    .kingotp-auth-card {
        max-width: 440px;
        min-height: auto;
        border-radius: 24px;
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
        border: 1px solid #e2e8f0;
        padding: 3rem 2.5rem;
    }
}

/* Header */
.kingotp-auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.kingotp-auth-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.kingotp-auth-icon svg {
    width: 36px;
    height: 36px;
}

.kingotp-auth-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.kingotp-auth-subtitle {
    font-size: 1.125rem;
    color: #64748b;
    margin: 0;
    font-weight: 400;
}

/* Progress Bar */
.kingotp-progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2.5rem;
    padding: 0;
}

.kingotp-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.kingotp-progress-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
}

.kingotp-progress-step.kingotp-progress-active .kingotp-progress-circle {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.kingotp-progress-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 600;
}

.kingotp-progress-step.kingotp-progress-active .kingotp-progress-label {
    color: #667eea;
    font-weight: 700;
}

.kingotp-progress-line {
    width: 80px;
    height: 3px;
    background: #e2e8f0;
    margin: 0 1.5rem;
    position: relative;
    overflow: hidden;
}

.kingotp-progress-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    transition: left 0.5s ease;
}

.kingotp-progress-active ~ .kingotp-progress-line::after {
    left: 0;
}

/* Form */
.kingotp-auth-form {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.kingotp-form-step {
    display: none;
    flex: 1;
    animation: fadeIn 0.4s ease-out;
}

.kingotp-form-step.kingotp-step-active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.kingotp-form-group {
    margin-bottom: 2rem;
}

.kingotp-form-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    letter-spacing: 0.01em;
}

/* Input Groups */
.kingotp-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.kingotp-input-icon {
    position: absolute;
    left: 1.25rem;
    color: #9ca3af;
    z-index: 2;
    pointer-events: none;
    transition: color 0.2s ease;
}

.kingotp-input-icon svg {
    width: 22px;
    height: 22px;
}

.kingotp-input-group:focus-within .kingotp-input-icon {
    color: #667eea;
}

/* Form Inputs */
.kingotp-form-input {
    width: 100%;
    padding: 1.25rem 1.25rem 1.25rem 3.5rem;
    font-size: 1.125rem;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    transition: all 0.2s ease;
    outline: none;
    font-weight: 500;
    -webkit-appearance: none;
    appearance: none;
}

.kingotp-form-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.kingotp-form-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Password Toggle */
.kingotp-password-toggle {
    position: absolute;
    right: 1.25rem;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 2;
}

.kingotp-password-toggle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.kingotp-password-toggle svg {
    width: 22px;
    height: 22px;
}

/* Password Strength */
.kingotp-password-strength {
    margin-top: 1rem;
}

.kingotp-strength-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.kingotp-strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.kingotp-strength-fill.weak {
    background: linear-gradient(90deg, #ef4444, #f87171);
    width: 25%;
}

.kingotp-strength-fill.fair {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    width: 50%;
}

.kingotp-strength-fill.good {
    background: linear-gradient(90deg, #10b981, #34d399);
    width: 75%;
}

.kingotp-strength-fill.strong {
    background: linear-gradient(90deg, #059669, #10b981);
    width: 100%;
}

.kingotp-strength-text {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kingotp-strength-text.weak { color: #ef4444; }
.kingotp-strength-text.fair { color: #f59e0b; }
.kingotp-strength-text.good { color: #10b981; }
.kingotp-strength-text.strong { color: #059669; }

/* OTP Input - FIXED for single field entry */
.kingotp-otp-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin: 2rem 0;
    position: relative;
}

.kingotp-otp-digit {
    width: 3.5rem;
    height: 3.5rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    transition: all 0.2s ease;
    outline: none;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    caret-color: transparent;
}

.kingotp-otp-digit:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: scale(1.05);
}

.kingotp-otp-digit.filled {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

/* Hidden master input for OTP */
.kingotp-otp-master {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    font-size: 1px;
}

/* Verification */
.kingotp-verification-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.kingotp-verification-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.kingotp-verification-icon svg {
    width: 44px;
    height: 44px;
}

.kingotp-verification-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.75rem;
}

.kingotp-verification-text {
    color: #64748b;
    line-height: 1.6;
    font-size: 1.125rem;
}

/* Timer */
.kingotp-timer-container {
    text-align: center;
    margin-bottom: 2rem;
}

.kingotp-timer-text {
    color: #64748b;
    font-size: 1rem;
    font-weight: 500;
}

#timer-countdown {
    color: #667eea;
    font-weight: 700;
}

.kingotp-resend-btn {
    background: none;
    border: none;
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.kingotp-resend-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Buttons */
.kingotp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none;
    position: relative;
    min-height: 4rem;
    letter-spacing: 0.01em;
    overflow: hidden;
}

.kingotp-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.kingotp-btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    width: 100%;
}

.kingotp-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.kingotp-btn-secondary {
    background: white;
    color: #64748b;
    border: 2px solid #e5e7eb;
    flex: 1;
}

.kingotp-btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.kingotp-btn-secondary svg {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
}

/* Button Content */
.kingotp-btn-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kingotp-btn-spinner {
    position: absolute;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.kingotp-btn:disabled .kingotp-btn-text {
    opacity: 0;
}

.kingotp-btn:disabled .kingotp-btn-spinner {
    opacity: 1;
}

.kingotp-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Form Actions */
.kingotp-form-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    margin-top: auto;
}

/* Messages */
.kingotp-message-area {
    padding: 1.25rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    font-size: 1rem;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

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

.kingotp-message-area.success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.kingotp-message-area.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.kingotp-message-area.info {
    background: rgba(102, 126, 234, 0.1);
    color: #4f46e5;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

/* Field Errors */
.kingotp-form-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.75rem;
    font-weight: 500;
    min-height: 1.25rem;
    animation: shake 0.3s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Footer */
.kingotp-auth-footer {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
}

.kingotp-auth-switch {
    color: #64748b;
    font-size: 1rem;
    margin: 0;
}

.kingotp-auth-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.kingotp-auth-link:hover {
    color: #4f46e5;
    text-decoration: underline;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .kingotp-auth-card {
        padding: 1.5rem 1rem;
    }
    
    .kingotp-auth-title {
        font-size: 1.875rem;
    }
    
    .kingotp-auth-subtitle {
        font-size: 1rem;
    }
    
    .kingotp-otp-container {
        gap: 0.5rem;
    }
    
    .kingotp-otp-digit {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }
    
    .kingotp-form-actions {
        flex-direction: column;
    }
    
    .kingotp-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 3.5rem;
    }
    
    .kingotp-progress-circle {
        width: 40px;
        height: 40px;
        font-size: 0.875rem;
    }
    
    .kingotp-progress-line {
        width: 60px;
        margin: 0 1rem;
    }
    
    .kingotp-form-input {
        font-size: 1rem;
        padding: 1rem 1rem 1rem 3rem;
    }
}

@media (max-width: 360px) {
    .kingotp-auth-card {
        padding: 1rem 0.75rem;
    }
    
    .kingotp-otp-container {
        gap: 0.375rem;
    }
    
    .kingotp-otp-digit {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1.125rem;
    }
}

/* Touch Improvements */
@media (hover: none) and (pointer: coarse) {
    .kingotp-btn:hover {
        transform: none;
    }
    
    .kingotp-btn:active {
        transform: scale(0.98);
    }
    
    .kingotp-otp-digit {
        font-size: 1.375rem;
    }
}

/* High Contrast & Accessibility */
@media (prefers-contrast: high) {
    .kingotp-auth-card {
        border: 3px solid #000;
    }
    
    .kingotp-form-input {
        border-width: 3px;
    }
    
    .kingotp-btn-primary {
        background: #000;
        border: 2px solid #000;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Management */
.kingotp-auth-container *:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.kingotp-auth-container *:focus:not(:focus-visible) {
    outline: none;
}

/* Remove all legacy compatibility */
.kingotp-container,
.kingotp-form-wrapper,
.kingotp-field-group,
.kingotp-input-wrapper,
.kingotp-input,
.kingotp-message {
    display: none !important;
}