/* ============================================================
   RADITONE AUTH
   ظاهر صفحه ورود / ثبت‌نام / فراموشی رمز

   نکتهٔ مهم: در این فایل هیچ رنگی ثابت نوشته نشده است. تمام رنگ‌ها از
   متغیرهایی می‌آیند که PHP آن‌ها را از تنظیمات قالب پر می‌کند
   (`raditone-auth-vars` در my-account.php). بنابراین تغییر رنگ‌ها از
   پیشخوان، بدون دست‌زدن به CSS، روی این صفحه هم اعمال می‌شود.

   حالت روشن/تاریک را مدیر از تنظیمات قالب انتخاب می‌کند
   (`auth_theme_mode`) و کاربر امکان تغییر آن را ندارد؛ به همین دلیل هیچ
   کلاس یا صفت وابسته به localStorage اینجا وجود ندارد.
   ============================================================ */

/* ============================================================
   متغیرهای پایه (fallback)
   فقط وقتی استفاده می‌شوند که بلوک PHP در صفحه نبوده باشد
   ============================================================ */

:root {
    --auth-bg: #f4f6ff;
    --auth-bg-2: #ffffff;

    --auth-card-bg: rgba(255, 255, 255, 0.84);
    --auth-card-border: rgba(15, 23, 42, 0.10);
    --auth-card-sheen: rgba(255, 255, 255, 0.65);

    --auth-text: #111426;
    --auth-text-2: #60677f;
    --auth-text-3: #858ba0;

    --auth-input-bg: rgba(15, 23, 42, 0.035);
    --auth-input-border: rgba(15, 23, 42, 0.12);
    --auth-input-focus-bg: rgba(99, 102, 241, 0.05);

    --auth-primary: #6366f1;
    --auth-primary-hover: #4f46e5;
    --auth-primary-2: #8b5cf6;
    --auth-primary-3: #06b6d4;
    --auth-primary-4: #ec4899;
    --auth-on-primary: #ffffff;

    --auth-link: #6366f1;
    --auth-link-hover: #06b6d4;

    --auth-danger: #ef4444;
    --auth-danger-bg: rgba(239, 68, 68, 0.08);
    --auth-danger-border: rgba(239, 68, 68, 0.20);

    --auth-success: #10b981;
    --auth-success-bg: rgba(16, 185, 129, 0.08);
    --auth-success-border: rgba(16, 185, 129, 0.20);

    --auth-shadow: 0 30px 80px rgba(30, 27, 75, 0.15);
    --auth-shadow-btn: 0 10px 30px rgba(99, 102, 241, 0.30);
    --auth-shadow-btn-hover: 0 15px 40px rgba(99, 102, 241, 0.45);
    --auth-glow-1: rgba(99, 102, 241, 0.20);
    --auth-glow-2: rgba(6, 182, 212, 0.16);
    --auth-glow-3: rgba(236, 72, 153, 0.14);

    --auth-radius-xl: 30px;
    --auth-radius-lg: 18px;
    --auth-radius-md: 13px;

    --auth-transition: 0.3s ease;
    --auth-gradient: linear-gradient(100deg,
            var(--auth-primary-3) 0%,
            var(--auth-primary) 34%,
            var(--auth-primary-2) 67%,
            var(--auth-primary-4) 100%);
}

/* ============================================================
   RESET
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;

    font-family: var(--font-iranyekan, Tahoma, Arial, sans-serif);
    font-size: 14px;
    line-height: 1.9;

    color: var(--auth-text);

    background-color: var(--auth-bg);
    background-image:
        radial-gradient(circle at 15% 20%, var(--auth-glow-1) 0%, transparent 28%),
        radial-gradient(circle at 85% 15%, var(--auth-glow-2) 0%, transparent 25%),
        radial-gradient(circle at 50% 100%, var(--auth-glow-3) 0%, transparent 35%);

    background-attachment: fixed;

    overflow-x: hidden;

    transition: background-color var(--auth-transition), color var(--auth-transition);
}

button,
input {
    font-family: inherit;
    font-size: inherit;
}

button {
    cursor: pointer;
}

a {
    color: var(--auth-link);
    text-decoration: none;
    transition: color var(--auth-transition);
}

a:hover {
    color: var(--auth-link-hover);
}

.icon {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

/* ============================================================
   هاله‌های پس‌زمینه
   ============================================================ */

.auth-background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.auth-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
}

