/* ========== فونت وزیرمتن ========== */
@font-face {
    font-family: 'Vazirmatn';
    src: url('/assets/fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/assets/fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@import url('/assets/fonts/material-icons/material-icons.css');

/* ========== تنظیمات پایه ========== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    margin: 0;
    background: linear-gradient(135deg, #f0f7ff 0%, #e3f2fd 50%, #bbdefb 100%);
    padding: 1rem;
}

/* ========== جهت‌های RTL و LTR ========== */
[dir="rtl"] body.auth-page {
    direction: rtl;
}

[dir="ltr"] body.auth-page {
    direction: ltr;
}

/* ========== کانتینر اصلی ========== */
.auth-container {
    width: 100%;
    max-width: 28rem;
    margin: auto;
}

/* ========== کارت احراز هویت ========== */
.auth-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1.5rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 8px 20px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
}

/* ========== لوگو ========== */
.auth-logo {
    display: flex;
    justify-content: center;
}

.auth-logo img {
    height: 5rem;
    width: auto;
}

/* ========== عناوین ========== */
.welcome-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0d47a1;
    text-align: center;
    margin: 0;
}

.welcome-subtitle {
    font-size: 0.95rem;
    color: #546e7a;
    margin: 0;
    line-height: 1.6;
}

/* تراز متن بر اساس جهت */
[dir="rtl"] .welcome-subtitle {
    text-align: right;
}
[dir="ltr"] .welcome-subtitle {
    text-align: left;
}

/* ========== انیمیشن ========== */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.anim-item {
    animation: fadeSlideUp 0.5s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.anim-item:nth-child(1) { animation-delay: 0.05s; }
.anim-item:nth-child(2) { animation-delay: 0.1s; }
.anim-item:nth-child(3) { animation-delay: 0.15s; }
.anim-item:nth-child(4) { animation-delay: 0.2s; }
.anim-item:nth-child(5) { animation-delay: 0.25s; }
.anim-item:nth-child(6) { animation-delay: 0.3s; }
.anim-item:nth-child(7) { animation-delay: 0.35s; }
.anim-item:nth-child(8) { animation-delay: 0.4s; }

/* ========== فیلدهای ورودی ========== */
.auth-card .form-control {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #e0e0e0;
    border-radius: 0.75rem;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: #212121;
    transition: all 0.2s ease;
    outline: none;
}

/* تراز متن و جهت فیلدها */
[dir="rtl"] .auth-card .form-control {
    text-align: right;
    direction: rtl;
}
[dir="ltr"] .auth-card .form-control {
    text-align: left;
    direction: ltr;
}

.auth-card .form-control::placeholder {
    color: #9e9e9e;
    opacity: 1;
}

.auth-card .form-control:hover {
    border-color: #90caf9;
}

.auth-card .form-control:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
    background: #fafbff;
}

.form-control.error {
    border-color: #e53935 !important;
    background: #fff5f5;
}

/* ========== پیام خطا ========== */
.field-error {
    font-size: 0.8rem;
    color: #c62828;
    margin-top: 0.4rem;
    font-weight: 500;
}

[dir="rtl"] .field-error {
    text-align: right;
}
[dir="ltr"] .field-error {
    text-align: left;
}

/* ========== دکمه اصلی ========== */
.btn-sabz {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    border: none;
    color: #ffffff;
    font-weight: 600;
    border-radius: 0.75rem;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-sabz:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    box-shadow: 0 6px 16px rgba(25, 118, 210, 0.35);
    transform: translateY(-1px);
}

/* ========== دکمه فرعی ========== */
.btn-outline-sabz {
    background: transparent;
    border: 2px solid #1976d2;
    color: #1565c0;
    font-weight: 600;
    border-radius: 0.75rem;
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
}

.btn-outline-sabz:hover {
    background: #1976d2;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.2);
}

/* ========== لینک‌ها ========== */
.auth-link {
    color: #1565c0;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
}

.auth-link:hover {
    text-decoration: underline;
}

/* ========== پیام‌های وضعیت ========== */
.auth-error,
.auth-success {
    border-radius: 0.75rem;
    padding: 0.7rem 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.auth-error {
    background: #ffebee;
    color: #b71c1c;
    border: 1px solid #ffcdd2;
}

.auth-success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

/* ========== تایمر ========== */
.timer-text {
    text-align: center;
    color: #37474f;
    font-weight: 500;
    font-size: 0.9rem;
    background: #f5f5f5;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

/* ========== Select سفارشی ========== */
.auth-card select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='%231976d2'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 1.2rem;
    cursor: pointer;
}

/* موقعیت آیکون Select بر اساس جهت */
[dir="rtl"] .auth-card select.form-control {
    background-position: left 0.8rem center;
}
[dir="ltr"] .auth-card select.form-control {
    background-position: right 0.8rem center;
}

/* ========== OTP ========== */
.otp-inputs {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    direction: ltr; /* اعداد همیشه LTR */
}

.otp-inputs input {
    width: 3.5rem;
    height: 4rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 0.75rem;
    border: 2px solid #cfd8dc;
    background: #fafafa;
    transition: all 0.2s;
}

.otp-inputs input:focus {
    border-color: #1976d2;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
    transform: scale(1.05);
}

/* ========== واکنش‌گرایی موبایل ========== */
@media (max-width: 640px) {
    body.auth-page {
        padding: 0.75rem;
        align-items: center;
    }

    .auth-container {
        max-width: 100%;
    }

    .auth-card {
        padding: 1.8rem 1.2rem;
        gap: 1rem;
        border-radius: 1.2rem;
    }

    .auth-logo img {
        height: 4rem;
    }

    .welcome-title {
        font-size: 1.25rem;
    }

    .btn-sabz,
    .btn-outline-sabz {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .otp-inputs input {
        width: 3rem;
        height: 3.5rem;
        font-size: 1.3rem;
    }
}

@media (max-width: 400px) {
    .auth-card {
        padding: 1.5rem 1rem;
    }
}