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

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:           #08080f;
  --surface:      #12121e;
  --surface-2:    #1a1a2e;
  --border:       #252535;
  --text:         #e8e8f0;
  --muted:        #8888aa;
  --accent:       #8b5cf6;
  --accent-dark:  #6d28d9;
  --accent-glow:  rgba(139, 92, 246, 0.22);
  --success:      #10b981;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --gold:         #f59e0b;
  --silver:       #94a3b8;
  --bronze:       #cd7f32;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Heebo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
}

body.rtl { direction: rtl; text-align: right; }
body.ltr { direction: ltr; text-align: left; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; }

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 2rem;
  background: rgba(8, 8, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.navbar-brand {
  font-weight: 800; font-size: 1.2rem;
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.navbar-actions { display: flex; gap: 0.75rem; align-items: center; }
.nav-user { color: var(--muted); font-size: 0.9rem; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem; border-radius: 8px; border: none;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover { background: #7c3aed; box-shadow: 0 6px 20px var(--accent-glow); }

.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #d97706; }

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; border-radius: 6px; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1.05rem; border-radius: 12px; }
.btn-full { width: 100%; justify-content: center; }

.btn-google {
  background: #fff; color: #333;
  border: 1px solid #ddd;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  font-size: 1rem; padding: 0.8rem 1.8rem; border-radius: 10px;
}
.btn-google:hover { background: #f8f8f8; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

.btn-wa {
  background: #25D366; color: #fff;
  box-shadow: 0 4px 15px rgba(37,211,102,0.3);
}
.btn-wa:hover { background: #1ebe5c; }

/* ── Container ─────────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 680px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: 14px;
  border: 1px solid var(--border); padding: 1.5rem;
}
.card-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem; margin-bottom: 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 1.05rem; font-weight: 700; }

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(139,92,246,0.12) 0%, transparent 70%);
}
.hero-badge {
  display: inline-block; padding: 0.35rem 1rem;
  background: rgba(139,92,246,0.15); border: 1px solid rgba(139,92,246,0.4);
  border-radius: 99px; font-size: 0.85rem; color: #a78bfa;
  margin-bottom: 1.5rem; font-weight: 600;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800; line-height: 1.15; margin-bottom: 1.2rem;
  background: linear-gradient(135deg, #e8e8f0 0%, #a78bfa 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.1rem; color: var(--muted); max-width: 520px;
  margin: 0 auto 2.5rem;
}

/* ── Stats bar ─────────────────────────────────────────────────────────── */
.stats-bar {
  display: flex; justify-content: center; gap: 2rem;
  flex-wrap: wrap; padding: 1.5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 0 0 3rem;
}
.stat-item { text-align: center; }
.stat-num { font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--muted); }

/* ── How it works ──────────────────────────────────────────────────────── */
.section { padding: 3.5rem 1.5rem; }
.section-title {
  text-align: center; font-size: 1.6rem; font-weight: 800;
  margin-bottom: 2.5rem;
}
.steps-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem; max-width: 900px; margin: 0 auto;
}
.step-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.75rem 1.5rem; text-align: center;
  transition: border-color 0.2s;
}
.step-card:hover { border-color: var(--accent); }
.step-num {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent-glow); border: 1.5px solid var(--accent);
  color: var(--accent); font-size: 1.1rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.step-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }
.step-card p { color: var(--muted); font-size: 0.9rem; }

/* ── Countdown ─────────────────────────────────────────────────────────── */
.contest-banner {
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(109,40,217,0.1));
  border: 1px solid rgba(139,92,246,0.4);
  border-radius: 14px; padding: 1.5rem 2rem;
  text-align: center; margin-bottom: 2rem;
}
.contest-banner.ended {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.3);
}
.contest-banner.inactive {
  background: rgba(100,100,120,0.08);
  border-color: rgba(100,100,120,0.3);
}
.contest-label {
  font-size: 0.85rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.75rem;
}
.countdown {
  display: flex; justify-content: center; gap: 1.2rem; flex-wrap: wrap;
}
.cd-unit { text-align: center; min-width: 60px; }
.cd-num {
  font-size: 2.2rem; font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; line-height: 1; display: block;
}
.cd-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.cd-sep { font-size: 2rem; color: var(--muted); align-self: flex-start; padding-top: 0.2rem; }

.contest-ended-msg { font-size: 1.2rem; font-weight: 700; color: var(--danger); }
.contest-inactive-msg { font-size: 1rem; color: var(--muted); }

/* ── Dashboard ─────────────────────────────────────────────────────────── */
.dashboard { padding: 2rem 0; }
.dashboard-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem;
}
.dashboard-header h2 { font-size: 1.5rem; font-weight: 700; }

