/* ==================== VARIABLES ==================== */
:root {
    --karseir-primary: #2563eb;
    --karseir-primary-dark: #1d4ed8;
    --karseir-dark: #1e293b;
    --karseir-gray: #64748b;
    --karseir-white: #ffffff;
    --karseir-border: #e2e8f0;
    --radius-md: 0.5rem;
    --radius-xl: 1rem;
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --gradient-primary: linear-gradient(135deg, #2563eb, #0ea5e9);
}

/* ==================== FONTS ==================== */
@font-face {
    font-family: "Vazirmatn";
    src: url("/static/fonts/Vazir.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: "Vazirmatn", sans-serif;
    background-color: #f8fafc; /* رنگ پس‌زمینه پایه */
}

/* Background Pattern (Fixed position prevents layout breaking) */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 40%),
        radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.08), transparent 40%);
    z-index: -1;
}

/* Login Card */
.login-card {
    background: var(--karseir-white);
    border: 1px solid var(--karseir-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    /* max-width حذف شد تا گرید بوت‌استرپ به درستی عمل کند */
    padding: 2.5rem;
    position: relative;
    z-index: 1;
}

/* Logo Styling */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    font-weight: 900;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--karseir-dark);
    letter-spacing: -0.02em;
}

/* Form Elements */
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--karseir-dark);
    margin-bottom: 0.4rem;
}

.input-group-text {
    background-color: transparent;
    border-left: none; /* برای چینش RTL (راست‌چین) */
    color: var(--karseir-gray);
}

.form-control {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--karseir-border);
    border-right: none; /* برای چینش RTL */
    transition: all 0.2s;
}

.input-group:focus-within .form-control,
.input-group:focus-within .input-group-text {
    border-color: var(--karseir-primary);
    box-shadow: none;
}

.input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    border-radius: var(--radius-md);
}

.form-control:focus {
    box-shadow: none;
    border-color: var(--karseir-primary);
}

/* Button */
.btn-submit {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.85rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    width: 100%;
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4);
    color: white;
}

/* Helpers */
.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

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

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

.form-check-label {
    font-size: 0.85rem;
    color: var(--karseir-gray);
}

.form-check-input:checked {
    background-color: var(--karseir-primary);
    border-color: var(--karseir-primary);
}


/* ==================== FORM INPUTS ==================== */
.form-label {
    font-size: 0.85rem;
    letter-spacing: -0.01em;
}

/* کانتینر اصلی اینپوت */
.modern-input-group {
    display: flex;
    align-items: center;
    background-color: #f1f5f9; /* پس‌زمینه ملایم در حالت عادی */
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* حالت فوکوس (هنگام تایپ) */
.modern-input-group:focus-within {
    background-color: var(--karseir-white);
    border-color: var(--karseir-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); /* هاله رنگی ملایم */
}

/* استایل آیکون */
.modern-input-group .input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 1.2rem; /* تنظیم برای RTL */
    padding-left: 0.5rem;
    color: #94a3b8;
    font-size: 1.15rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

/* انیمیشن آیکون هنگام فوکوس */
.modern-input-group:focus-within .input-icon {
    color: var(--karseir-primary);
    transform: scale(1.1); /* بزرگ‌نمایی جزئی آیکون */
}

/* استایل فیلد ورودی */
.modern-input-group .form-control {
    background: transparent;
    border: none;
    padding: 0.85rem 1rem 0.85rem 0.85rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--karseir-dark);
    box-shadow: none !important; /* جلوگیری از تداخل با بوت‌استرپ */
    outline: none;
    width: 100%;
}

/* استایل متن نگهدارنده (Placeholder) */
.modern-input-group .form-control::placeholder {
    color: #cbd5e1;
    font-weight: 400;
    font-size: 0.9rem;
}

/* دکمه نمایش/مخفی کردن رمز عبور */
.btn-toggle-password {
    background: none;
    border: none;
    color: #94a3b8;
    padding: 0 0.5rem 0 1rem; /* تنظیم برای RTL */
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-toggle-password:hover {
    color: var(--karseir-primary);
}
