/* ============================================
   KOORAWORLD — ADMIN DASHBOARD
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0a0a0a;
  --bg2:     #111111;
  --bg3:     #1a1a1a;
  --card:    #141414;
  --border:  rgba(255,255,255,.07);
  --red:     #CC0000;
  --red2:    #FF2222;
  --green:   #00CC66;
  --blue:    #0088FF;
  --white:   #ffffff;
  --gray:    #888888;
  --light:   #cccccc;
  --font:    'Cairo', sans-serif;
  --sidebar: 240px;
  --radius:  10px;
}

body { background: var(--bg); color: var(--white); font-family: var(--font); direction: rtl; min-height: 100vh; }
a { text-decoration: none; }
.hidden { display: none !important; }

/* ═══ LOGIN ════════════════════════════════════════ */
#loginScreen {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(ellipse at center, #1a0000 0%, var(--bg) 70%);
}
.login-card {
  background: var(--card); border: 1px solid rgba(204,0,0,.3);
  border-radius: 16px; padding: 2.5rem 2rem; width: 340px;
  text-align: center; box-shadow: 0 0 60px rgba(204,0,0,.1);
}
.login-logo { font-size: 2rem; font-weight: 700; color: var(--red); margin-bottom: .3rem; }
.login-subtitle { color: var(--gray); font-size: .85rem; margin-bottom: 1.5rem; }
.login-card input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--white); padding: .85rem 1rem; font-family: var(--font); font-size: 1rem;
  margin-bottom: .8rem; text-align: center; transition: border-color .2s;
}
.login-card input:focus { outline: none; border-color: var(--red); }
.login-card button {
  width: 100%; background: var(--red); color: var(--white); border: none;
  border-radius: var(--radius); padding: .9rem; font-family: var(--font);
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: background .2s, transform .1s;
}
.login-card button:hover { background: var(--red2); }
.login-card button:active { transform: scale(.98); }
.login-hint { color: var(--red); margin-top: .7rem; font-size: .85rem; min-height: 1.2rem; }
.login-tip { color: var(--gray); font-size: .78rem; margin-top: .5rem; }

/* ═══ DASHBOARD LAYOUT ═══════════════════════════ */
#dashboard { display: flex; min-height: 100vh; }

/* ═══ SIDEBAR ════════════════════════════════════ */
.sidebar {
  width: var(--sidebar); background: var(--bg2); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.5rem 1rem;
  position: fixed; top: 0; right: 0; height: 100vh; z-index: 100; overflow-y: auto;
}
.sidebar-logo {
  display: flex; align-items: center; gap: .6rem; font-weight: 700;
  font-size: 1.15rem; color: var(--red); margin-bottom: 2rem; padding: 0 .5rem;
}
.logo-icon { font-size: 1.5rem; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: .25rem; }
.nav-item {
  display: flex; align-items: center; gap: .7rem; padding: .75rem 1rem;
  border-radius: var(--radius); color: var(--gray); font-size: .9rem;
  transition: all .2s; cursor: pointer; border: 1px solid transparent;
}
.nav-item:hover { background: var(--bg3); color: var(--white); }
.nav-item.active { background: rgba(204,0,0,.12); color: var(--red); border-color: rgba(204,0,0,.25); }
.nav-icon { width: 20px; text-align: center; flex-shrink: 0; }
.logout-btn {
  background: none; border: 1px solid var(--border); color: var(--gray);
  border-radius: var(--radius); padding: .65rem 1rem; cursor: pointer;
  font-family: var(--font); font-size: .88rem; transition: all .2s; margin-top: 1rem;
}
.logout-btn:hover { border-color: var(--red); color: var(--red); }

/* ═══ MAIN CONTENT ═══════════════════════════════ */
.main-content { margin-right: var(--sidebar); padding: 1.5rem 2rem; flex: 1; min-width: 0; }

/* ═══ HEADER ════════════════════════════════════ */
.dash-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.dash-header h1 { font-size: 1.35rem; font-weight: 700; }
.header-meta { display: flex; align-items: center; gap: .8rem; color: var(--gray); font-size: .88rem; }
.live-dot {
  display: inline-block; width: 8px; height: 8px; background: var(--green);
  border-radius: 50%; animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.65); }
}
.date-badge {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: .25rem .8rem; font-size: .8rem;
}