.auth-glow-1 {
    width: 350px;
    height: 350px;
    background: var(--auth-primary);
    top: -120px;
    right: -100px;
}

.auth-glow-2 {
    width: 300px;
    height: 300px;
    background: var(--auth-primary-3);
    bottom: -100px;
    left: -80px;
}

.auth-glow-3 {
    width: 240px;
    height: 240px;
    background: var(--auth-primary-2);
    top: 45%;
    left: 45%;
}

/* ============================================================
   چیدمان
   ============================================================ */

.auth-container {
    position: relative;
    z-index: 1;

    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px 20px 70px;
}

/* ============================================================
   کارت
   ============================================================ */

.auth-card {
    width: 100%;
    max-width: 470px;
    padding: 38px;
    position: relative;

    border-radius: var(--auth-radius-xl);

    background:
        linear-gradient(145deg,
            var(--auth-card-sheen) 0%,
            transparent 60%),
        var(--auth-card-bg);

    border: 1px solid var(--auth-card-border);

    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);

    box-shadow: var(--auth-shadow);

    overflow: hidden;

    animation: authCardAppear 0.8s ease forwards;
}

.auth-card::before {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    top: -100px;
    right: -80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--auth-glow-1) 0%, transparent 70%);
    pointer-events: none;
}

.auth-card::after {
    content: "";
    position: absolute;
    width: 150px;
    height: 150px;
    bottom: -90px;
    left: -70px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--auth-glow-2) 0%, transparent 70%);
    pointer-events: none;
}

@keyframes authCardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================================
   سربرگ کارت + لوگو
   ============================================================ */

.auth-header {
    text-align: center;
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 18px;

    max-width: 100%;
}

.auth-logo img,
.auth-logo .custom-logo {
    display: block;
    max-width: 190px;
    max-height: 52px;
    width: auto;
    height: auto;

    margin: 0 auto;

    object-fit: contain;
}

.auth-logo .auth-logo-text {
    font-size: 27px;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--auth-text);
}

.auth-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--auth-text);
}

.auth-subtitle {
    color: var(--auth-text-2);
    font-size: 13px;
    line-height: 2;
}

/* ============================================================
   فرم‌ها
   ============================================================ */

#loginForm,
#forgotForm {
    position: relative;
    z-index: 1;
    animation: authFormAppear 0.35s ease;
}

@keyframes authFormAppear {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.form-group {
    margin-bottom: 17px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 7px;

    margin-bottom: 8px;

    color: var(--auth-text-2);
    font-size: 12px;
    font-weight: 600;
}

.form-label .icon {
    color: var(--auth-text-3);
    transition: color var(--auth-transition);
}

.form-group:focus-within .form-label .icon {
    color: var(--auth-primary);
}

.form-input {
    width: 100%;
    height: 52px;
    padding: 0 16px;

    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius-md);
    outline: none;

    color: var(--auth-text);
    background: var(--auth-input-bg);

    font-size: 13px;

    transition:
        border-color var(--auth-transition),
        box-shadow var(--auth-transition),
        background var(--auth-transition);
}

.form-input::placeholder {
    color: var(--auth-text-3);
}

.form-input:focus {
    border-color: var(--auth-primary);
    background: var(--auth-input-focus-bg);
    box-shadow:
        0 0 0 3px var(--auth-input-focus-bg),
        0 0 25px var(--auth-input-focus-bg);
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--auth-text-3);
    font-size: 11px;
}

/* نمایش / پنهان‌کردن رمز */
.auth-input-wrap {
    position: relative;
}

.auth-input-wrap .form-input {
    padding-left: 46px;
}

.auth-eye {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);

    display: flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;
    padding: 0;

    border: none;
    background: transparent;
    color: var(--auth-text-3);

    transition: color var(--auth-transition);
}

.auth-eye:hover,
.auth-eye:focus-visible {
    color: var(--auth-primary);
    outline: none;
}

.auth-eye .icon {
    width: 16px;
    height: 16px;
}

.auth-eye .icon[hidden] {
    display: none;
}

/* ============================================================
   چک‌باکس و یادآوری
   ============================================================ */

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;

    margin: 7px 0 20px;

    color: var(--auth-text-2);
    font-size: 12px;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

/* ============================================================
   دکمهٔ اصلی
   ============================================================ */

