* { box-sizing: border-box; }
body { margin: 0; font-family: 'Assistant', sans-serif; direction: rtl; background: #f4f6fb; }

.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1629 55%, #312e81 100%);
  padding: 20px;
}
.login-box { width: 100%; max-width: 400px; }
.login-icon { font-size: 3rem; color: #6366f1; text-align: center; }
.login-title { color: #fff; font-size: 1.8rem; font-weight: 800; text-align: center; margin: 4px 0 2px; }
.login-sub { color: rgba(255,255,255,0.55); font-size: 0.9rem; text-align: center; margin-bottom: 0; }

.otp-input {
  font-size: 2rem;
  font-family: monospace;
  letter-spacing: 0.5rem;
  text-align: center;
  padding: 14px 12px;
  color: #1e293b;
}

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  background: #0f1629; color: #fff; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.topbar .brand i { color: #6366f1; font-size: 1.4rem; }
.topbar .user-badge { color: rgba(255,255,255,0.7); font-size: 0.9rem; }

/* ── Page ──────────────────────────────────────────────────────────────────── */
.page-wrap { max-width: 980px; margin: 0 auto; padding: 28px 20px 60px; }

.create-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 16px;
  padding: 24px; margin-bottom: 28px; box-shadow: 0 4px 18px rgba(15,22,41,0.05);
}
.create-card h2 { font-size: 1.15rem; font-weight: 800; margin-bottom: 16px; color: #0f1629; }

.code-preview {
  font-family: monospace; font-size: 1rem; direction: ltr; text-align: left;
  color: #4f46e5; font-weight: 700;
}
.code-feedback { font-size: 0.82rem; min-height: 1.1rem; }
.code-feedback.ok    { color: #16a34a; }
.code-feedback.bad   { color: #dc2626; }
.code-feedback.muted { color: #94a3b8; }

.links-section h2 { font-size: 1.05rem; font-weight: 800; color: #0f1629; margin-bottom: 14px; }

.link-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 16px 18px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.link-card .qr-box {
  width: 64px; height: 64px; flex: 0 0 64px;
  background: #fff; border: 1px solid #eef0f5; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.link-card .info { flex: 1 1 260px; min-width: 0; }
.link-card .short-url {
  font-weight: 800; color: #4f46e5; direction: ltr; text-align: left; display: block;
  text-decoration: none; font-size: 1.02rem; word-break: break-all;
}
.link-card .short-url:hover { text-decoration: underline; }
.link-card .target-url {
  color: #64748b; font-size: 0.85rem; direction: ltr; text-align: left; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-card .meta { color: #94a3b8; font-size: 0.78rem; margin-top: 4px; }
.mini-domain-toggle { display: flex; gap: 6px; margin-top: 6px; direction: ltr; justify-content: flex-start; }
.mini-domain-btn {
  border: 1px solid #e2e8f0; background: #fff; color: #64748b;
  font-size: 0.72rem; padding: 2px 9px; border-radius: 999px; cursor: pointer;
}
.mini-domain-btn.active { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; font-weight: 700; }
.link-card .actions { display: flex; gap: 8px; flex: 0 0 auto; }
.link-card .clicks-badge {
  background: #eef2ff; color: #4338ca; border-radius: 999px; padding: 4px 12px;
  font-weight: 700; font-size: 0.85rem; white-space: nowrap;
}

.empty-state { text-align: center; padding: 50px 20px; color: #94a3b8; }
.empty-state i { font-size: 2.6rem; margin-bottom: 10px; display: block; }

/* ── Stats modal ───────────────────────────────────────────────────────────── */
.range-toggle .btn { border-radius: 8px !important; font-size: 0.85rem; padding: 6px 12px; }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-tile {
  background: #f8f9fc; border: 1px solid #eef0f5; border-radius: 12px;
  padding: 14px 16px; text-align: center;
}
.stat-tile-value { font-size: 1.6rem; font-weight: 800; color: #0f1629; }
.stat-tile-label { font-size: 0.78rem; color: #64748b; margin-top: 2px; }

.chart-card {
  background: #fff; border: 1px solid #eef0f5; border-radius: 12px; padding: 14px 16px;
}
.chart-card-title { font-size: 0.85rem; font-weight: 700; color: #52514e; margin-bottom: 8px; }

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-bar { fill: #6366f1; cursor: pointer; }
.chart-bar:hover { fill: #4338ca; }
.chart-axis-line { stroke: #c3c2b7; stroke-width: 1; }
.chart-gridline { stroke: #e1e0d9; stroke-width: 1; }
.chart-tick { fill: #898781; font-size: 10px; }
.chart-empty { text-align: center; color: #94a3b8; padding: 30px 0; font-size: 0.9rem; }

.chart-tooltip {
  position: absolute; pointer-events: none; background: #0f1629; color: #fff;
  font-size: 0.78rem; padding: 5px 9px; border-radius: 6px; white-space: nowrap;
  transform: translate(-50%, -100%); margin-top: -8px; z-index: 5; opacity: 0;
  transition: opacity .1s;
}
.chart-tooltip.show { opacity: 1; }

.breakdown-list { display: flex; flex-direction: column; gap: 8px; }
.breakdown-row { display: flex; align-items: center; gap: 10px; }
.breakdown-label { font-size: 0.82rem; color: #52514e; flex: 0 0 90px; }
.breakdown-track { flex: 1; height: 8px; background: #eef0f5; border-radius: 999px; overflow: hidden; }
.breakdown-fill { height: 100%; background: #6366f1; border-radius: 999px; }
.breakdown-count { font-size: 0.8rem; color: #64748b; flex: 0 0 26px; text-align: left; }

.log-table { font-size: 0.82rem; direction: ltr; text-align: left; }
.log-table th { color: #94a3b8; font-weight: 700; font-size: 0.75rem; text-transform: uppercase; }
.log-table td { vertical-align: middle; color: #334155; }
.log-empty { text-align: center; color: #94a3b8; padding: 16px; }

/* ── 404 ───────────────────────────────────────────────────────────────────── */
.notfound-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #0f1629; color: #fff; text-align: center; padding: 20px;
}
.notfound-screen h1 { font-size: 4rem; font-weight: 800; margin: 0; color: #6366f1; }
.notfound-screen p { color: rgba(255,255,255,0.6); }
