@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
  --primary: #6366f1;
  --primary-hover: #5558e3;
  --secondary: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --dark: #1e293b;
  --gray: #64748b;
  --light: #f8fafc;
  --border: #e2e8f0;
  --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Tajawal', sans-serif;
  background: var(--light);
  color: var(--dark);
  line-height: 1.6;
  direction: rtl;
}

/* ======================== Layout ======================== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ======================== Navbar ======================== */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  padding: 14px 0;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 1.4rem; font-weight: 800; color: var(--primary); text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { text-decoration: none; color: var(--gray); font-weight: 500; }
.nav-links a:hover { color: var(--primary); }

/* ======================== Buttons ======================== */
.btn-primary {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 10px 22px; font-size: 1rem; font-family: inherit;
  cursor: pointer; text-decoration: none; font-weight: 600;
  transition: background .2s; display: inline-block;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary.btn-full { width: 100%; text-align: center; display: block; }

.btn-outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary); border-radius: 8px;
  padding: 10px 22px; font-size: 1rem; font-family: inherit;
  cursor: pointer; text-decoration: none; font-weight: 600;
  transition: all .2s; display: inline-block;
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-outline.btn-full { width: 100%; text-align: center; display: block; }

.btn-sm {
  padding: 5px 12px; font-size: .82rem; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  font-family: inherit; text-decoration: none; color: var(--dark);
  transition: all .15s; display: inline-block;
}
.btn-sm:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }

/* ======================== Hero ======================== */
.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff; padding: 80px 0;
  text-align: center;
}
.hero h1 { font-size: 2.6rem; font-weight: 800; margin-bottom: 12px; }
.hero p { font-size: 1.1rem; opacity: .9; margin-bottom: 40px; }

.shorten-form { max-width: 700px; margin: 0 auto; }
.form-row {
  display: flex; gap: 10px;
  background: #fff; border-radius: 12px; padding: 6px;
}
.form-row input {
  flex: 1; border: none; outline: none; padding: 10px 16px;
  font-size: 1rem; font-family: inherit; color: var(--dark); background: transparent;
}
.form-row button { flex-shrink: 0; }

.result-box {
  background: rgba(255,255,255,.15); backdrop-filter: blur(10px);
  border-radius: 12px; padding: 20px; margin-bottom: 24px; max-width: 700px; margin: 0 auto 24px;
}
.copy-row { display: flex; gap: 10px; margin: 10px 0; }
.copy-row input { flex: 1; padding: 8px 12px; border-radius: 8px; border: none; font-size: 1rem; }
.qr-preview { margin-top: 12px; }
.qr-preview img { border-radius: 8px; background: #fff; padding: 4px; }

/* ======================== Stats ======================== */
.stats-bar { background: #fff; padding: 32px 0; border-bottom: 1px solid var(--border); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; text-align: center; }
.stat-item {}
.stat-num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--gray); font-size: .9rem; }

