/* ═══════════════════════════════════════════════════════
   ProFleetScan — Auth CSS
   Split layout: Left branding + Right form
   Supports: Light/Dark theme, LTR/RTL, Mobile responsive
═══════════════════════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── CSS Variables: Light Theme ── */
[data-theme="light"] {
    --bg:            #f5f7fa;
    --panel-bg:      #ffffff;
    --brand-bg:      #1e3a5f;
    --brand-text:    #ffffff;
    --brand-sub:     rgba(255,255,255,0.75);
    --brand-feat:    rgba(255,255,255,0.9);
    --text:          #1a202c;
    --text-sub:      #718096;
    --border:        #e2e8f0;
    --input-bg:      #f8fafc;
    --input-border:  #cbd5e0;
    --input-focus:   #2563eb;
    --primary:       #2563eb;
    --primary-hover: #1d4ed8;
    --primary-text:  #ffffff;
    --link:          #2563eb;
    --error:         #dc2626;
    --success:       #16a34a;
    --ctrl-bg:       #ffffff;
    --ctrl-border:   #e2e8f0;
    --ctrl-text:     #4a5568;
    --shadow:        0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg:     0 10px 40px rgba(0,0,0,0.08);
    --feat-icon:     rgba(255,255,255,0.9);
    --toast-bg:      #1a202c;
    --toast-text:    #ffffff;
}

/* ── CSS Variables: Dark Theme ── */
[data-theme="dark"] {
    --bg:            #0f172a;
    --panel-bg:      #1e293b;
    --brand-bg:      #0f172a;
    --brand-text:    #f1f5f9;
    --brand-sub:     rgba(241,245,249,0.65);
    --brand-feat:    rgba(241,245,249,0.85);
    --text:          #f1f5f9;
    --text-sub:      #94a3b8;
    --border:        #334155;
    --input-bg:      #273549;
    --input-border:  #334155;
    --input-focus:   #3b82f6;
    --primary:       #3b82f6;
    --primary-hover: #2563eb;
    --primary-text:  #ffffff;
    --link:          #60a5fa;
    --error:         #f87171;
    --success:       #4ade80;
    --ctrl-bg:       #1e293b;
    --ctrl-border:   #334155;
    --ctrl-text:     #94a3b8;
    --shadow:        0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg:     0 10px 40px rgba(0,0,0,0.4);
    --feat-icon:     #60a5fa;
    --toast-bg:      #f1f5f9;
    --toast-text:    #1a202c;
}

/* ── Body ── */
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* ═══════════════════════════════════════════════════════
   FLOATING CONTROLS
═══════════════════════════════════════════════════════ */
.floating-controls {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 1000;
}

[dir="rtl"] .floating-controls {
    right: auto;
    left: 16px;
}

.ctrl-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--ctrl-bg);
    border: 1.5px solid var(--ctrl-border);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ctrl-text);
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
}

.ctrl-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ── Language Dropdown ── */
.lang-dropdown { position: relative; }

.lang-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--panel-bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    min-width: 140px;
    box-shadow: var(--shadow-lg);
    z-index: 999;
}

[dir="rtl"] .lang-menu {
    right: auto;
    left: 0;
}

.lang-menu.open { display: block; }

.lang-option {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}

.lang-option:hover,
.lang-option.active {
    background: var(--input-bg);
    color: var(--primary);
}

/* ═══════════════════════════════════════════════════════
   AUTH WRAPPER — Split Layout
═══════════════════════════════════════════════════════ */
.auth-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Left: Brand Panel ── */
.auth-brand-panel {
    width: 420px;
    flex-shrink: 0;
    background: var(--brand-bg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}

/* Decorative circles */
.auth-brand-panel::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    border: 60px solid rgba(255,255,255,0.04);
    top: -80px;
    right: -80px;
}

.auth-brand-panel::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 40px solid rgba(255,255,255,0.04);
    bottom: 60px;
    left: -60px;
}

.brand-content { position: relative; z-index: 1; }

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    color: var(--brand-text);
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--brand-text);
}

.brand-tagline {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--brand-text);
    line-height: 1.3;
    margin-bottom: 16px;
}

.brand-description {
    font-size: 14px;
    color: var(--brand-sub);
    line-height: 1.7;
    margin-bottom: 36px;
}

.brand-features { display: flex; flex-direction: column; gap: 16px; }

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--brand-feat);
    font-size: 14px;
    font-weight: 500;
}

