:root {
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --primary-strong: #1d4ed8;
  --bg: #020617;
  --bg-soft: rgba(15, 23, 42, 0.9);
  --card: rgba(15, 23, 42, 0.85);
  --border-subtle: rgba(148, 163, 184, 0.3);
  --muted: #9ca3af;
  --text: #e5e7eb;
  --error: #ef4444;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.25), transparent 55%),
    radial-gradient(circle at bottom, rgba(56, 189, 248, 0.18), #020617 70%);
  color: var(--text);
  min-height: 100vh;
}

/* شريط علوي */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  backdrop-filter: blur(20px);
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.8));
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  color: #f9fafb;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.brand::before {
  content: "●";
  color: var(--primary);
  margin-inline-end: 6px;
}

.links a {
  margin-inline: 10px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.18s ease, transform 0.18s ease;
}

.links a:hover {
  color: #e5e7eb;
  transform: translateY(-1px);
}

/* حاوية أساسية */

.container {
  max-width: 980px;
  margin: 26px auto 40px;
  padding: 0 18px;
}

/* بطاقات */

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 22px 22px 18px;
  margin-bottom: 18px;
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.7),
    0 0 0 1px rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.card h1,
.card h2 {
  margin-top: 0;
  margin-bottom: 6px;
}

.card h1 {
  font-size: 1.5rem;
}

.card h2 {
  font-size: 1.2rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* حقل الإدخال و الأزرار */

input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  margin: 10px 0 4px;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  outline: none;
  font-size: 0.93rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input::placeholder {
  color: rgba(148, 163, 184, 0.8);
}

input:focus {
  border-color: rgba(37, 99, 235, 0.9);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.6);
  background: rgba(15, 23, 42, 0.95);
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #f9fafb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 15px 30px rgba(37, 99, 235, 0.35);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, background 0.16s ease;
  white-space: nowrap;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 22px 45px rgba(37, 99, 235, 0.45);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

button.secondary {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: none;
  color: var(--text);
}

button.secondary:hover {
  border-color: rgba(148, 163, 184, 0.85);
}

button.tiny {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #dbeafe;
  box-shadow: none;
}

/* نتيجة الاختصار */

.result {
  padding: 11px 12px;
  margin-top: 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.16), rgba(30, 64, 175, 0.3));
  border: 1px solid rgba(129, 140, 248, 0.6);
  font-size: 0.9rem;
}

.result-title {
  font-size: 0.78rem;
  color: rgba(226, 232, 240, 0.88);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 2px;
}

.result-url a {
  color: #e5e7eb;
  font-weight: 600;
  text-decoration: none;
}

.result-url a:hover {
  text-decoration: underline;
}

/* قائمة الروابط */

.list .item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(30, 41, 59, 0.85);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.item-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.item-short {
  font-size: 0.92rem;
  color: #bfdbfe;
  text-decoration: none;
  word-break: break-all;
}

.item-short:hover {
  text-decoration: underline;
}

.item-original {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* تحليلات */

.analytics-summary {
  margin-top: 8px;
  margin-bottom: 12px;
  text-align: center;
}

.analytics-number {
  font-size: 2.1rem;
  font-weight: 700;
}

.analytics-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.analytics-block {
  margin-top: 10px;
}

.analytics-title {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.analytics-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #e5e7eb;
}

.tag-count {
  margin-inline-start: 4px;
  color: #bfdbfe;
}

/* رسائل فارغة و أخطاء */

.empty {
  padding: 8px 0;
}

.error {
  color: var(--error);
  font-size: 0.86rem;
  margin-top: 6px;
}

/* مخفي */

.hidden {
  display: none;
}

/* الفوتر */

.footer {
  text-align: center;
  padding: 18px;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid rgba(15, 23, 42, 0.85);
  background: rgba(15, 23, 42, 0.9);
}

/* تجاوب */

@media (max-width: 720px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .links {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: wrap;
  }

  .container {
    margin-top: 18px;
  }

  .row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .item-meta {
    flex-direction: row;
    gap: 8px;
  }
}