/* ==========================================================
   صفحات احراز هویت (Login & Signup) — تترگیم
   فایل: login.css
   این فایل بین login.html و signup.html مشترک است.
   طراحی: کارت شیشه‌ای (Glassmorphism) روی یک منظره‌ی کوهستانی
   با گرادیان بنفش، هماهنگ با طرح مرجع درخواستی.
   ========================================================== */

:root {
    --color-primary: #4c3a8f;
    --color-primary-soft: rgba(255, 255, 255, 0.75);
    --color-danger: #ffb4b4;
    --color-text: #ffffff;
    --color-text-muted: rgba(255, 255, 255, 0.78);
    --radius-lg: 28px;
    --radius-pill: 999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    position: relative;
    overflow-x: hidden;
}

/* ==========================================================
   پس‌زمینه‌ی منظره‌ای: گرادیان بنفش + کوه‌های سایه‌روشن + پرنده‌ها
   ========================================================== */
.bg-scene {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(150deg, #dce6d6 0%, #b7addd 26%, #9382cf 48%, #6752b8 70%, #40316f 100%);
}

.bg-scene .mountain {
    position: absolute;
    left: 0;
    bottom: -4%;
    width: 100%;
}

.bg-scene .mountain-back {
    height: 58%;
    background: #7462c2;
    opacity: 0.55;
    clip-path: polygon(0% 100%, 0% 42%, 10% 58%, 24% 18%, 37% 50%, 51% 8%, 66% 46%, 80% 14%, 100% 44%, 100% 100%);
}

.bg-scene .mountain-mid {
    height: 48%;
    background: #5b48ab;
    opacity: 0.75;
    clip-path: polygon(0% 100%, 0% 62%, 14% 40%, 28% 68%, 44% 30%, 58% 62%, 74% 22%, 88% 55%, 100% 32%, 100% 100%);
}

.bg-scene .mountain-front {
    height: 38%;
    background: #3a2d72;
    clip-path: polygon(0% 100%, 0% 58%, 16% 78%, 32% 42%, 48% 70%, 63% 32%, 78% 64%, 92% 38%, 100% 60%, 100% 100%);
}

.bird {
    position: absolute;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0.85;
}

.bird-1 { top: 6%; right: 12%; width: 26px; }
.bird-2 { top: 3%; right: 20%; width: 18px; }
.bird-3 { top: 9%; left: 22%; width: 16px; transform: scaleX(-1); }

/* ==========================================================
   کارت شیشه‌ای فرم (Glassmorphism)
   ========================================================== */
.auth-card {
    position: relative;
    z-index: 1;
    width: min(400px, 100%);
    padding: 40px 30px 32px;
    border-radius: var(--radius-lg);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 24px 60px rgba(25, 15, 55, 0.35);
}

.auth-title {
    text-align: center;
    font-size: 1.65rem;
    font-weight: 800;
    margin-bottom: 30px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.2);
}

#login-form,
#signup-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- فیلدهای ورودی (شیشه‌ای، کپسولی) --- */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap input {
    width: 100%;
    background: rgba(255, 255, 255, 0.16);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-pill);
    padding: 15px 46px 15px 18px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text);
    text-align: right;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input-wrap input::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

.input-wrap input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.field.has-error .input-wrap input {
    border-color: var(--color-danger);
}

.field.has-error .input-wrap input:focus {
    box-shadow: 0 0 0 4px rgba(255, 180, 180, 0.2);
}

.field-icon {
    position: absolute;
    right: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.9);
    pointer-events: none;
    display: flex;
}

#password,
#confirm-password {
    padding-left: 18px;
}

.hidden {
    display: none;
}

.field-error {
    min-height: 15px;
    font-size: 0.74rem;
    color: var(--color-danger);
    padding: 0 6px;
}

.inline-link {
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.78rem;
    white-space: nowrap;
    opacity: 0.92;
}

.inline-link:hover {
    text-decoration: underline;
}

.inline-link.strong {
    font-weight: 700;
    font-size: 0.88rem;
}

/* --- ردیف «به خاطر بسپار» + «فراموشی رمز» --- */
.form-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: -4px;
}

/* --- چک‌باکس سفارشی (نسخه‌ی شیشه‌ای) --- */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
    line-height: 1.5;
}

.checkbox-row input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-box {
    width: 17px;
    height: 17px;
    border-radius: 5px;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.checkbox-row input:checked + .checkbox-box {
    background: #ffffff;
    border-color: #ffffff;
}

.checkbox-row input:checked + .checkbox-box::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 5px;
    height: 9px;
    border: solid var(--color-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(35deg) translate(-1px, -1px);
}

.checkbox-row input:focus-visible + .checkbox-box {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* --- دکمه‌ی اصلی (سفید، کپسولی) --- */
.submit-btn {
    position: relative;
    background: #ffffff;
    color: var(--color-primary);
    font-family: inherit;
    font-weight: 800;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-pill);
    padding: 15px 20px;
    cursor: pointer;
    margin-top: 6px;
    transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 10px 26px rgba(20, 10, 45, 0.3);
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(20, 10, 45, 0.38);
}

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

.submit-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.submit-btn.loading .btn-label {
    opacity: 0;
}

.submit-btn.loading {
    pointer-events: none;
}

.btn-spinner {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2.5px solid rgba(76, 58, 143, 0.3);
    border-top-color: var(--color-primary);
    opacity: 0;
}

.submit-btn.loading .btn-spinner {
    opacity: 1;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.form-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    min-height: 16px;
}

.signup-hint {
    text-align: center;
    font-size: 0.86rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.terms-row {
    align-items: flex-start;
}

.terms-row .checkbox-box {
    margin-top: 2px;
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 420px) {
    .auth-card {
        padding: 32px 22px 26px;
    }

    .auth-title {
        font-size: 1.4rem;
        margin-bottom: 24px;
    }
}

/* --- احترام به تنظیم کاهش انیمیشن کاربر --- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