.feature-item svg { color: var(--feat-icon); flex-shrink: 0; }

.brand-footer {
    font-size: 12px;
    color: var(--brand-sub);
    position: relative;
    z-index: 1;
}

/* ── Right: Form Panel ── */
.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: var(--panel-bg);
    overflow-y: auto;
}

.auth-form-inner {
    width: 100%;
    max-width: 420px;
}

/* ═══════════════════════════════════════════════════════
   AUTH FORM COMPONENTS
═══════════════════════════════════════════════════════ */

/* ── Header ── */
.auth-header { margin-bottom: 32px; }

.auth-title {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-sub);
}

/* ── Icon Circle (Forgot Password) ── */
.auth-icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--primary);
}

/* ── Server Alerts ── */
.server-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}

.server-alert-error {
    background: rgba(220,38,38,0.08);
    color: var(--error);
    border: 1px solid rgba(220,38,38,0.2);
}

.server-alert-success {
    background: rgba(22,163,74,0.08);
    color: var(--success);
    border: 1px solid rgba(22,163,74,0.2);
}

/* ── Form Groups ── */
.auth-form { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Input Wrapper ── */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: var(--text-sub);
    pointer-events: none;
    z-index: 1;
}

[dir="rtl"] .input-icon {
    left: auto;
    right: 12px;
}

.form-input {
    width: 100%;
    padding: 11px 16px 11px 40px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

[dir="rtl"] .form-input {
    padding: 11px 40px 11px 16px;
}

.form-input::placeholder { color: var(--text-sub); }

.form-input:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    background: var(--panel-bg);
}

.form-input.error { border-color: var(--error); }

/* ── Toggle Password Button ── */
.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-sub);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

[dir="rtl"] .toggle-password {
    right: auto;
    left: 12px;
}

.toggle-password:hover { color: var(--primary); }

/* ── Field Error ── */
.field-error {
    font-size: 12px;
    color: var(--error);
    min-height: 16px;
}

/* ── Inline Group (Remember Me) ── */
.form-group-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -4px;
}

/* ── Checkbox ── */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-sub);
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] { display: none; }

.checkmark {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--input-border);
    border-radius: 4px;
    background: var(--input-bg);
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}

.checkbox-wrapper input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-wrapper input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

/* ── Primary Button ── */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: var(--primary-text);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin-top: 4px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37,99,235,0.3);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ── Secondary Button ── */
.btn-secondary {
    width: 100%;
    padding: 11px;
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ── Spinner ── */
.spinner {
    width: 18px;
    height: 18px;
    animation: spin 0.8s linear infinite;
}

@@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ── */
.auth-divider {
    text-align: center;
    position: relative;
    color: var(--text-sub);
    font-size: 13px;
    margin: 4px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: var(--border);
}

.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

/* ── Social Buttons ── */
.social-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
}

.btn-social:hover {
    border-color: var(--primary);
    background: var(--panel-bg);
}

/* ── Footer ── */
.auth-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-sub);
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.form-link {
    color: var(--link);
    font-weight: 600;
    text-decoration: none;
    font-size: 13px;
}

.form-link:hover { text-decoration: underline; }

/* ── Back Link ── */
.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Password Strength ── */
.password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: -10px;
}

.strength-bars {
    display: flex;
    gap: 4px;
    flex: 1;
}

.strength-bar {
    height: 4px;
    flex: 1;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.3s;
}

.strength-text {
    font-size: 12px;
    font-weight: 600;
    min-width: 40px;
}

/* ── Success State ── */
.success-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(22,163,74,0.1);
    border: 1.5px solid rgba(22,163,74,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--success);
}

.success-message {
    text-align: center;
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.7;
    margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

[dir="rtl"] .toast-container {
    right: auto;
    left: 24px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--toast-bg);
    color: var(--toast-text);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: toastIn 0.3s ease;
    max-width: 320px;
}

.toast.success { border-left: 3px solid #22c55e; }
.toast.error   { border-left: 3px solid #ef4444; }
.toast.info    { border-left: 3px solid #3b82f6; }

@@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@@media (max-width: 900px) {
    .auth-brand-panel { display: none; }
    .auth-form-panel  { padding: 32px 20px; }
}

@@media (max-width: 480px) {
    .form-row { grid-template-columns: 1fr; }
    .social-buttons { grid-template-columns: 1fr; }
    .auth-form-inner { max-width: 100%; }
}
