/* ============================================
   WalaOne Admin - Auth Screens Design System
   ============================================ */

:root {
    --primary-50: #F5F3FF;
    --primary-100: #EDE9FE;
    --primary-200: #DDD6FE;
    --primary-300: #C4B5FD;
    --primary-400: #A78BFA;
    --primary-500: #8B5CF6;
    --primary-600: #7C3AED;
    --primary-700: #6D28D9;
    --primary-800: #5B21B6;
    --primary-900: #4C1D95;

    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    --accent-300: #F6D977;
    --accent-400: #E5B94E;
    --accent-500: #D4A843;
    --accent-600: #B8912E;

    --success-50: #ECFDF5;
    --success-600: #059669;
    --error-50: #FEF2F2;
    --error-600: #DC2626;
}

/* ============================================
   Base / Background
   ============================================ */
body.auth-bg {
    margin: 0;
    padding: 20px;
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    background: linear-gradient(135deg, #4C1D95 0%, #6D28D9 50%, #5B3E96 100%) !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.auth-bg * {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

body.auth-bg > .d-flex.flex-column.flex-root {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 40px);
}

/* ============================================
   Login Page - Two Column Layout
   ============================================ */
.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 1000px;
    width: 100%;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-left {
    padding: 56px 48px;
    background: white;
}

.login-right {
    background: linear-gradient(135deg, #5B21B6 0%, #6D28D9 50%, #4C1D95 100%);
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.login-right::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(212, 168, 67, 0.08);
    border-radius: 50%;
    top: -100px;
    right: -100px;
}

.login-right::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(212, 168, 67, 0.06);
    border-radius: 50%;
    bottom: -50px;
    left: -50px;
}

.right-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.right-logo {
    width: 140px;
    height: 140px;
    margin: 0 auto 30px;
}

.right-logo svg,
.right-logo img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.2));
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.15);
    animation: float 3s ease-in-out infinite;
}

.right-content h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 16px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    color: white;
}

.right-content p {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.8;
    color: white;
}

/* ============================================
   Auth Logo
   ============================================ */
.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.auth-logo-icon {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.auth-logo-icon svg,
.auth-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(91, 62, 150, 0.12);
}

.auth-logo-text {
    display: flex;
    flex-direction: column;
}

.auth-logo-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-800);
    line-height: 1;
}

.auth-logo-subtitle {
    font-size: 0.9rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ============================================
   Auth Headings
   ============================================ */
.auth-heading {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--gray-500);
    margin-bottom: 28px;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ============================================
   Auth Form Inputs
   ============================================ */
.auth-form-group {
    margin-bottom: 22px;
}

.auth-form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.auth-input-wrapper {
    position: relative;
}

.auth-form-input {
    width: 100%;
    padding: 13px 16px 13px 44px;
    border: 2px solid var(--gray-200) !important;
    border-radius: 10px !important;
    font-size: 0.95rem;
    font-family: 'Tajawal', sans-serif !important;
    transition: all 0.3s ease;
    background: var(--gray-50) !important;
    color: var(--gray-800) !important;
    box-sizing: border-box;
}

[dir="rtl"] .auth-form-input {
    padding: 13px 44px 13px 16px;
}

.auth-form-input.auth-input-clean {
    padding: 13px 16px;
}

[dir="rtl"] .auth-input-wrapper:has(.auth-password-toggle) .auth-form-input.auth-input-clean {
    padding: 13px 16px 13px 48px;
}

[dir="ltr"] .auth-input-wrapper:has(.auth-password-toggle) .auth-form-input.auth-input-clean {
    padding: 13px 48px 13px 16px;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    color: var(--gray-400);
    font-size: 1.1rem;
    z-index: 2;
    transition: color 0.2s ease;
    line-height: 1;
}

.auth-password-toggle:hover {
    color: var(--accent-500);
}

[dir="rtl"] .auth-password-toggle {
    left: 8px;
    right: auto;
}

[dir="ltr"] .auth-password-toggle {
    right: 8px;
    left: auto;
}

.auth-form-input:focus {
    outline: none;
    border-color: var(--accent-400) !important;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15) !important;
}

.auth-form-input::placeholder {
    color: var(--gray-400);
    font-size: 0.9rem;
}

/* ============================================
   Auth Buttons
   ============================================ */
.btn-auth-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%) !important;
    color: white !important;
    border: none !important;
    border-bottom: 3px solid var(--accent-400) !important;
    border-radius: 10px !important;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif !important;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-auth-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4), 0 4px 12px rgba(229, 185, 78, 0.3) !important;
    color: white !important;
    background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%) !important;
    border-bottom-color: var(--accent-300) !important;
}

.btn-auth-primary:active {
    transform: translateY(0);
}

.btn-auth-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-auth-primary svg,
.btn-auth-primary i {
    width: 20px;
    height: 20px;
    font-size: 1rem;
}

/* ============================================
   Auth Error Messages
   ============================================ */
