/* =========================================
   AUTH PAGES CSS
   Login, Register, Forgot Password
   MODERN DESIGN WITH DARK/LIGHT MODE
   MATCHING ADMIN PANEL STYLE
   ========================================= */

/* =========================================
   1. ROOT VARIABLES - LIGHT & DARK MODES
   ========================================= */
:root {
    /* Light Mode Colors */
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #eef2ff;
    --secondary: #06d6a0;
    --danger: #ef476f;
    --warning: #ffd166;
    --dark: #1a1a2e;
    --dark-light: #2d2d44;
    --gray-900: #4a4a6a;
    --gray-700: #6c6c8a;
    --gray-500: #a0a0b8;
    --gray-300: #d1d1e0;
    --gray-200: #e9e9f0;
    --gray-100: #f8f9ff;
    --white: #ffffff;
    
    /* Background & Surface */
    --bg-body: #f8f9ff;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border-color: #d1d1e0;
    --text-primary: #1a1a2e;
    --text-secondary: #6c6c8a;
    --text-muted: #a0a0b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    
    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transition */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --theme-transition: background-color 0.4s ease-in-out, 
                        border-color 0.3s ease-in-out,
                        color 0.3s ease-in-out,
                        box-shadow 0.3s ease-in-out;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    /* Primary Colors */
    --primary: #5f7cff;
    --primary-dark: #4a67e6;
    --primary-light: #2a2a4a;
    --secondary: #20e0a8;
    --danger: #ff6b8b;
    --warning: #ffdb8e;
    
    /* Neutral Colors */
    --gray-900: #e0e0f0;
    --gray-700: #b0b0d0;
    --gray-500: #8080a0;
    --gray-300: #3a3a50;
    --gray-200: #2a2a3a;
    --gray-100: #1a1a2a;
    
    /* Background & Surface */
    --bg-body: #0a0a14;
    --bg-card: #1a1a2a;
    --bg-input: #1a1a2a;
    --border-color: #2a2a3a;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #a0a0b0;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 18px rgba(0, 0, 0, 0.7);
    --shadow-xl: 0 20px 28px rgba(0, 0, 0, 0.8);
    
    /* Glow Effects */
    --glow-primary: 0 0 20px rgba(95, 124, 255, 0.2);
    --glow-success: 0 0 20px rgba(32, 224, 168, 0.2);
    --glow-danger: 0 0 20px rgba(255, 107, 139, 0.2);
}

/* Apply theme transitions */
* {
    transition: var(--theme-transition);
}

/* Disable transitions on page load */
.preload * {
    transition: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: var(--theme-transition);
}

a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    transition: var(--transition);
}

a:hover {
    text-decoration: underline;
}

/* =========================================
   THEME TOGGLE BUTTON - BOTTOM RIGHT
   ========================================= */
.theme-toggle-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: scale(1.05);
    border-color: var(--primary);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle i {
    position: absolute;
    transition: transform 0.3s ease-in-out, opacity 0.2s ease;
}

[data-theme="dark"] .theme-toggle .ri-sun-line {
    display: inline-block;
    animation: fadeIn 0.3s ease;
}
[data-theme="dark"] .theme-toggle .ri-moon-line {
    display: none;
    opacity: 0;
    transform: rotate(90deg);
}

.theme-toggle .ri-sun-line {
    display: none;
}
[data-theme="dark"] .theme-toggle .ri-sun-line {
    display: inline-block;
    opacity: 1;
    transform: rotate(0deg);
}
.theme-toggle .ri-moon-line {
    display: inline-block;
}
[data-theme="dark"] .theme-toggle .ri-moon-line {
    display: none;
    opacity: 0;
    transform: rotate(-90deg);
}

/* =========================================
   MAIN WRAPPER
   ========================================= */