.points-hero {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border-radius: 14px; padding: 1.5rem 2rem;
  display: flex; align-items: center; gap: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 30px var(--accent-glow);
}
.points-num { font-size: 3.5rem; font-weight: 900; color: #fff; line-height: 1; }
.points-meta { color: rgba(255,255,255,0.85); }
.points-meta strong { font-size: 1.2rem; display: block; }
.points-meta span { font-size: 0.9rem; opacity: 0.8; }

/* ── Referral box ──────────────────────────────────────────────────────── */
.referral-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.5rem; margin-bottom: 1.5rem;
}
.referral-box h3 { margin-bottom: 1rem; font-size: 1rem; font-weight: 700; color: var(--muted); }
.link-row {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
}
.link-input {
  flex: 1; min-width: 200px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.65rem 1rem; color: var(--text);
  font-size: 0.9rem; direction: ltr; text-align: left;
}
.link-input:focus { outline: none; border-color: var(--accent); }
.copy-success { color: var(--success); font-size: 0.85rem; margin-top: 0.5rem; display: none; }

/* ── Leaderboard ───────────────────────────────────────────────────────── */
.leaderboard-table {
  width: 100%; border-collapse: collapse;
}
.leaderboard-table th, .leaderboard-table td {
  padding: 0.75rem 1rem; text-align: right;
  border-bottom: 1px solid var(--border);
}
.leaderboard-table th {
  font-size: 0.8rem; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:hover td { background: var(--surface-2); }
.leaderboard-table .me td { background: rgba(139,92,246,0.1); }
.rank-gold   { color: var(--gold); font-weight: 800; }
.rank-silver { color: var(--silver); font-weight: 700; }
.rank-bronze { color: var(--bronze); font-weight: 700; }
.rank-num    { color: var(--muted); }

/* ── Rules ─────────────────────────────────────────────────────────────── */
.rules {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; margin-bottom: 1.5rem;
}
.rules summary {
  padding: 1.2rem 1.5rem; cursor: pointer; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none; list-style: none;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary:hover { background: var(--surface-2); }
.rules-body { padding: 0 1.5rem 1.5rem; color: var(--muted); line-height: 1.8; }
.rules-body ul { padding-right: 1.2rem; }
.rules-body li { margin-bottom: 0.4rem; }

/* ── Join page ─────────────────────────────────────────────────────────── */
.join-wrapper {
  min-height: calc(100vh - 80px);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.join-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 2.5rem;
  width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.join-card h2 { font-size: 1.4rem; margin-bottom: 0.4rem; }
.join-card .sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }
.join-referrer {
  background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.3);
  border-radius: 8px; padding: 0.75rem 1rem;
  font-size: 0.9rem; margin-bottom: 1.5rem;
}
.join-referrer strong { color: var(--accent); }

.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.4rem; }
.form-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.75rem 1rem; color: var(--text);
  font-size: 1rem; direction: ltr; text-align: left;
  transition: border-color 0.2s;
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }

.step-indicator {
  display: flex; gap: 0.5rem; align-items: center;
  margin-bottom: 2rem;
}
.step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  background: var(--border); color: var(--muted);
}
.step-dot.active { background: var(--accent); color: #fff; }
.step-dot.done { background: var(--success); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--border); }
.step-line.done { background: var(--success); }

.join-success { display: none; text-align: center; }
.join-success .icon { font-size: 3rem; margin-bottom: 1rem; display: block; }
.join-success h3 { margin-bottom: 0.5rem; }
.join-success p { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.95rem; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-top: 0.35rem; display: none; }

