/* Apple-Inspired Authentication Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-weight: 400;
    line-height: 1.5;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(20px);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: #1D1D1F;
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-header p {
    color: #86868B;
    font-size: 17px;
    font-weight: 400;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 200px;
    justify-content: flex-start;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

/* Ensure consistent spacing for forms with fewer fields */
.auth-form.single-field {
    padding-bottom: 40px;
}

.auth-form.double-field {
    padding-bottom: 20px;
}

/* Hidden form state for smooth transitions */
.auth-form.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: -1;
}

.auth-form.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

/* Form container to hold both forms */
.form-container {
    position: relative;
    min-height: 200px;
}

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

.form-group label .required {
    color: #e74c3c;
    font-weight: bold;
    margin-left: 2px;
}

.form-group input {
    padding: 16px;
    border: 1px solid #D2D2D7;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 400;
    transition: all 0.2s ease;
    background: #FFFFFF;
    color: #1D1D1F;
}

.form-group input:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
    background: #FFFFFF;
}

.form-group input::placeholder {
    color: #86868B;
    font-weight: 400;
}


.auth-links {
    text-align: center;
    margin-top: 20px;
}

.forgot-password-link {
    color: #007AFF;
    text-decoration: none;
    font-size: 17px;
    font-weight: 400;
    transition: all 0.2s ease;
}

.forgot-password-link:hover {
    color: #0056CC;
    text-decoration: underline;
}

.btn-primary {
    background: #007AFF;
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
    width: 100%;
    text-align: center;
    font-family: inherit;
}

.btn-primary:hover {
    background: #0056CC;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    background: #004BB5;
}

.btn-secondary {
    background: transparent;
    color: #007AFF;
    border: 1px solid #007AFF;
    padding: 14px;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
    font-family: inherit;
}

.btn-secondary:hover {
    background: #007AFF;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.message {
    margin-top: 20px;
    padding: 16px;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 400;
    text-align: center;
    display: none;
}

.message.error {
    display: block;
}

.message.success {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
    border: 1px solid rgba(52, 199, 89, 0.3);
    display: block;
}

.message.error {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
    border: 1px solid rgba(255, 59, 48, 0.3);
}

/* Version footer */
.version-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #D2D2D7;
    padding: 8px 20px;
    font-size: 12px;
    color: #86868B;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.version-footer .version-text {
    font-weight: 500;
    color: #007AFF;
}

.version-footer .env-badge {
    display: inline-block;
    background: #007AFF;
    color: white;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    margin-left: 8px;
    font-weight: 500;
}

.version-footer .footer-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.version-footer .footer-powered-by {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.version-footer .footer-powered-by:hover {
    opacity: 1;
}

.version-footer .powered-by-text {
    font-size: 0.65rem;
    color: #86868B;
    opacity: 0.8;
}

.version-footer .powered-by-name {
    font-size: 0.7rem;
    font-weight: 500;
    color: #86868B;
}

.version-footer .footer-logo {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.version-footer .footer-logo:hover {
    opacity: 0.9;
}

.version-footer .footer-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.message.info {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

/* OTP specific styles */
#otp_code {
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    background: #F2F2F7;
    border: 1px solid #D2D2D7;
}

#otp_code:focus {
    background: #FFFFFF;
    border-color: #007AFF;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* Loading state */
.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive design */
@media (max-width: 480px) {
    .auth-card {
        padding: 30px 20px;
        margin: 10px;
    }
    
    .auth-header h1 {
        font-size: 24px;
    }
    
    .form-group input {
        padding: 12px;
        font-size: 16px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 12px;
        font-size: 14px;
    }
}

/* Focus states for accessibility */
.form-group input:focus,
.btn-primary:focus,
.btn-secondary:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}

/* Apple-style animations */
.auth-card {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Smooth transitions for form switching */
.auth-form {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Focus states for accessibility */
.form-group input:focus,
.btn-primary:focus,
.btn-secondary:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .auth-card {
        background: white;
        border: 2px solid #000;
    }
    
    .form-group input {
        border-color: #000;
    }
    
    .btn-primary {
        background: #000;
        color: white;
    }
}

/* Login Type Toggle */
.login-type-toggle {
    display: flex;
    margin-bottom: 20px;
    background: #F2F2F7;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    position: relative;
}

.toggle-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #86868B;
    font-size: 17px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
    font-family: inherit;
}

.toggle-btn:hover {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
}

.toggle-btn.active {
    background: #FFFFFF;
    color: #007AFF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Gray background for OTP option when password is active */
.login-type-toggle.password-active .toggle-btn[data-type="otp"] {
    background: transparent;
    color: #86868B;
}

/* Gray background for password option when OTP is active */
.login-type-toggle.otp-active .toggle-btn[data-type="password"] {
    background: transparent;
    color: #86868B;
}

.toggle-btn:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}