.auth-wrapper {
    display: flex;
    width: 100%;
    max-width: 1100px;
    min-height: 600px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    margin: 20px;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .auth-wrapper {
    box-shadow: var(--shadow-xl), var(--glow-primary);
    border-color: rgba(95, 124, 255, 0.2);
}

/* =========================================
   LEFT SIDE - BRAND SECTION
   ========================================= */
.auth-brand {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: white;
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 280px;
    height: 280px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.brand-content {
    position: relative;
    z-index: 2;
    max-width: 340px;
}

.brand-logo-large {
    margin-bottom: 28px;
}

.brand-logo-large img {
    height: 55px;
    width: auto;
    filter: brightness(0) invert(1);
}

.auth-brand h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 14px;
    line-height: 1.2;
}

.auth-brand p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 32px;
    line-height: 1.6;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.feature-item i {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    backdrop-filter: blur(5px);
}

.feature-item span {
    font-size: 15px;
    font-weight: 500;
}

/* =========================================
   RIGHT SIDE - FORM SECTION
   ========================================= */
.auth-form-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg-card);
}

.auth-form-card {
    width: 100%;
    max-width: 380px;
}

/* Logo on Top */
.form-logo {
    display: block;
    text-align: center;
    margin-bottom: 24px;
}

.form-logo img {
    height: 50px;
    width: auto;
}

[data-theme="dark"] .form-logo img {
    filter: brightness(0.9);
}

.auth-header {
    margin-bottom: 28px;
    text-align: center;
}

.auth-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 15px;
    color: var(--text-secondary);
}

/* =========================================
   FORM ELEMENTS
   ========================================= */
.auth-form-group {
    margin-bottom: 20px;
}

.auth-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-form-group label i {
    margin-right: 8px;
    color: var(--primary);
    font-size: 14px;
}

.auth-form-group .required {
    color: var(--danger);
    margin-left: 2px;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
    background: var(--bg-input);
    height: 52px;
    -webkit-appearance: none;
}

[data-theme="dark"] .auth-input {
    background: var(--bg-input);
    border-color: rgba(255, 255, 255, 0.1);
}

.auth-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

[data-theme="dark"] .auth-input:focus {
    box-shadow: 0 0 0 3px rgba(95, 124, 255, 0.3);
}

.auth-input::placeholder {
    color: var(--text-muted);
    font-size: 14px;
}

.auth-help-text {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Password Input with Toggle */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .auth-input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    right: 2px;
    top: 2px;
    height: calc(100% - 4px);
    width: 48px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
    padding: 0;
}

.password-toggle:hover {
    color: var(--primary);
    background: var(--primary-light);
}

[data-theme="dark"] .password-toggle:hover {
    background: rgba(95, 124, 255, 0.15);
}

/* Checkbox */
.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    margin: 0;
}

.auth-checkbox label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.5;
}

.auth-checkbox label a {
    color: var(--primary);
    font-weight: 600;
}

/* Row Between */
.auth-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.auth-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    height: 52px;
    -webkit-appearance: none;
}

.auth-submit-btn .btn-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-submit-btn i {
    font-size: 18px;
}

.auth-submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(67, 97, 238, 0.3);
}

[data-theme="dark"] .auth-submit-btn:hover {
    box-shadow: 0 8px 20px rgba(95, 124, 255, 0.5);
}

.auth-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* =========================================
   STEP CONTAINERS
   ========================================= */
.auth-step {
    display: none;
}

.auth-step.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

/* =========================================
   OTP VERIFICATION - MEDIUM SIZE
   ========================================= */
.otp-verification-container {
    text-align: center;
    width: 100%;
}

.otp-header {
    margin-bottom: 28px;
}

.otp-icon {
    width: 70px;
    height: 70px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--primary);
    margin: 0 auto 18px;
    border: 2px solid var(--primary);
}

[data-theme="dark"] .otp-icon {
    background: rgba(95, 124, 255, 0.15);
    border-color: var(--primary);
}

.otp-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.otp-header p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.otp-header strong {
    color: var(--primary);
    word-break: break-all;
}