/* ── Admin panel ───────────────────────────────────────────────────────── */
.admin-body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #07070e; color: #d4d4e8; direction: ltr; text-align: left;
}
.admin-nav {
  background: rgba(7,7,14,0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid #1e1e30;
  padding: 0 2rem; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.admin-nav-brand { font-weight: 700; color: #a78bfa; font-size: 1rem; }
.admin-nav-links { display: flex; gap: 0.5rem; }
.admin-nav a {
  color: #888aaa; padding: 0.35rem 0.75rem; border-radius: 6px;
  font-size: 0.85rem; text-decoration: none; transition: all 0.15s;
}
.admin-nav a:hover, .admin-nav a.active { color: #e8e8f0; background: #1a1a2e; }

.admin-main { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.admin-page-title {
  font-size: 1.5rem; font-weight: 700; margin-bottom: 0.3rem;
}
.admin-page-sub { color: #888aaa; font-size: 0.85rem; margin-bottom: 2rem; }

/* Admin stats */
.admin-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.admin-stat {
  background: #12121e; border: 1px solid #1e1e30; border-radius: 12px;
  padding: 1.25rem; text-align: center;
}
.admin-stat-num { font-size: 2rem; font-weight: 800; color: #8b5cf6; }
.admin-stat-label { font-size: 0.75rem; color: #888aaa; text-transform: uppercase; letter-spacing: 0.5px; }

/* Contest timer in admin */
.contest-control {
  background: #12121e; border: 1px solid #1e1e30; border-radius: 14px;
  padding: 1.5rem; margin-bottom: 2rem;
}
.contest-control-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: 1rem;
}
.contest-control-title { font-size: 1rem; font-weight: 700; }
.contest-status-badge {
  padding: 0.3rem 0.9rem; border-radius: 99px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.5px;
}
.badge-active   { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.badge-inactive { background: rgba(100,100,120,0.15); color: #888aaa; border: 1px solid #252535; }
.badge-ended    { background: rgba(239,68,68,0.12); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

.admin-countdown {
  display: flex; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.admin-cd-unit { text-align: center; min-width: 55px; }
.admin-cd-num {
  font-size: 1.8rem; font-weight: 800; color: #a78bfa; display: block; line-height: 1;
}
.admin-cd-label { font-size: 0.65rem; color: #888aaa; text-transform: uppercase; letter-spacing: 1px; }

.contest-meta { color: #888aaa; font-size: 0.82rem; margin-bottom: 1.25rem; }
.contest-meta span { margin-left: 1.5rem; }

.contest-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.duration-input-group { display: flex; align-items: center; gap: 0.5rem; }
.admin-input {
  background: #0d0d1a; border: 1px solid #252535; color: #e8e8f0;
  border-radius: 8px; padding: 0.5rem 0.8rem; font-size: 0.9rem;
  width: 80px; text-align: center;
}
.admin-input:focus { outline: none; border-color: #8b5cf6; }
.input-label { font-size: 0.85rem; color: #888aaa; }

/* Admin table */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 0.875rem;
}
.admin-table th {
  padding: 0.75rem 1rem; text-align: left;
  background: #0d0d1a; color: #888aaa;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid #1e1e30;
  white-space: nowrap;
}
.admin-table td {
  padding: 0.75rem 1rem; border-bottom: 1px solid #1a1a28;
  vertical-align: middle;
}
.admin-table tr:hover td { background: #0e0e1a; }
.admin-table .rank-1 td { background: rgba(245,158,11,0.05); }
.admin-table .rank-2 td { background: rgba(148,163,184,0.04); }
.admin-table .rank-3 td { background: rgba(205,127,50,0.04); }
.admin-table .pts { font-weight: 800; font-size: 1.05rem; color: #a78bfa; }
.admin-table .mono { font-family: monospace; font-size: 0.82rem; color: #888aaa; }
.admin-table code {
  background: #1a1a2e; padding: 0.15rem 0.5rem; border-radius: 4px;
  font-size: 0.8rem; color: #c4b5fd;
}

.action-row { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline-flex; gap: 0.4rem; align-items: center; }
.pts-input {
  width: 70px; background: #0d0d1a; border: 1px solid #252535;
  border-radius: 6px; padding: 0.3rem 0.5rem; color: #e8e8f0;
  font-size: 0.82rem; text-align: center;
}
.pts-input:focus { outline: none; border-color: #8b5cf6; }

/* Expandable phone list */
.phones-toggle {
  background: none; border: none; color: #8b5cf6; cursor: pointer;
  font-size: 0.8rem; text-decoration: underline; padding: 0;
}
.phones-detail {
  display: none; background: #0a0a16; border-radius: 8px;
  padding: 0.75rem; margin-top: 0.5rem; font-size: 0.8rem;
}
.phones-detail.open { display: block; }
.phone-row { display: flex; justify-content: space-between; padding: 0.2rem 0; color: #888aaa; }
.phone-row span:first-child { font-family: monospace; color: #c4b5fd; }

/* Admin groups */
.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.group-card {
  background: #12121e; border: 1px solid #1e1e30; border-radius: 12px; padding: 1.25rem;
}
.group-card.is-active { border-color: rgba(16,185,129,0.4); }
.group-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.group-label { font-weight: 700; }
.group-id { font-family: monospace; font-size: 0.78rem; color: #888aaa; margin-bottom: 0.75rem; word-break: break-all; }
.group-meta { font-size: 0.8rem; color: #888aaa; margin-bottom: 1rem; }
.group-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.add-group-form {
  background: #12121e; border: 1px solid #1e1e30; border-radius: 14px; padding: 1.5rem;
}
.add-group-form h3 { margin-bottom: 1.25rem; font-size: 0.95rem; font-weight: 700; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.admin-form-group { margin-bottom: 1rem; }
.admin-label { display: block; font-size: 0.8rem; font-weight: 600; color: #888aaa; margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-field {
  width: 100%; background: #0d0d1a; border: 1px solid #252535;
  border-radius: 8px; padding: 0.6rem 0.9rem; color: #e8e8f0;
  font-size: 0.9rem;
}
.admin-field:focus { outline: none; border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139,92,246,0.12); }
.admin-hint { font-size: 0.75rem; color: #666; margin-top: 0.25rem; }

/* ── Utilities ─────────────────────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.font-mono { font-family: monospace; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0.75rem 1rem; }
  .hero { padding: 3rem 1rem 2.5rem; }
  .dashboard-header { flex-direction: column; align-items: flex-start; }
  .points-hero { flex-direction: column; text-align: center; }
  .link-row { flex-direction: column; }
  .link-input { width: 100%; }
  .admin-main { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .contest-actions { flex-direction: column; align-items: flex-start; }
}
