/* ============================================================
   AUTH.CSS — Shared styles for login, register, forgot-password
   Classic5 — Binduman Auto Spare Parts
   ============================================================ */

   :root {
    --primary-color: #206bc4;
    --secondary-color: #4299e1;
    --success-color: #2fb344;
    --warning-color: #f59f00;
    --danger-color: #d63939;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --card-bg: #ffffff;
    --body-bg: #f8fafc;
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
}

/* ========== RTL ========== */
[dir="rtl"] { direction: rtl; text-align: right; }
[dir="rtl"] .auth-container { direction: rtl; }
[dir="rtl"] .form-label { text-align: right; }
[dir="rtl"] .form-control, [dir="rtl"] input, [dir="rtl"] select, [dir="rtl"] textarea { text-align: right; }
[dir="rtl"] .btn-group { flex-direction: row-reverse; }
[dir="rtl"] .password-toggle .toggle-icon { right: auto; left: 15px; }
[dir="rtl"] .language-switcher { right: auto; left: 20px; }

/* ========== BODY ========== */
body {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 0;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.1) 0%, transparent 50%),
        repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255,255,255,0.03) 35px, rgba(255,255,255,0.03) 70px);
    animation: backgroundShift 20s ease-in-out infinite;
    z-index: 0;
}

@keyframes backgroundShift {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20px, -20px); }
}

/* ========== DECORATIONS ========== */
.spare-parts-decoration {
    position: absolute;
    width: 100%; height: 100%;
    top: 0; left: 0; z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.spare-parts-decoration::before,
.spare-parts-decoration::after {
    content: '⚙️';
    position: absolute;
    font-size: 200px;
    opacity: 0.05;
    animation: float 15s ease-in-out infinite;
}
.spare-parts-decoration::before { top: -50px; right: -50px; animation-delay: 0s; }
.spare-parts-decoration::after { bottom: -50px; left: -50px; animation-delay: 7.5s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(30px, 30px) rotate(180deg); }
}

/* ========== CONTAINER ========== */
.auth-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    position: relative;
    z-index: 1;
}

/* ========== LEFT PANEL (visual side) ========== */
.store-visual {
    background: linear-gradient(135deg, rgba(102,126,234,0.95), rgba(118,75,162,0.95));
    border-radius: 24px 0 0 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.store-visual::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(255,255,255,0.1) 0%, transparent 50%);
    z-index: 0;
}

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

.lottie-container {
    width: 100%;
    max-width: 500px;
    height: 400px;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.lottie-container svg { width: 100% !important; height: 100% !important; }
.auth-visual-spinner {
    width: 72px;
    height: 72px;
    border: 4px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authVisualSpin 0.75s linear infinite;
}
@keyframes authVisualSpin { to { transform: rotate(360deg); } }

.store-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; text-shadow: 0 4px 20px rgba(0,0,0,0.2); letter-spacing: -1px; }
.store-subtitle { font-size: 1.2rem; opacity: 0.95; margin-bottom: 2rem; font-weight: 300; }

.store-features {
    list-style: none; padding: 0;
    max-width: 320px; margin: 0 auto 2rem;
    text-align: left;
}
.store-features li {
    padding: 0.9rem 0; font-size: 1.05rem;
    display: flex; align-items: center; gap: 0.9rem;
    transition: transform 0.2s ease; color: white;
}
.store-features li:hover { transform: translateX(5px); }
.store-features li i { color: rgba(255,255,255,0.95); font-size: 1.2rem; width: 24px; text-align: center; }

