:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f59e0b;
    --text-color: #1e293b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: 1px solid rgba(255, 255, 255, 0.7);
    --blur-effect: blur(15px);
    --text-dark: #4a423b;
    --text-light: #6b5f58;
    --accent-color: #ff8c42;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 80% 0%, hsla(189, 100%, 56%, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(355, 100%, 93%, 0.1) 0px, transparent 50%);
    /* این فاصله برای این است که محتوای صفحه زیر هدر ثابت قرار نگیرد */
    padding-top: 80px;
}

/* --- کدهای مربوط به هدر --- */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 4%;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border-bottom: var(--glass-border);
    z-index: 1000;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-button {
    background-color: #ffdab9;
    color: var(--text-dark);
    border: none;
    padding: 10px 22px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-button:hover {
    background-color: #ffcba4;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.nav-left a {
    text-decoration: none;
}

.nav-left .icon {
    font-size: 26px;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s;
}

.nav-left .icon:hover {
    color: var(--text-dark);
}

.menu-icon {
    font-size: 26px;
    color: var(--text-light);
    cursor: pointer;
    display: none; /* در حالت دسکتاپ مخفی است */
}

/* --- کدهای مربوط به منوی موبایل --- */
.mobile-nav {
    position: fixed;
    top: 0;
    left: -100%; /* برای شروع از خارج صفحه در حالت LTR */
    width: 300px;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    z-index: 1001;
    transition: left 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    padding: 25px;
    display: flex;
    flex-direction: column;
}

html[dir="rtl"] .mobile-nav {
    right: -100%; /* در حالت فارسی، منو از راست باز می‌شود */
    left: auto;
    transition: right 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.mobile-nav.is-open {
    left: 0;
}

html[dir="rtl"] .mobile-nav.is-open {
    right: 0;
    left: auto;
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.mobile-nav-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
}

.close-menu-btn {
    font-size: 28px;
    cursor: pointer;
    color: var(--text-dark);
}

.mobile-nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-links li a {
    display: block;
    padding: 15px 10px;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-dark);
    border-radius: 10px;
    transition: all 0.3s;
}

.mobile-nav-links li a:hover {
    background-color: rgba(255, 140, 66, 0.2);
    color: var(--accent-color);
}

.mobile-nav-links li a i {
    margin-left: 15px;
    width: 25px;
}

/* --- استایل‌های واکنش‌گرا --- */
@media (max-width: 768px) {
    .nav-left {
        display: none; /* منوی دسکتاپ در موبایل مخفی می‌شود */
    }
    .menu-icon {
        display: block; /* آیکون همبرگری در موبایل نمایش داده می‌شود */
    }
}

/* Language Selector */
.language-selector {
    position: fixed;
    top: 25px;
    left: 25px;
    z-index: 100;
    display: flex;
    gap: 10px;
}

.language-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: var(--transition);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    gap: 5px;
}

.language-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.language-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Floating Background Elements */
.floating-element {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.6;
    z-index: -1;
    animation: float 15s infinite ease-in-out;
}

.floating-element:nth-child(1) {
    width: 300px;
    height: 300px;
    background: var(--primary-color);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.floating-element:nth-child(2) {
    width: 200px;
    height: 200px;
    background: var(--secondary-color);
    bottom: 50px;
    left: -50px;
    animation-delay: 3s;
}

.floating-element:nth-child(3) {
    width: 150px;
    height: 150px;
    background: var(--success-color);
    top: 50%;
    left: 30%;
    animation-delay: 6s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(50px, 50px);
    }
}

/* Welcome Text */
.welcome-container {
    margin-bottom: 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.welcome-text {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #6366f1, #f59e0b, #10b981, #ef4444);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient 8s ease infinite, typing 2.5s steps(30, end);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    display: inline-block;
    padding: 0 10px;
}

.welcome-text::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: var(--text-color);
    animation: blink 0.7s infinite;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.welcome-subtext {
    font-size: 1.2rem;
    color: #64748b;
    margin-top: 20px;
    opacity: 0;
    animation: fadeIn 1s ease 2s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Auth Container */
.auth-container {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 50px;
    width: 100%;
    max-width: 500px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #6366f1, #f59e0b, #10b981);
    animation: gradient 8s ease infinite;
}

.form-title {
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
    color: var(--primary-color);
    position: relative;
    display: inline-block;
}

.form-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), transparent);
    border-radius: 3px;
}

/* Form Styles */
.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    position: absolute;
    top: 18px;
    right: 20px;
    color: #94a3b8;
    transition: var(--transition);
    pointer-events: none;
    background: var(--card-bg);
    padding: 0 5px;
    border-radius: 5px;
}

.form-group input {
    width: 100%;
    padding: 18px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.7);
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label {
    top: -10px;
    right: 15px;
    font-size: 0.8rem;
    color: var(--primary-color);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px var(--card-bg);
}

