@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap');

:root {
    --primary: #1a1f2e;
    --primary-dark: #0f131c;
    --secondary: #252b3d;
    --accent: #00d4aa;
    --accent-hover: #00f0c0;
    --accent-glow: rgba(0, 212, 170, 0.3);
    --text: #ffffff;
    --text-muted: #a0aec0;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--primary-dark) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    direction: rtl;
    color: var(--text);
}

.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-glow), transparent);
    animation: float 25s infinite ease-in-out;
}

.floating-shape:nth-child(1) {
    width: 300px;
    height: 300px;
    top: -5%;
    right: -5%;
    animation-delay: 0s;
    opacity: 0.4;
}

.floating-shape:nth-child(2) {
    width: 200px;
    height: 200px;
    bottom: 10%;
    left: -5%;
    animation-delay: 5s;
    opacity: 0.3;
}

.floating-shape:nth-child(3) {
    width: 150px;
    height: 150px;
    top: 40%;
    right: 30%;
    animation-delay: 10s;
    opacity: 0.2;
}

.floating-shape:nth-child(4) {
    width: 100px;
    height: 100px;
    bottom: 30%;
    right: 10%;
    animation-delay: 15s;
    opacity: 0.25;
}

.floating-shape:nth-child(5) {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 20%;
    animation-delay: 8s;
    opacity: 0.2;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        transform: translate(30px, -30px) rotate(90deg) scale(1.1);
    }
    50% {
        transform: translate(-20px, 20px) rotate(180deg) scale(0.95);
    }
    75% {
        transform: translate(20px, 10px) rotate(270deg) scale(1.05);
    }
}

.container {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    gap: 40px;
    align-items: center;
    justify-content: center;
}

.container.centered {
    justify-content: center;
}

.container.centered .form-container {
    max-width: 450px;
}

@media (max-width: 992px) {
    .container {
        flex-direction: column-reverse;
        padding: 20px 15px;
        gap: 30px;
    }
}

.form-container {
    flex: 1;
    max-width: 480px;
    width: 100%;
}

.main {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}

.nav-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.nav-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--accent), #00b894);
    color: var(--primary);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

.form-header {
    margin-bottom: 30px;
    text-align: center;
}

.form-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.form-header p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

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

.form-group label {
    display: block;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 15px;
    transition: var(--transition);
    direction: ltr;
    text-align: right;
}

.form-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.helper-text {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.password-wrapper {
    position: relative;
}

.form-footer {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--accent), #00b894);
    border: none;
    border-radius: 12px;
    color: var(--primary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

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

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.link-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 12px 20px;
    color: var(--text-muted);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.link-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0, 212, 170, 0.1);
}

.otp-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: rgba(0, 212, 170, 0.1);
    border-radius: 10px;
    margin-top: 15px;
    border: 1px solid rgba(0, 212, 170, 0.2);
}

.otp-timer {
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
}

.message {
    display: none;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-top: 20px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.show {
    display: block;
}

.message-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.message-content p {
    font-size: 14px;
    margin: 0;
}

.success-message {
    background: rgba(40, 167, 69, 0.15);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: #4ade80;
}

.error-message {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #f87171;
}

.image-container {
    flex: 1;
    max-width: 550px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-box {
    text-align: center;
    padding: 40px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.3);
    border-radius: 50px;
    margin-bottom: 30px;
}

.hero-badge span:first-child {
    color: var(--accent);
    font-weight: 700;
    font-size: 16px;
}

.badge-pill {
    background: var(--accent);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.hero-title {
    font-size: 42px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 20px;
    line-height: 1.3;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 17px;
    line-height: 1.8;
    margin-bottom: 35px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
}

.feature-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.feature-chip:hover {
    border-color: var(--accent);
    background: rgba(0, 212, 170, 0.1);
}

.feature-chip::before {
    content: '✓';
    color: var(--accent);
    font-weight: 700;
}

.game-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.game-card {
    width: 140px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.game-card:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.game-card svg {
    display: block;
}

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

.loading .submit-btn::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

@media (max-width: 992px) {
    .image-container {
        max-width: 100%;
    }
    
    .image-box {
        padding: 20px;
    }
    
    .hero-title {
        font-size: 32px;
    }
    
    .hero-subtitle {
        font-size: 15px;
    }
    
    .game-cards {
        display: none;
    }
}

@media (max-width: 576px) {
    .main {
        padding: 25px 20px;
    }
    
    .nav-btn {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .form-header h2 {
        font-size: 20px;
    }
    
    .form-group input {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .submit-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .hero-title {
        font-size: 26px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .hero-features {
        gap: 8px;
    }
    
    .feature-chip {
        padding: 8px 14px;
        font-size: 12px;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

::selection {
    background: var(--accent);
    color: var(--primary);
}