/* 4 Digit OTP Input - MEDIUM SIZE */
.otp-input-group-4 {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.otp-digit-4 {
    width: 70px;
    height: 60px;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
    padding: 0;
}

[data-theme="dark"] .otp-digit-4 {
    background: var(--bg-input);
    border-color: rgba(255, 255, 255, 0.1);
}

.otp-digit-4:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

[data-theme="dark"] .otp-digit-4:focus {
    box-shadow: 0 0 0 3px rgba(95, 124, 255, 0.3);
}

/* OTP Timer */
.otp-timer {
    text-align: center;
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    padding: 14px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

[data-theme="dark"] .otp-timer {
    background: var(--bg-input);
    border-color: rgba(255, 255, 255, 0.1);
}

.otp-timer i {
    color: var(--warning);
    font-size: 18px;
}

/* =========================================
   OTP ACTIONS - 2 BUTTONS SIDE BY SIDE
   ========================================= */
.otp-actions-2 {
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
}

.btn-resend-otp {
    flex: 1;
    padding: 12px 8px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    -webkit-appearance: none;
    height: 48px;
}

[data-theme="dark"] .btn-resend-otp {
    background: var(--bg-input);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-resend-otp i {
    font-size: 16px;
}

.btn-resend-otp:hover:not(:disabled) {
    background: var(--gray-100);
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .btn-resend-otp:hover:not(:disabled) {
    background: rgba(95, 124, 255, 0.15);
    border-color: var(--primary);
    color: #ffffff;
}

.btn-resend-otp:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-verify-otp {
    flex: 1;
    padding: 12px 8px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    -webkit-appearance: none;
    height: 48px;
}

.btn-verify-otp i {
    font-size: 16px;
}

.btn-verify-otp:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(67, 97, 238, 0.3);
}

[data-theme="dark"] .btn-verify-otp:hover {
    box-shadow: 0 8px 20px rgba(95, 124, 255, 0.5);
}

.btn-verify-otp:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Back Button */
.btn-back {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    -webkit-appearance: none;
    height: 48px;
    margin-top: 8px;
}

[data-theme="dark"] .btn-back {
    background: var(--bg-input);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-back i {
    font-size: 16px;
}

.btn-back:hover {
    background: var(--gray-100);
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .btn-back:hover {
    background: rgba(95, 124, 255, 0.15);
    border-color: var(--primary);
    color: #ffffff;
}

/* =========================================
   RESET PASSWORD CONTAINER
   ========================================= */
.reset-password-container {
    text-align: center;
}

/* =========================================
   RESPONSIVE - MOBILE
   ========================================= */

/* Tablet & Mobile - Hide Brand Section */
@media (max-width: 992px) {
    .auth-wrapper {
        flex-direction: column;
        max-width: 450px;
        min-height: auto;
        margin: 16px;
        border-radius: var(--radius-md);
    }
    
    .auth-brand {
        display: none;
    }
    
    .auth-form-container {
        padding: 30px 24px;
        width: 100%;
    }
    
    .auth-form-card {
        max-width: 100%;
    }
    
    .theme-toggle-container {
        bottom: 16px;
        right: 16px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .auth-wrapper {
        margin: 12px;
    }
    
    .auth-form-container {
        padding: 24px 20px;
    }
    
    .auth-input {
        padding: 12px 14px;
        height: 48px;
        font-size: 15px;
    }
    
    .auth-submit-btn {
        padding: 12px;
        height: 48px;
        font-size: 15px;
    }
    
    /* OTP - Medium for mobile */
    .otp-digit-4 {
        width: 60px;
        height: 70px;
        font-size: 28px;
    }
    
    .otp-input-group-4 {
        gap: 10px;
    }
    
    .otp-actions-2 {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-resend-otp,
    .btn-verify-otp,
    .btn-back {
        width: 100%;
        height: 48px;
    }
    
    .form-logo img {
        height: 45px;
    }
    
    .auth-header h2 {
        font-size: 26px;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* Extra Small Devices */
@media (max-width: 360px) {
    .otp-digit-4 {
        width: 52px;
        height: 62px;
        font-size: 24px;
    }
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.ri-spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}