@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }
body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: #f3f4f6;
  margin: 0;
  color: #1f2937;
}
a { text-decoration: none; color: inherit; }

.topnav {
  background: #111827;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topnav .brand { font-weight: bold; font-size: 18px; color: #fff; }
.topnav .user { margin-left: 12px; color: #9ca3af; }
.topnav .logout { background: #ef4444; padding: 6px 14px; border-radius: 6px; color: #fff; }

.container { max-width: 1100px; margin: 30px auto; padding: 0 16px; }
.container.narrow { max-width: 480px; }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px;}
.page-head h1 small { font-size: 14px; color: #6b7280; font-weight: normal; margin-right: 8px; }

.btn {
  background: #4f46e5; color: #fff; padding: 10px 18px;
  border: none; border-radius: 8px; cursor: pointer; font-size: 14px; display:inline-block;
}
.btn:hover { background: #4338ca; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; }
.card {
  background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: transform .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.card h3 { margin: 0 0 4px; }
.domain-url { color: #6b7280; font-size: 13px; margin: 0 0 12px; }
.stat-row { display: flex; gap: 20px; }
.stat-row .num { font-size: 22px; font-weight: bold; display: block; color:#4f46e5;}
.stat-row .lbl { font-size: 12px; color: #6b7280; }

.empty { color: #6b7280; text-align: center; padding: 40px 0; }

.form-box, .success-box { background: #fff; padding: 24px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.form-box label { display: block; margin: 14px 0 6px; font-size: 14px; }
.form-box input { width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
.form-box button { margin-top: 20px; width: 100%; }
.error { color: #dc2626; }

.code-box {
  background: #111827; color: #a5f3fc; padding: 14px; border-radius: 8px;
  overflow-x: auto; direction: ltr; text-align: left; font-size: 13px;
}

.stats-cards { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card { background:#fff; border-radius:12px; padding:18px 26px; box-shadow:0 1px 3px rgba(0,0,0,.08); text-align:center; flex:1; min-width:150px;}
.stat-card .num { font-size: 26px; font-weight: bold; color:#4f46e5; display:block; }
.stat-card .lbl { color:#6b7280; font-size: 13px; }

.panel { background:#fff; border-radius:12px; padding:20px; box-shadow:0 1px 3px rgba(0,0,0,.08); margin-bottom:20px;}
.panel h2 { margin-top:0; font-size:16px; }

.two-col { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
.three-col { display:grid; grid-template-columns: repeat(3,1fr); gap:16px; }
@media (max-width: 800px) { .two-col, .three-col { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th, table td { padding: 8px; border-bottom: 1px solid #f0f0f0; text-align: right; }
.truncate { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.range-form { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.range-form select, .range-form input[type=date] { padding: 8px; border-radius: 8px; border:1px solid #d1d5db; font-family:inherit; }
.range-form .btn-sm, .btn-sm { padding:8px 14px; font-size:13px; border-radius:8px; border:none; cursor:pointer; }
.btn-outline { background:#fff; border:1px solid #d1d5db; color:#374151; }
.btn-outline:hover { background:#f3f4f6; }
.btn-danger { background:#ef4444; color:#fff; }
.btn-danger:hover { background:#dc2626; }

.live-badge {
  display:inline-flex; align-items:center; gap:6px; background:#ecfdf5; color:#059669;
  padding:6px 12px; border-radius:20px; font-size:13px; font-weight:600;
}
.live-dot { width:8px; height:8px; border-radius:50%; background:#10b981; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%{opacity:1;} 50%{opacity:.3;} 100%{opacity:1;} }

.growth { font-size:12px; font-weight:600; padding:2px 8px; border-radius:12px; margin-right:6px; }
.growth.up { background:#ecfdf5; color:#059669; }
.growth.down { background:#fef2f2; color:#dc2626; }
.growth.flat { background:#f3f4f6; color:#6b7280; }

.card-actions { display:flex; gap:8px; margin-top:10px; }
.icon-link { color:#6b7280; font-size:13px; }
.icon-link:hover { color:#4f46e5; }

.top-actions { display:flex; gap:10px; flex-wrap:wrap; }

/* صفحه ورود */
.login-body { display:flex; align-items:center; justify-content:center; height:100vh; }
.login-box { background:#fff; padding:32px; border-radius:12px; width:320px; box-shadow:0 4px 20px rgba(0,0,0,.1); }
.login-box h2 { text-align:center; margin-top:0; }
.login-box label { display:block; margin:14px 0 6px; font-size:14px; }
.login-box input { width:100%; padding:10px; border:1px solid #d1d5db; border-radius:8px; }
.login-box button { width:100%; margin-top:20px; background:#4f46e5; color:#fff; border:none; padding:12px; border-radius:8px; cursor:pointer; }
.login-box .hint { text-align:center; font-size:12px; color:#9ca3af; margin-top:14px; }

/* حالت تاریک */
html.dark body { background:#0f172a; color:#e5e7eb; }
html.dark .topnav { background:#020617; }
html.dark .card, html.dark .panel, html.dark .stat-card,
html.dark .form-box, html.dark .success-box, html.dark .login-box { background:#1e293b; color:#e5e7eb; box-shadow:none; border:1px solid #334155; }
html.dark .domain-url, html.dark .lbl, html.dark table th { color:#94a3b8; }
html.dark table td, html.dark table th { border-color:#334155; }
html.dark .form-box input, html.dark .range-form select, html.dark .login-box input { background:#0f172a; border-color:#334155; color:#e5e7eb; }
html.dark .btn-outline { background:#1e293b; border-color:#334155; color:#e5e7eb; }
html.dark .empty { color:#94a3b8; }

.heatmap-wrap { overflow-x: auto; }
.heatmap { border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.heatmap th, .heatmap td { padding: 4px 6px; text-align: center; border: 1px solid #f3f4f6; min-width: 24px; }
.heatmap th { color: #6b7280; font-weight: normal; }
.heatmap td { color: #1e1b4b; font-weight: 600; }
html.dark .heatmap th, html.dark .heatmap td { border-color: #334155; }
html.dark .heatmap td { color: #e5e7eb; }

.compare-table th, .compare-table td { text-align: center; }
.compare-table td:first-child, .compare-table th:first-child { text-align: right; }
.diff-up { color:#059669; font-weight:600; }
.diff-down { color:#dc2626; font-weight:600; }