/* ======================== Features ======================== */
.features { padding: 80px 0; }
.features h2 { text-align: center; font-size: 2rem; margin-bottom: 48px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.feature-card {
  background: #fff; border-radius: var(--radius); padding: 28px;
  box-shadow: var(--card-shadow); text-align: center; transition: transform .2s;
}
.feature-card:hover { transform: translateY(-4px); }
.feature-card .icon { font-size: 2rem; display: block; margin-bottom: 12px; }
.feature-card h3 { margin-bottom: 8px; }
.feature-card p { color: var(--gray); font-size: .9rem; }

/* ======================== Cards ======================== */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--card-shadow); padding: 24px; margin-bottom: 24px;
}
.card h2 { font-size: 1.2rem; margin-bottom: 20px; color: var(--dark); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-header h2 { margin-bottom: 0; }

/* ======================== Forms ======================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #374151; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 1rem; font-family: inherit; transition: border .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.form-group input:disabled { background: #f8fafc; color: var(--gray); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.form-row-3 input, .form-row-3 select { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: .95rem; font-family: inherit; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type=checkbox] { width: auto; }
.form-checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 20px; }

/* ======================== Alerts ======================== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .95rem; }
.alert-error { background: #fee2e2; color: #dc2626; }
.alert-success { background: #d1fae5; color: #059669; }

/* ======================== Auth ======================== */
.auth-wrapper { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 120px); padding: 40px 20px; }
.auth-card { background: #fff; border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 40px; width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 24px; text-align: center; }
.auth-footer { text-align: center; margin-top: 20px; color: var(--gray); }
.auth-footer a { color: var(--primary); }

/* ======================== Dashboard ======================== */
.dashboard-layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar { width: 240px; background: #fff; border-left: 1px solid var(--border); padding: 20px 0; flex-shrink: 0; }
.sidebar-user { padding: 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sidebar-user span { font-weight: 600; font-size: .9rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; }
.sidebar-nav a { display: block; padding: 10px 20px; color: var(--gray); text-decoration: none; font-weight: 500; border-right: 3px solid transparent; transition: all .15s; }
.sidebar-nav a:hover, .sidebar-nav a.active { color: var(--primary); background: rgba(99,102,241,.06); border-right-color: var(--primary); }
.dashboard-main { flex: 1; padding: 28px 0; overflow: hidden; }
.dashboard-stats { grid-template-columns: repeat(3, 1fr); }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--card-shadow); text-align: center;
}
.stat-card .stat-num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { color: var(--gray); font-size: .85rem; }

/* ======================== Table ======================== */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { padding: 10px 12px; text-align: right; background: #f8fafc; color: var(--gray); font-weight: 600; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }
.url-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gray); font-size: .85rem; }
.empty-state { text-align: center; color: var(--gray); padding: 40px; }

/* ======================== Badge ======================== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-active { background: #d1fae5; color: #059669; }
.badge-inactive { background: #f1f5f9; color: #64748b; }
.badge-blocked { background: #fee2e2; color: #dc2626; }
.badge-expired { background: #fef3c7; color: #d97706; }

/* ======================== Pricing ======================== */
.pricing-page { padding: 80px 0; }
.pricing-page h1 { text-align: center; font-size: 2.2rem; margin-bottom: 8px; }
.subtitle { text-align: center; color: var(--gray); margin-bottom: 48px; font-size: 1.1rem; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 28px; }
.pricing-card {
  background: #fff; border-radius: 16px; padding: 32px;
  box-shadow: var(--card-shadow); position: relative;
  border: 2px solid var(--border); transition: transform .2s;
}
.pricing-card:hover { transform: translateY(-4px); }
.pricing-card.featured { border-color: var(--primary); }
.featured-badge { position: absolute; top: -12px; right: 24px; background: var(--primary); color: #fff; padding: 4px 16px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.pricing-card h2 { font-size: 1.4rem; margin-bottom: 12px; }
.price { margin-bottom: 12px; }
.price-num { font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.price-period { color: var(--gray); }
.features-list { list-style: none; margin: 20px 0 28px; }
.features-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.features-list li.disabled { color: var(--gray); }

/* ======================== Search & Pagination ======================== */
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input { padding: 7px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; }
.search-form select { padding: 7px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; }
.pagination { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 1.5rem; }

/* ======================== Analytics ======================== */
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.bar-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.bar-count { font-weight: 700; color: var(--primary); }

/* ======================== Error pages ======================== */
.error-page { text-align: center; padding: 100px 20px; }
.error-page h1 { font-size: 6rem; color: var(--primary); font-weight: 800; }
.error-page h2 { font-size: 1.5rem; margin: 16px 0; }
.error-page p { color: var(--gray); margin-bottom: 32px; }

/* ======================== Footer ======================== */
.footer { background: #fff; border-top: 1px solid var(--border); padding: 20px 0; text-align: center; color: var(--gray); font-size: .9rem; margin-top: auto; }

/* ======================== Responsive ======================== */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .form-row { flex-direction: column; background: transparent; padding: 0; }
  .form-row input { border: 1.5px solid var(--border); border-radius: 8px; padding: 12px; background: #fff; }
  .stats-grid { grid-template-columns: 1fr; }
  .dashboard-layout { flex-direction: column; }
  .sidebar { width: 100%; border-left: none; border-bottom: 1px solid var(--border); }
  .sidebar-nav { display: flex; overflow-x: auto; padding: 0; }
  .sidebar-nav a { white-space: nowrap; border-right: none; border-bottom: 3px solid transparent; padding: 10px 16px; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
  .table { font-size: .8rem; }
}
