@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --bg: #0b1f24;
  --bg-2: #123038;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f3f7f6;
  --muted: #a8c0c4;
  --accent: #2fd6a6;
  --accent-2: #ff7a59;
  --danger: #ff6b6b;
  --ok: #2fd6a6;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: 'IBM Plex Sans Arabic', Tahoma, sans-serif;
  --display: 'Space Grotesk', 'IBM Plex Sans Arabic', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(47, 214, 166, 0.18), transparent 55%),
    radial-gradient(900px 500px at 0% 20%, rgba(255, 122, 89, 0.14), transparent 50%),
    linear-gradient(160deg, var(--bg), var(--bg-2) 55%, #0e2a31);
  min-height: 100vh;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  gap: 1rem;
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  background: linear-gradient(135deg, var(--accent), #1aa87f 45%, var(--accent-2));
  box-shadow: 0 0 0 4px rgba(47, 214, 166, 0.15);
  animation: pulse-mark 2.8s ease-in-out infinite;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: #062019;
}

.btn-primary:hover {
  background: #3ee4b4;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.15);
  color: #ffb4b4;
  border-color: rgba(255, 107, 107, 0.35);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
}

/* Hero */
.hero {
  min-height: calc(100vh - 5rem);
  display: grid;
  align-content: center;
  gap: 1.5rem;
  padding: 3rem 0 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: auto -10% 5% 40%;
  height: 55%;
  background:
    radial-gradient(circle at 30% 40%, rgba(47, 214, 166, 0.25), transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(255, 122, 89, 0.2), transparent 42%);
  filter: blur(8px);
  pointer-events: none;
  animation: drift 10s ease-in-out infinite alternate;
}

.hero-brand {
  font-family: var(--display);
  font-size: clamp(3rem, 9vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  background: linear-gradient(120deg, #fff 20%, var(--accent) 70%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: fade-up 0.7s ease both;
}

.hero h1 {
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  font-weight: 500;
  max-width: 18ch;
  animation: fade-up 0.7s ease 0.1s both;
}

.hero p {
  color: var(--muted);
  max-width: 38ch;
  font-size: 1.05rem;
  animation: fade-up 0.7s ease 0.18s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
  animation: fade-up 0.7s ease 0.26s both;
}

.section {
  padding: 4rem 0;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.5rem;
}

.section-sub {
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 42ch;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.feature {
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s, transform 0.2s;
}

.feature:hover {
  border-color: rgba(47, 214, 166, 0.45);
  transform: translateY(-3px);
}

.feature h3 {
  margin-bottom: 0.4rem;
  font-size: 1.1rem;
}

.feature p {
  color: var(--muted);
  font-size: 0.95rem;
}

.code-block {
  background: #071417;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  color: #c8efe3;
  white-space: pre;
  line-height: 1.6;
  box-shadow: var(--shadow);
}

/* Auth / forms */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: min(440px, 100%);
  background: rgba(10, 30, 35, 0.75);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  animation: fade-up 0.5s ease both;
}

.auth-card h1 {
  font-size: 1.6rem;
  margin: 0.75rem 0 0.25rem;
}

.auth-card .muted {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.form-group input,
.form-group select {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: rgba(47, 214, 166, 0.7);
  box-shadow: 0 0 0 3px rgba(47, 214, 166, 0.15);
}

.alert {
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.alert-error {
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: #ffc9c9;
}

.alert-ok {
  background: rgba(47, 214, 166, 0.12);
  border: 1px solid rgba(47, 214, 166, 0.35);
  color: #b8f5df;
}

.alert-info {
  background: rgba(255, 122, 89, 0.12);
  border: 1px solid rgba(255, 122, 89, 0.35);
  color: #ffd2c4;
}

/* Dashboard */
.dash-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-left: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar a {
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}

.sidebar a:hover,
.sidebar a.active {
  background: var(--surface-2);
  color: var(--text);
}

.main {
  padding: 1.5rem;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel h2 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.api-key-box {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.api-key-box code {
  flex: 1;
  min-width: 220px;
  background: #071417;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  word-break: break-all;
  font-size: 0.85rem;
  color: var(--accent);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.phone-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.phone-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-ok {
  background: rgba(47, 214, 166, 0.15);
  color: var(--ok);
}

.badge-pending {
  background: rgba(255, 122, 89, 0.15);
  color: #ffb499;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  text-align: right;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-weight: 500;
}

.empty {
  color: var(--muted);
  padding: 1rem 0;
}

.footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.demo-otp {
  font-family: var(--display);
  font-size: 1.8rem;
  letter-spacing: 0.25em;
  color: var(--accent);
  margin-top: 0.5rem;
}

.wa-qr-box {
  margin-top: 1.25rem;
  text-align: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.wa-qr-box p {
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.wa-qr-box img {
  width: 280px;
  height: 280px;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  padding: 0.5rem;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  from {
    transform: translateX(0) scale(1);
  }
  to {
    transform: translateX(-4%) scale(1.05);
  }
}

@keyframes pulse-mark {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(47, 214, 166, 0.15);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(47, 214, 166, 0.08);
  }
}

@media (max-width: 900px) {
  .features,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .dash-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-left: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