.btn-primary {
    width: 100%;
    height: 53px;

    border: none;
    border-radius: 14px;

    color: var(--auth-on-primary);
    background: var(--auth-gradient);
    background-size: 300% 100%;

    font-size: 14px;
    font-weight: 800;

    position: relative;
    overflow: hidden;

    box-shadow: var(--auth-shadow-btn);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        filter 0.25s ease;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--auth-shadow-btn-hover);
    filter: saturate(1.1);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-primary:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 3px;
}

/* اسپینر حالت در حال ارسال */
.loading-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-left: 8px;

    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;

    vertical-align: -2px;

    animation: authSpin 0.7s linear infinite;
}

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

/* ============================================================
   یادداشت امنیتی
   ============================================================ */

.security-note {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-top: 18px;
    padding: 11px 14px;

    border-radius: var(--auth-radius-md);
    border: 1px solid var(--auth-card-border);
    background: var(--auth-input-bg);

    color: var(--auth-text-3);
    font-size: 11px;
    line-height: 1.8;
}

.security-note .icon {
    color: var(--auth-success);
}

/* ============================================================
   جداکننده و ورود با شبکه‌های اجتماعی
   ============================================================ */

.divider {
    display: flex;
    align-items: center;
    gap: 12px;

    margin: 25px 0 20px;

    color: var(--auth-text-3);
    font-size: 10px;
}

.divider::before,
.divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--auth-input-border);
}

.social-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-width: 48px;
    height: 48px;
    padding: 0 16px;

    border: 1px solid var(--auth-input-border);
    border-radius: 14px;

    background: var(--auth-input-bg);
    color: var(--auth-text);

    font-size: 13px;

    transition:
        transform var(--auth-transition),
        border-color var(--auth-transition),
        box-shadow var(--auth-transition),
        color var(--auth-transition);
}

.social-btn:hover {
    transform: translateY(-3px);
    border-color: var(--auth-primary);
    box-shadow: var(--auth-shadow-btn);
    color: var(--auth-text);
}

.social-btn .icon {
    width: 17px;
    height: 17px;
}

/* ============================================================
   لینک‌های پایین فرم
   ============================================================ */

.links-row {
    display: flex;
    justify-content: center;
    gap: 15px;

    margin-top: 22px;

    font-size: 12px;
    font-weight: 600;
}

.links-row a {
    color: var(--auth-link);
    transition: color var(--auth-transition);
}

.links-row a:hover {
    color: var(--auth-link-hover);
}

/* ============================================================
   پیام‌ها
   ============================================================ */

.auth-footer {
    text-align: center;
    margin-top: 26px;
    color: var(--auth-text-3);
    font-size: 10px;
}

/* ============================================================
   توست
   ============================================================ */

.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;

    display: flex;
    flex-direction: column;
    gap: 10px;

    max-width: min(92vw, 380px);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    padding: 13px 16px;

    border-radius: var(--auth-radius-md);
    border: 1px solid var(--auth-card-border);

    background: var(--auth-card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);

    color: var(--auth-text);
    box-shadow: var(--auth-shadow);

    font-size: 12px;
    line-height: 1.8;

    animation: authToastIn 0.3s ease forwards;
}

.toast .toast-message {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.toast .icon {
    margin-top: 2px;
    flex: 0 0 auto;
}

.toast.success {
    border-color: var(--auth-success-border);
    background: var(--auth-success-bg);
    color: var(--auth-success);
}

.toast.error {
    border-color: var(--auth-danger-border);
    background: var(--auth-danger-bg);
    color: var(--auth-danger);
}

@keyframes authToastIn {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes authToastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(16px);
    }
}

/* ============================================================
   کپچا
   ============================================================ */

.auth-card .rt-captcha {
    margin-bottom: 17px;
}

/* ============================================================
   واکنش‌گرا
   ============================================================ */

@media (max-width: 600px) {
    .auth-container {
        padding: 15px;
    }

    .auth-card {
        padding: 28px 20px;
        border-radius: 24px;
    }

    .auth-logo img,
    .auth-logo .custom-logo {
        max-width: 150px;
        max-height: 42px;
    }

    .auth-logo .auth-logo-text {
        font-size: 23px;
    }

    .auth-title {
        font-size: 20px;
    }

    .form-input {
        height: 50px;
    }

    .btn-primary {
        height: 51px;
    }
}

@media (max-width: 380px) {
    .auth-card {
        padding: 24px 16px;
    }

    .links-row {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

/* ============================================================
   احترام به کاهش حرکت
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {

        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
