/* ========================================
   LOGIN PAGE - Votify
   ======================================== */

/* --- متغیرهای پایه --- */
:root {
    --primary: #6366f1;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --bg-dark: #0f0f23;
    --bg-darker: #070714;
    --bg-card: rgba(255, 255, 255, 0.03);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --border: rgba(255, 255, 255, 0.1);
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 60px rgba(99, 102, 241, 0.3);
    --font: 'Vazirmatn', system-ui, sans-serif;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- ریست و پایه --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font);
    background: linear-gradient(180deg, var(--bg-dark), var(--bg-darker));
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- پس‌زمینه ذرات --- */
#particlesCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- صفحه --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    position: relative;
    z-index: 1;
}

/* --- کارت --- */
.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-card);
    animation: fadeInUp 0.6s var(--ease-out-expo);
}

/* --- آیکون --- */
.auth-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--space-lg);
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.auth-icon svg {
    width: 36px;
    height: 36px;
    color: white;
}

/* --- عنوان --- */
.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--text-primary);
}

/* --- فرم --- */
.auth-card form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input[type="tel"],
.form-group input[type="text"] {
    width: 100%;
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font);
    transition: all 0.3s ease;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* --- ورودی‌های OTP --- */
.otp-wrapper {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    direction: ltr;  /* ← این خط اضافه شود */
}

.otp-wrapper input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    transition: all 0.3s ease;
}

.otp-wrapper input::placeholder {
    color: var(--text-muted);
}

.otp-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.otp-wrapper input.filled {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

/* --- دکمه اصلی --- */
.btn {
    width: 100%;
    height: 52px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--ease-out-expo);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading .btn-loader {
    opacity: 1;
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: spin 0.8s linear infinite;
}

/* --- پیام‌ها --- */
.msg {
    text-align: center;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-top: var(--space-md);
    animation: fadeIn 0.3s ease;
    display: none;
}

.msg.show {
    display: block;
}

.msg.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.msg.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- دکمه بازگشت --- */
.btn-back {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
    transition: all 0.3s ease;
}

.btn-back svg {
    width: 20px;
    height: 20px;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* --- اطلاعات مرحله --- */
.step-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: var(--space-lg);
}

/* --- ارسال مجدد --- */
.btn-resend {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font);
    cursor: pointer;
    padding: var(--space-md);
    margin-top: var(--space-md);
    transition: color 0.3s ease;
    text-align: center;
}

.btn-resend:hover:not(:disabled) {
    color: var(--primary);
}

.btn-resend:disabled {
    cursor: not-allowed;
}

/* --- کلاس‌های کمکی --- */
.hidden {
    display: none !important;
}

/* --- انیمیشن‌ها --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- ریسپانسیو --- */
@media (max-width: 480px) {
    .auth-page {
        padding: var(--space-lg);
    }

    .auth-card {
        padding: var(--space-xl);
    }

    .otp-wrapper {
        gap: var(--space-xs);
    }

    .otp-wrapper input {
        width: 40px;
        height: 48px;
        font-size: 1.25rem;
    }
}

@media (max-width: 360px) {
    .otp-wrapper input {
        width: 36px;
        height: 44px;
        font-size: 1.1rem;
    }
}