/* ========== RIGHT PANEL (card) ========== */
.auth-card {
    background: var(--card-bg);
    border-radius: 0 24px 24px 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 8px 20px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.9);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.auth-header {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    color: #1e293b;
    padding: 2.5rem 2.5rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.auth-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end), var(--gradient-start));
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.auth-header h1 {
    position: relative; z-index: 2;
    font-size: 1.7rem; font-weight: 800;
    margin-bottom: 0.3rem; letter-spacing: -0.5px; color: #1e293b;
}
.auth-header p { position: relative; z-index: 2; color: #64748b; font-size: 0.9rem; font-weight: 400; margin: 0; }

.auth-body { padding: 2rem 2.5rem; background: white; flex: 1; }

.auth-footer {
    padding: 1.2rem 2.5rem;
    background: linear-gradient(to right, #f8fafc, #f1f5f9);
    border-top: 1px solid rgba(0,0,0,0.06);
    text-align: center;
    font-size: 0.85rem; color: #6b7280;
    flex-shrink: 0;
}

/* ========== FORM CONTROLS ========== */
.form-label {
    font-weight: 600; color: #1e293b;
    margin-bottom: 0.4rem; font-size: 0.85rem;
    display: block;
}

.required-label::after { content: ' *'; color: #dc3545; font-weight: bold; }

.form-control, .form-select {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
    width: 100%;
    font-family: inherit;
    color: #1e293b;
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--gradient-start);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1), inset 0 1px 2px rgba(0,0,0,0.04);
}

.form-control:hover, .form-select:hover { border-color: #cbd5e1; }
.form-control::placeholder { color: #b0b8c4; }
.form-control.is-invalid { border-color: var(--danger-color); }
.form-text { font-size: 0.8rem; color: #94a3b8; margin-top: 0.3rem; }

/* Password toggle */
.password-toggle { position: relative; }
.password-toggle .toggle-icon {
    position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
    cursor: pointer; font-size: 1.1rem; color: #9ca3af;
    transition: color 0.3s ease; z-index: 10;
}
.password-toggle .toggle-icon:hover { color: var(--primary-color); }

/* ========== BUTTONS ========== */
.btn {
    border-radius: 10px;
    padding: 0.85rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    box-shadow: 0 4px 15px rgba(102,126,234,0.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102,126,234,0.45);
}

.btn-secondary {
    background: white;
    border: 2px solid #e5e7eb;
    color: #4b5563;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* ========== NOTIFICATIONS ========== */
#alertsContainer {
    position: fixed;
    top: 20px; right: 20px;
    width: 380px; z-index: 9999;
}

#alertsContainer .alert {
    border-left: 5px solid;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    overflow: hidden;
    margin-bottom: 10px;
    padding: 1rem;
}
#alertsContainer .alert-warning { background: linear-gradient(135deg, rgba(255,193,7,0.95), rgba(255,193,7,0.85)); border-left-color: #ffc107; color: #664d03; }
#alertsContainer .alert-danger { background: linear-gradient(135deg, rgba(220,53,69,0.95), rgba(220,53,69,0.85)); border-left-color: #dc3545; color: #58151c; }
#alertsContainer .alert-success { background: linear-gradient(135deg, rgba(25,135,84,0.95), rgba(25,135,84,0.85)); border-left-color: #198754; color: #0a3622; }
#alertsContainer .alert-info { background: linear-gradient(135deg, rgba(13,202,240,0.95), rgba(13,202,240,0.85)); border-left-color: #0dcaf0; color: #055160; }

#alertsContainer .progress { background: rgba(255,255,255,0.4); border-radius: 10px; height: 3px; margin-top: 8px; overflow: hidden; }
#alertsContainer .progress-bar { transition: width linear; background: rgba(255,255,255,0.7); }

/* Toast notifications */
.notification-toast {
    position: fixed;
    top: 30px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg, white, #f8fafc);
    border-radius: 14px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    padding: 1rem 1.2rem;
    display: flex; align-items: center; gap: 1rem;
    z-index: 10000;
    max-width: 420px;
    animation: slideDown 0.4s cubic-bezier(0.4,0,0.2,1);
    border: 1px solid rgba(0,0,0,0.05);
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.notification-toast.hiding {
    animation: slideUp 0.4s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes slideUp {
    to { transform: translateX(-50%) translateY(-100px); opacity: 0; }
}

.notification-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); flex-shrink: 0;
}
.notification-avatar.loading { background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)); color: white; }
.notification-avatar.success { background: linear-gradient(135deg, var(--success-color), #10b981); color: white; }
.notification-avatar.error, .notification-avatar.danger { background: linear-gradient(135deg, var(--danger-color), #ef4444); color: white; }
.notification-avatar.warning { background: linear-gradient(135deg, var(--warning-color), #fbbf24); color: white; }
.notification-avatar.info { background: linear-gradient(135deg, #0dcaf0, #0d6efd); color: white; }

.notification-avatar .spinner {
    position: absolute;
    top: -3px; left: -3px; right: -3px; bottom: -3px;
    border: 3px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.notification-content { flex: 1; }
.notification-title { font-weight: 700; color: #1f2937; margin-bottom: 0.2rem; font-size: 1rem; }
.notification-message { color: #6b7280; font-size: 0.88rem; line-height: 1.4; }
.notification-close {
    background: none; border: none; font-size: 1.6rem; color: #9ca3af;
    cursor: pointer; padding: 0.3rem; line-height: 1; transition: all 0.3s; flex-shrink: 0;
}
.notification-close:hover { color: var(--danger-color); transform: scale(1.1); }

/* ========== LANGUAGE SWITCHER ========== */
.language-switcher {
    position: fixed;
    top: 20px; right: 20px; z-index: 10001;
    display: flex; gap: 4px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 25px; padding: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}
.language-switcher a {
    padding: 7px 14px; border-radius: 20px; text-decoration: none;
    font-weight: 600; font-size: 0.85rem;
    transition: all 0.3s ease; color: #64748b;
    display: flex; align-items: center; gap: 5px;
}
.language-switcher a:hover { color: var(--primary-color); background: rgba(32,107,196,0.1); }
.language-switcher a.active {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white; box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}
/* Home link inside the language-switcher group: never gets .active so it
   stays neutral while EN/AR show the current locale. fa-home icon size
   matches the fa-globe used by the language items. */
.language-switcher a i.fa-home { font-size: 0.9rem; }

/* ========== RATE-LIMIT ALERT (amber, distinct from validation error) ==========
   Surfaces "Too many attempts" responses with an amber palette + countdown
   timer so users can distinguish a temporary throttle (refresh, wait, retry)
   from a hard validation/security failure. Security guard itself is unchanged
   server-side; this is purely UX clarity. */
.alert-rate-limit {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fbbf24;
    color: #78350f;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13.5px;
    line-height: 1.55;
    margin-bottom: 12px;
}
.alert-rate-limit .rl-icon {
    font-size: 22px;
    color: #b45309;
    flex-shrink: 0;
    margin-top: 1px;
}
.alert-rate-limit .rl-body { flex: 1; }
.alert-rate-limit .rl-title {
    font-weight: 700;
    font-size: 14px;
    color: #78350f;
    margin-bottom: 4px;
}
.alert-rate-limit .rl-msg { color: #92400e; }
.alert-rate-limit .rl-msg strong { color: #78350f; }
.alert-rate-limit .rl-countdown {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
    font-weight: 700;
    font-size: 16px;
    color: #b45309;
    background: rgba(255,255,255,0.7);
    padding: 3px 12px;
    border-radius: 6px;
    margin-top: 8px;
    border: 1px solid #fbbf24;
}
.alert-rate-limit .rl-countdown.ready {
    background: rgba(220,252,231,0.9);
    color: #15803d;
    border-color: #86efac;
}
.alert-rate-limit .rl-hint {
    font-size: 12px;
    color: #92400e;
    margin-top: 6px;
}
.alert-rate-limit .rl-hint a {
    color: #78350f;
    font-weight: 600;
    text-decoration: underline;
}

/* ========== SECURITY NOTICE ========== */
.security-notice {
    font-size: 0.85em; color: #475569;
    margin-top: 16px; padding: 0.9rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    border-left: 3px solid var(--primary-color);
}
.security-notice strong { color: #1e293b; display: block; margin-bottom: 0.3rem; font-size: 0.9em; }
.security-notice small { color: #64748b; line-height: 1.6; }

/* ========== FORM CHECK ========== */
.form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); }

/* ========== FOCUS VISIBLE ========== */
*:focus { outline: 2px solid var(--primary-color); outline-offset: 2px; }
*:focus:not(:focus-visible) { outline: none; }

/* ========== RESPONSIVE ========== */
@media (max-width: 968px) {
    .auth-container { grid-template-columns: 1fr; max-width: 500px; }
    .store-visual { border-radius: 24px 24px 0 0; padding: 2rem; min-height: 280px; }
    .auth-card { border-radius: 0 0 24px 24px; }
    .lottie-container { height: 250px; max-width: 100%; }
    .store-title { font-size: 2rem; }
}

@media (max-width: 768px) {
    body { padding: 15px; align-items: flex-start; }
    .auth-container { max-width: 100%; }
    .store-visual { padding: 1.5rem; min-height: 250px; }
    .store-title { font-size: 1.6rem; }
    .store-subtitle { font-size: 1rem; }
    .store-features { max-width: 100%; }
    .store-features li { font-size: 0.9rem; padding: 0.6rem 0; }
    .auth-header { padding: 1.5rem; }
    .auth-header h1 { font-size: 1.5rem; }
    .auth-body { padding: 1.5rem; }
    #alertsContainer { width: calc(100% - 40px); left: 20px; right: 20px; top: 10px; }
    .notification-toast { width: calc(100% - 40px); top: 15px; }
    .language-switcher { top: 10px; right: 10px; padding: 3px; }
    .language-switcher a { padding: 6px 10px; font-size: 0.8rem; }
    [dir="rtl"] .language-switcher { left: 10px; }
}

@media (max-width: 576px) {
    body { padding: 10px; }
    .auth-header h1 { font-size: 1.4rem; }
    .form-control, .form-select { padding: 0.7rem 0.9rem; font-size: 16px; }
    .btn { width: 100%; padding: 0.8rem 1rem; }
    .btn-group { flex-direction: column; gap: 8px; }
}