.password-container {
    position: relative;
}

.toggle-password {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    cursor: pointer;
    color: #94a3b8;
    transition: var(--transition);
    background: none;
    border: none;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.toggle-password:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.strength-meter {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
    position: relative;
}

.strength-meter-fill {
    height: 100%;
    width: 0;
    background: var(--error-color);
    transition: var(--transition);
    border-radius: 3px;
}

.error-message {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 8px;
    display: none;
}

.success-message {
    color: var(--success-color);
    font-size: 0.85rem;
    margin-top: 8px;
    display: none;
}

.switch-form {
    text-align: center;
    margin-top: 25px;
    font-size: 0.95rem;
}

.switch-form a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: var(--transition);
}

.switch-form a:hover {
    color: var(--primary-dark);
}

.switch-form a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.switch-form a:hover::after {
    width: 100%;
}

/* Button Styles */
.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    background: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

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

.btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loading .btn-text {
    visibility: hidden;
    opacity: 0;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Forgot Password Link */
.forgot-password {
    text-align: left;
    margin-top: 15px;
}

.forgot-password a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.forgot-password a:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    padding: 5px;
    border-radius: 5px;
}

/* Google Sign-in Button */
.google-signin-btn {
    width: 100%;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #757575;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.google-signin-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.google-signin-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.google-signin-btn img {
    width: 20px;
    height: 20px;
}

/* Divider Styles */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 25px 0;
    color: #64748b;
    font-size: 0.9rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.divider::before {
    margin-left: 10px;
}

.divider::after {
    margin-right: 10px;
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 30px 20px;
    color: #64748b;
    font-size: 0.9rem;
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

footer p {
    margin-bottom: 10px;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

footer a:hover {
    color: var(--primary-dark);
    background: rgba(99, 102, 241, 0.05);
    padding: 5px;
    border-radius: 5px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.4s ease;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    transition: var(--transition);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal:hover {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

/* Terms Modal */
.terms-container {
    max-height: 50vh;
    overflow-y: auto;
    margin: 25px 0;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.5);
}

.terms-container h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.terms-container p {
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #475569;
}

.checkbox-container {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.checkbox-container input {
    margin-left: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.checkbox-container label {
    font-size: 0.95rem;
    color: #475569;
    cursor: pointer;
}

/* Admin Verification Modal */
.admin-verification {
    text-align: center;
}

.admin-verification p {
    margin-bottom: 25px;
    color: #475569;
}

.admin-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 15px;
}

.admin-actions .btn {
    width: 100%;
}

.btn-secondary {
    background: #64748b;
}

.btn-secondary:hover {
    background: #475569;
}

/* Verification Code Modal */
.verification-container {
    text-align: center;
}

.verification-container p {
    margin-bottom: 25px;
    color: #475569;
}

.verification-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 15px;
}

.verification-actions .btn {
    width: 100%;
}

.timer-container {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.timer-text {
    font-size: 0.9rem;
    color: #64748b;
}

.resend-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}

.resend-btn:disabled {
    color: #94a3b8;
    cursor: not-allowed;
    text-decoration: none;
}

/* Password Reset Modal */
.reset-password-container {
    text-align: center;
}

.reset-password-container p {
    margin-bottom: 25px;
    color: #475569;
}

.reset-password-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 15px;
}

.reset-password-actions .btn {
    width: 100%;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .welcome-text {
        font-size: 2.5rem;
    }
    
    .auth-container {
        padding: 40px 25px;
    }
    
    .form-title {
        font-size: 1.7rem;
    }
}

@media (max-width: 480px) {
    .welcome-text {
        font-size: 2rem;
        white-space: normal;
        animation: gradient 8s ease infinite, fadeIn 1s ease;
    }
    
    .welcome-text::after {
        display: none;
    }
    
    .auth-container {
        padding: 30px 20px;
    }
    
    .container {
        padding: 30px 15px;
    }
}

/* RTL/LTR Direction Handling */
[dir="rtl"] .form-group label {
    right: auto;
    left: 20px;
}

[dir="rtl"] .form-group input:focus + label,
[dir="rtl"] .form-group input:not(:placeholder-shown) + label {
    right: auto;
    left: 15px;
}

[dir="rtl"] .toggle-password {
    left: auto;
    right: 20px;
}

[dir="rtl"] .checkbox-container input {
    margin-left: 0;
    margin-right: 12px;
}

[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

[dir="ltr"] .welcome-text {
    animation: gradient 8s ease infinite, typing-en 2.5s steps(30, end);
}

[dir="ltr"] .form-title::after {
    left: auto;
    right: 0;
    background: linear-gradient(270deg, var(--primary-color), transparent);
}

@keyframes typing-en {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}