.auth-error-message {
    background: #FEE2E2;
    color: #991B1B;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-error-message i,
.auth-error-message svg.auth-icon-inline {
    flex-shrink: 0;
    font-size: 1rem;
}

svg.auth-icon-inline {
    flex-shrink: 0;
}

svg.auth-icon-success {
    color: var(--primary-600);
    margin: 0 auto 12px;
    display: block;
}

/* Override Metronic invalid-feedback */
body.auth-bg .invalid-feedback {
    font-size: 0.8rem;
    margin-top: 6px;
    color: #DC2626;
}

/* ============================================
   Auth Form Footer (remember me, forgot password)
   ============================================ */
.auth-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.auth-forgot-link {
    color: var(--primary-600);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.auth-forgot-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* ============================================
   2FA / OTP Setup Container
   ============================================ */
.setup-container {
    max-width: 600px;
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    margin: 0 auto;
}

/* Security Icon */
.auth-security-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3), 0 0 0 3px var(--accent-300);
}

.auth-security-icon i,
.auth-security-icon svg {
    font-size: 2rem;
    color: white;
}

/* ============================================
   2FA Steps
   ============================================ */
.auth-steps {
    text-align: right;
    margin-bottom: 32px;
}

[dir="ltr"] .auth-steps {
    text-align: left;
}

.auth-step {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.auth-step-number {
    width: 36px;
    height: 36px;
    background: var(--primary-100);
    color: var(--primary-600);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.auth-step-content {
    flex: 1;
}

.auth-step-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
    font-size: 1rem;
}

.auth-step-description {
    color: var(--gray-500);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ============================================
   QR Code Section
   ============================================ */
.auth-qr-section {
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
}

.auth-qr-section img {
    max-width: 200px;
    margin: 0 auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ============================================
   OTP / Code Inputs
   ============================================ */
.auth-code-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 16px 0;
    direction: ltr;
}

.auth-code-inputs .form-control,
.auth-code-input {
    width: 52px !important;
    height: 58px !important;
    border: 2px solid var(--gray-200) !important;
    border-radius: 10px !important;
    text-align: center;
    font-size: 1.5rem !important;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif !important;
    transition: all 0.3s ease;
    background: var(--gray-50) !important;
    padding: 0 !important;
    color: var(--gray-900) !important;
}

.auth-code-inputs .form-control:focus,
.auth-code-input:focus {
    outline: none;
    border-color: var(--accent-400) !important;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15) !important;
}

.auth-code-inputs .form-control.border-danger,
.auth-code-input.border-danger {
    border-color: #DC2626 !important;
}

/* ============================================
   Auth Stepper (for 2FA enable)
   ============================================ */
.auth-stepper-nav {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-100);
}

.auth-stepper-item {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.auth-stepper-item.current {
    opacity: 1;
}

.auth-stepper-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.auth-stepper-item.current .auth-stepper-dot {
    background: linear-gradient(135deg, var(--accent-400) 0%, var(--accent-500) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(212, 168, 67, 0.3);
}

.auth-stepper-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
}

/* ============================================
   Auth Success Notice
   ============================================ */
.auth-success-notice {
    background: linear-gradient(135deg, var(--primary-50) 0%, #EDE9FE 100%);
    border: 1px solid var(--primary-200);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.auth-success-notice i,
.auth-success-notice svg {
    font-size: 2.5rem;
    color: var(--primary-600);
    margin-bottom: 12px;
    display: block;
}

.auth-success-notice p {
    font-size: 0.95rem;
    color: var(--gray-700);
    line-height: 1.6;
    margin: 0;
}

.auth-success-notice a {
    color: var(--primary-600);
    font-weight: 600;
    text-decoration: none;
}

.auth-success-notice a:hover {
    text-decoration: underline;
}

/* ============================================
   Auth Footer Links
   ============================================ */
.auth-footer-links {
    text-align: center;
    font-size: 0.9rem;
    margin-top: 24px;
    color: var(--gray-500);
}

.auth-footer-links a {
    color: var(--primary-600);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer-links a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* ============================================
   Auth Hint Text
   ============================================ */
.auth-hint {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.auth-error-text {
    color: #DC2626;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.login-left {
    animation: fadeInUp 0.5s ease-out both;
}

.login-right {
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.setup-container {
    animation: scaleIn 0.5s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
    .login-left,
    .login-right,
    .setup-container,
    .right-logo svg,
    .right-logo img {
        animation: none !important;
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    body.auth-bg {
        padding: 16px;
    }

    .login-container {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .login-right {
        display: none;
    }

    .login-left {
        padding: 36px 28px;
    }

    .setup-container {
        padding: 36px 24px;
    }

    .auth-code-inputs .form-control,
    .auth-code-input {
        width: 44px !important;
        height: 50px !important;
        font-size: 1.3rem !important;
    }

    .auth-stepper-nav {
        gap: 16px;
        flex-wrap: wrap;
    }

    .auth-heading {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .login-left {
        padding: 28px 20px;
    }

    .auth-code-inputs {
        gap: 6px;
    }

    .auth-code-inputs .form-control,
    .auth-code-input {
        width: 40px !important;
        height: 46px !important;
        font-size: 1.1rem !important;
    }
}
