:root {
    --bg: #0b1020;
    --bg-soft: #121933;
    --card: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.08);
    --text: #eef2ff;
    --muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 16px;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --font: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: radial-gradient(circle at top, #1e1b4b 0%, var(--bg) 45%, #020617 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.7;
}

a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: min(1120px, calc(100% - 2rem));
    margin-inline: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(14px);
    background: rgba(11, 16, 32, 0.75);
    border-bottom: 1px solid var(--card-border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.brand {
    font-weight: 800;
    font-size: 1.15rem;
    color: #fff;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--muted);
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
}

.nav-links a.active,
.nav-links a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    border-radius: 999px;
    padding: 0.7rem 1.2rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
}

.btn-primary:hover { background: linear-gradient(135deg, var(--primary-hover), #a78bfa); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid var(--card-border);
}

.btn-danger { background: rgba(239, 68, 68, 0.15); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.35); }

.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.9rem; }

.hero {
    padding: 4rem 0 3rem;
    text-align: center;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.2;
    margin: 0 0 1rem;
}

.hero p {
    color: var(--muted);
    max-width: 640px;
    margin: 0 auto 2rem;
    font-size: 1.05rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.card h2, .card h3 { margin-top: 0; }

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
}

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

.form-group { margin-bottom: 1rem; }

label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.92rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(99, 102, 241, 0.45);
    border-color: transparent;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); color: #bbf7d0; }
.alert-error { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); color: #fecaca; }
.alert-info { background: rgba(99, 102, 241, 0.12); border-color: rgba(99, 102, 241, 0.35); color: #c7d2fe; }

.auth-wrap {
    min-height: calc(100vh - 80px);
    display: grid;
    place-items: center;
    padding: 2rem 0;
}

.auth-card { width: min(420px, 100%); }

.page-title {
    margin: 2rem 0 1.25rem;
    font-size: 1.6rem;
}

.progress {
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #22d3ee);
}

.conversation-list { list-style: none; padding: 0; margin: 0; }

.conversation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.conversation-item:last-child { border-bottom: none; }

.conversation-item:hover { background: rgba(255, 255, 255, 0.03); }

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    font-weight: 700;
    flex-shrink: 0;
}

.chat-wrap {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
    min-height: 70vh;
}

@media (max-width: 900px) {
    .chat-wrap { grid-template-columns: 1fr; }
}

.message-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
}

.message-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.35rem;
}

.code-box {
    font-family: ui-monospace, monospace;
    font-size: 1.6rem;
    letter-spacing: 0.25em;
    text-align: center;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px dashed rgba(129, 140, 248, 0.5);
}

.plan-card.featured {
    border-color: rgba(129, 140, 248, 0.6);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.12), rgba(255,255,255,0.03));
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.08);
}

.badge-success { background: rgba(34,197,94,0.15); color: #86efac; }
.badge-warning { background: rgba(245,158,11,0.15); color: #fcd34d; }

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--card-border);
    text-align: right;
}

.footer {
    padding: 2rem 0;
    color: var(--muted);
    text-align: center;
    font-size: 0.9rem;
}

.inline-form { display: inline; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.mobile-toggle {
    display: none;
    background: none;
    border: 1px solid var(--card-border);
    color: #fff;
    border-radius: 10px;
    padding: 0.4rem 0.6rem;
}

@media (max-width: 768px) {
    .mobile-toggle { display: inline-flex; }
    .nav-links { display: none; width: 100%; flex-direction: column; align-items: stretch; }
    .nav-links.open { display: flex; }
    .nav { flex-wrap: wrap; }
}