/* ═══ SECTIONS ══════════════════════════════════ */
.section { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ═══ CARDS GRID ════════════════════════════════ */
.cards-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem;
}
@media (max-width: 1100px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .cards-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.4rem; display: flex; align-items: center; gap: 1rem;
  transition: border-color .2s, transform .15s;
}
.stat-card:hover { border-color: rgba(204,0,0,.3); transform: translateY(-2px); }
.card-icon { font-size: 2rem; flex-shrink: 0; }
.card-value { font-size: 1.9rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.card-label { font-size: .78rem; color: var(--gray); margin-top: .25rem; }

/* ═══ CHARTS ════════════════════════════════════ */
.charts-row { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .charts-row { flex-direction: column; } }
.chart-box {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem;
}
.chart-box h3 { font-size: .9rem; color: var(--light); margin-bottom: 1rem; font-weight: 600; }

/* ═══ TABLES ════════════════════════════════════ */
.table-box {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; margin-bottom: 1.5rem; overflow-x: auto;
}
.table-box h3 { font-size: .9rem; color: var(--light); margin-bottom: 1rem; font-weight: 600; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
  text-align: right; color: var(--gray); font-weight: 600; padding: .5rem .75rem;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td { padding: .6rem .75rem; border-bottom: 1px solid rgba(255,255,255,.03); color: var(--light); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.bar-mini { height: 3px; background: var(--red); border-radius: 2px; margin-top: 5px; opacity: .65; }
.rank-badge {
  display: inline-block; width: 22px; height: 22px; background: var(--bg3);
  border-radius: 50%; text-align: center; line-height: 22px; font-size: .75rem; color: var(--gray);
}

/* ═══ LIVE SECTION ══════════════════════════════ */
.live-hero {
  text-align: center; padding: 3rem 2rem; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 1.5rem;
  background: radial-gradient(ellipse at center, rgba(204,0,0,.05) 0%, var(--card) 70%);
}
.live-counter-big {
  font-size: 5rem; font-weight: 700; color: var(--red); line-height: 1;
  margin-bottom: .5rem; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px rgba(204,0,0,.4);
}
.live-label { color: var(--light); font-size: 1rem; margin-bottom: .5rem; }
.live-status { display: flex; align-items: center; justify-content: center; gap: .5rem; color: var(--gray); font-size: .85rem; margin-top: .8rem; }

.firebase-box {
  background: var(--card); border: 1px solid rgba(255,150,0,.2);
  border-radius: var(--radius); padding: 1.5rem; margin-top: 1.5rem;
}
.firebase-box h3 { margin-bottom: .5rem; font-size: .95rem; color: #FFA500; }
.firebase-box p  { color: var(--gray); font-size: .88rem; margin-bottom: 1rem; line-height: 1.6; }
.firebase-box textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  color: var(--white); padding: .8rem; font-family: monospace; font-size: .82rem;
  direction: ltr; resize: vertical; margin-bottom: .8rem;
}
.ext-link { color: var(--blue); font-size: .85rem; }
.ext-link:hover { text-decoration: underline; }

/* ═══ BLOG SECTION ══════════════════════════════ */
.blog-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }
.blog-topbar h3 { font-size: 1rem; }
.btn-red {
  background: var(--red); color: var(--white); border: none; border-radius: 8px;
  padding: .5rem 1.1rem; font-size: .88rem; cursor: pointer; font-family: var(--font);
  transition: background .2s;
}
.btn-red:hover { background: var(--red2); }
.articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.article-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; transition: border-color .2s, transform .15s;
}
.article-card:hover { border-color: rgba(204,0,0,.3); transform: translateY(-2px); }
.article-lang { font-size: .72rem; background: var(--bg3); border-radius: 4px; padding: .1rem .4rem; color: var(--gray); margin-bottom: .5rem; display: inline-block; }
.article-card h4 { font-size: .9rem; margin-bottom: .4rem; color: var(--white); line-height: 1.4; }
.article-date { font-size: .78rem; color: var(--gray); margin-bottom: .8rem; }
.article-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.article-actions a {
  font-size: .78rem; padding: .3rem .7rem; border-radius: 6px;
  border: 1px solid var(--border); color: var(--light); transition: all .2s;
}
.article-actions a:hover { border-color: var(--red); color: var(--red); }

/* ═══ SEO SECTION ═══════════════════════════════ */
.seo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.seo-tool {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; text-align: center; color: var(--white); display: flex;
  flex-direction: column; align-items: center; gap: .4rem; font-size: .88rem;
  transition: all .2s;
}
.seo-tool:hover { border-color: rgba(204,0,0,.4); background: rgba(204,0,0,.05); transform: translateY(-2px); }
.seo-tool-icon { font-size: 1.8rem; }

.seo-check { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.seo-check h3 { font-size: .9rem; margin-bottom: 1rem; }
.check-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.check-list li { display: flex; align-items: center; gap: .6rem; font-size: .88rem; color: var(--light); }

.quick-links { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.quick-links h3 { font-size: .9rem; margin-bottom: 1rem; }
.link-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.link-chip {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 20px;
  padding: .3rem .9rem; font-size: .83rem; color: var(--light); transition: all .2s;
}
.link-chip:hover { border-color: var(--red); color: var(--red); }

/* ═══ SETTINGS ══════════════════════════════════ */
.settings-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .settings-wrap { grid-template-columns: 1fr; } }
.settings-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.settings-card h3 { font-size: .95rem; margin-bottom: 1.2rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; color: var(--gray); font-size: .82rem; margin-bottom: .35rem; }
.form-group input, .form-group textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  color: var(--white); padding: .7rem 1rem; font-family: var(--font); font-size: .88rem;
  direction: ltr; transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--red); }
.save-btn {
  background: var(--red); color: var(--white); border: none; border-radius: 8px;
  padding: .65rem 1.4rem; font-family: var(--font); font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.save-btn:hover { background: var(--red2); }
.save-btn.saved { background: var(--green); }
.setting-hint { font-size: .78rem; color: var(--gray); margin-top: .3rem; }

/* ═══ EMPTY STATE ══════════════════════════════ */
.empty-state { text-align: center; padding: 3rem; color: var(--gray); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .5rem; }

/* ═══ SCROLLBAR ════════════════════════════════ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }

/* ═══ RESPONSIVE SIDEBAR ══════════════════════ */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-right: 0; padding: 1rem; }
  .charts-row { flex-direction: column; }
}
