/* =========================
 *  پایه و متغیرها
 * ========================= */

:root {
    --bg: #0b1220;
    --bg-2: #0f1a2f;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-strong: rgba(15, 23, 42, 0.95);
    --border: rgba(255, 255, 255, 0.08);

    --text: #f5f7fb;
    --muted: #9bb4d3;

    --primary: #12b4ff;
    --primary-soft: rgba(18, 180, 255, 0.14);

    --accent: #23e0b3;
    --accent-soft: rgba(35, 224, 179, 0.16);

    --danger: #ff6b6b;
    --danger-soft: rgba(255, 107, 107, 0.18);

    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.6);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Vazirmatn', 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at 20% 20%, rgba(18, 180, 255, 0.12), transparent 35%),
        radial-gradient(circle at 80% 10%, rgba(35, 224, 179, 0.12), transparent 30%),
        linear-gradient(145deg, #0b1220 0%, #0f172a 50%, #0c1628 100%);
    color: var(--text);
    direction: rtl;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(18, 180, 255, 0.3);
    color: #e5f7ff;
}

.bg-dark-ink {
    background: var(--bg);
}

/* =========================
 *  لینک‌ها و متن
 * ========================= */

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-normal);
}

a:hover {
    color: #7dd3ff;
}

.muted {
    color: var(--muted);
}

.neon {
    color: var(--primary);
    text-shadow: 0 0 12px rgba(18, 180, 255, 0.35);
}

.text-light-50 {
    color: rgba(245, 247, 251, 0.75);
}

/* =========================
 *  ناوبار و هدر
 * ========================= */

.navbar {
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.navbar .nav-link {
    font-size: 0.95rem;
    color: var(--muted);
    transition: color var(--transition-fast), opacity var(--transition-fast);
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--text);
    opacity: 1;
}

.logo-badge {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #0079ff);
    color: #0b1220;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(18, 180, 255, 0.35);
}

.avatar-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(35, 224, 179, 0.55);
}

/* =========================
 *  کامپوننت‌های عمومی
 * ========================= */

.badge-soft {
    padding: 0.35rem 0.7rem;
    border-radius: 12px;
    background: rgba(18, 180, 255, 0.12);
    color: #a7deff;
    font-size: 0.8rem;
}

/* تگ کوچک خنثی اگر لازم شد */
.badge-soft-neutral {
    background: rgba(148, 163, 184, 0.22);
    color: #e5e7eb;
}

.pill {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* پنل‌های شیشه‌ای */

.glassy,
.glass-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.glassy {
    padding: 1.25rem;
}

.glass-panel {
    padding: 1.25rem;
}

/* سکشن‌های قهرمان / هِرو */

.hero {
    border-radius: var(--radius-xl);
    padding: 1.6rem;
    background: linear-gradient(
        135deg,
        rgba(18, 180, 255, 0.16),
        rgba(35, 224, 179, 0.16)
    );
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow);
}

/* عنوان سکشن‌ها */

.section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.section-title span {
    padding: 0.35rem 0.65rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #b9c7df;
    font-size: 0.9rem;
}

/* =========================
 *  کارت‌ها و گرید
 * ========================= */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.card-game {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.07)
    );
    padding: 1rem;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-fast);
    cursor: pointer;
}

.card-game:hover {
    transform: translateY(-4px);
    border-color: rgba(125, 211, 252, 0.7);
    box-shadow: var(--shadow);
}

/* کارت‌های اتاق در لابی TTT */

.room-card {
    border-radius: 16px;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.room-card:hover {
    border-color: rgba(56, 189, 248, 0.7);
    background: rgba(15, 23, 42, 0.99);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.8);
}

/* =========================
 *  دکمه‌ها
 * ========================= */

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0f8df5);
    border: none;
    color: #0b1220;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(18, 180, 255, 0.35);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0fa8f0, #0c7ed4);
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(18, 180, 255, 0.45);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 10px 24px rgba(18, 180, 255, 0.3);
}

.btn-outline-info {
    color: var(--accent);
    border-color: rgba(35, 224, 179, 0.6);
    background: transparent;
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-outline-info:hover {
    background: rgba(35, 224, 179, 0.14);
    color: #d6fff2;
    box-shadow: 0 10px 26px rgba(15, 118, 110, 0.4);
}

/* برای جاهایی که از Bootstrap استفاده کردی */

.btn-outline-light {
    color: var(--text);
    border-color: rgba(248, 250, 252, 0.4);
    background: transparent;
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-outline-light:hover {
    background: rgba(248, 250, 252, 0.08);
    color: #f9fafb;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.7);
}

.btn-outline-danger {
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.7);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger-soft);
    color: #fee2e2;
}

/* فوکوس امن برای کیبورد */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.8);
    outline-offset: 2px;
}

/* =========================
 *  فرم‌ها و ورودی‌ها
 * ========================= */

.input-glow,
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    border-radius: 12px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.input-glow::placeholder,
.form-control::placeholder {
    color: rgba(148, 163, 184, 0.7);
}

.input-glow:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.18rem rgba(18, 180, 255, 0.25);
    background: rgba(15, 23, 42, 0.95);
}

/* =========================
 *  فلش‌ها (پیام‌های وضعیت)
 * ========================= */

.flash {
    border-radius: 12px;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.flash.show {
    opacity: 1;
    transform: translateY(0);
}

.flash-success {
    background: rgba(35, 224, 179, 0.15);
    border: 1px solid rgba(35, 224, 179, 0.25);
    color: #c5ffe9;
}

.flash-danger {
    background: rgba(255, 82, 82, 0.12);
    border: 1px solid rgba(255, 82, 82, 0.26);
    color: #ffd6d6;
}

/* =========================
 *  جدول‌ها
 * ========================= */

.table-clean th,
.table-clean td {
    border: none;
    color: var(--text);
    font-size: 0.9rem;
}

.table-clean tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.table-clean tbody tr:hover {
    background: rgba(15, 23, 42, 0.75);
}

/* =========================
 *  گرید بازی TTT
 * ========================= */

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.cell {
    min-height: 110px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.cell:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 24px rgba(18, 180, 255, 0.2);
}

/* رنگ جدا برای X و O */

.ttt-x {
    color: #ff6b6b;
}

.ttt-o {
    color: #38bdf8;
}

/* ریسپانسیو بازی برای موبایل */

@media (max-width: 576px) {
    .cell {
        min-height: 80px;
        font-size: 1.7rem;
    }

    .hero {
        padding: 1.2rem;
    }

    .navbar {
        border-radius: 0 0 18px 18px;
    }
}
