/* ═══════════════════════════════════════════════
   X7TV — Global Styles (Arabic RTL / English LTR)
   ═══════════════════════════════════════════════ */

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

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --border: rgba(255,255,255,0.08);
  --primary: #7c3aed;
  --primary-light: #a78bfa;
  --primary-glow: rgba(124,58,237,0.3);
  --accent: #06b6d4;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #475569;
  --ts-color: #f59e0b;
  --cert-color: #10b981;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: 'Cairo', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ─── Navbar ─────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  font-size: 1.6rem; font-weight: 900; color: var(--text);
  text-decoration: none; letter-spacing: -1px;
}
.logo span { color: var(--primary-light); }
.nav-actions {
  display: flex; align-items: center; gap: 10px;
}
.nav-user-area {
  display: flex; align-items: center; gap: 8px;
  color: var(--text2); font-size: 0.9rem;
}

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px;
  border-radius: var(--radius-sm); border: none;
  font-family: var(--font); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: all 0.2s ease; white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 20px var(--primary-glow);
}
.btn-primary:hover { background: #6d28d9; transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--primary-light);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-glow); }
.btn-ghost {
  background: transparent; color: var(--text2);
}
.btn-ghost:hover { color: var(--text); background: var(--bg3); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-disabled { background: var(--bg3); color: var(--text3); cursor: not-allowed; }
.btn-lang {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); padding: 6px 12px;
  border-radius: 8px; font-family: var(--font);
  cursor: pointer; font-size: 0.82rem; font-weight: 700;
  transition: all 0.2s;
}
.btn-lang:hover { color: var(--text); border-color: var(--primary); }

/* ─── Hero ────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  padding: 100px 0 80px;
  text-align: center;
}
.hero-glow {
  position: absolute; top: -100px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero-badge {
  display: inline-block;
  background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.3);
  color: var(--primary-light); padding: 6px 16px; border-radius: 100px;
  font-size: 0.85rem; font-weight: 600; margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 900; line-height: 1.2;
  margin-bottom: 20px;
}
.hero-sub {
  font-size: 1.1rem; color: var(--text2);
  max-width: 540px; margin: 0 auto 36px;
}
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 56px; }
.hero-stats { display: flex; align-items: center; justify-content: center; gap: 32px; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat span { font-size: 2rem; font-weight: 900; color: var(--primary-light); }
.stat label { font-size: 0.85rem; color: var(--text2); }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

/* ─── Filter Bar ───────────────────────────────────────── */
.filter-bar {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.filter-bar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; }
.filter-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); padding: 8px 18px; border-radius: 100px;
  font-family: var(--font); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.search-input {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 10px 18px; border-radius: 100px;
  font-family: var(--font); font-size: 0.9rem; outline: none;
  min-width: 220px; transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--primary); }

/* ─── Apps Grid ────────────────────────────────────────── */
.apps-section { padding: 48px 0; }
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.app-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  text-decoration: none; color: var(--text);
  transition: all 0.25s ease;
  display: flex; flex-direction: column; gap: 14px;
}
.app-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px var(--primary-glow);
}
.app-icon-wrap { display: flex; justify-content: center; }
.app-icon {
  width: 80px; height: 80px; border-radius: 18px;
  object-fit: cover; box-shadow: var(--shadow);
}
.app-icon-placeholder {
  width: 80px; height: 80px; border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 900; color: #fff;
}
.app-info { flex: 1; }
.app-name {
  font-size: 0.95rem; font-weight: 700;
  margin-bottom: 8px; text-align: center;
}
.app-badges {
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
  margin-bottom: 8px;
}
.app-date { font-size: 0.75rem; color: var(--text3); text-align: center; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  height: 200px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 100px;
  font-size: 0.72rem; font-weight: 700;
}
.badge-ts { background: rgba(245,158,11,0.15); color: var(--ts-color); border: 1px solid rgba(245,158,11,0.3); }
.badge-cert { background: rgba(16,185,129,0.15); color: var(--cert-color); border: 1px solid rgba(16,185,129,0.3); }
.badge-count { background: var(--bg3); color: var(--text2); }
.badge-free { background: rgba(16,185,129,0.15); color: var(--cert-color); }
.badge-paid { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-freemium { background: rgba(245,158,11,0.15); color: var(--ts-color); }
.badge-pending { background: var(--bg3); color: var(--text3); }

/* ─── Pricing Section ──────────────────────────────────── */
.pricing-section { padding: 80px 0; background: var(--bg2); }
.section-header { text-align: center; margin-bottom: 48px; }
.section-header h2 { font-size: 2rem; font-weight: 900; margin-bottom: 8px; }
.section-header p { color: var(--text2); }
.plans-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px; max-width: 900px; margin: 0 auto;
}
.plan-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px 28px;
  position: relative; transition: all 0.25s;
}
.plan-card:hover { border-color: var(--primary); transform: translateY(-4px); }
.plan-popular {
  border-color: var(--primary);
  box-shadow: 0 0 40px var(--primary-glow);
}
.plan-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff;
  padding: 4px 16px; border-radius: 100px; font-size: 0.8rem; font-weight: 700;
}
.plan-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; text-align: center; }
.plan-price { text-align: center; margin-bottom: 24px; }
.price-amount { font-size: 2.5rem; font-weight: 900; color: var(--primary-light); }
.price-currency { color: var(--text2); font-size: 1rem; margin-right: 4px; }
.plan-features { list-style: none; margin-bottom: 28px; }
.plan-features li { padding: 8px 0; color: var(--text2); font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.plan-features li:last-child { border: none; }

/* ─── App Detail ────────────────────────────────────────── */
.app-hero { padding: 60px 0 40px; }
.app-hero-inner {
  display: flex; align-items: center; gap: 32px;
}
.app-hero-icon { flex-shrink: 0; }
.app-icon-placeholder-lg {
  width: 120px; height: 120px; border-radius: 28px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; font-weight: 900; color: #fff;
}
.app-hero-icon img { width: 120px; height: 120px; border-radius: 28px; object-fit: cover; }
.app-hero-name { font-size: 2rem; font-weight: 900; margin-bottom: 12px; }
.app-meta { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.meta-item { color: var(--text2); font-size: 0.88rem; }
.meta-label { color: var(--text3); margin-left: 4px; }
.detail-desc {
  margin: 32px 0; color: var(--text2); line-height: 1.8;
  max-width: 720px;
}

/* ─── Tweaks ────────────────────────────────────────────── */
.tweaks-section { padding-bottom: 80px; }
.tabs {
  display: flex; gap: 4px; margin-bottom: 24px;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.tab-btn {
  background: none; border: none; color: var(--text2);
  font-family: var(--font); font-size: 1rem; font-weight: 600;
  padding: 12px 24px; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.2s;
}
.tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary); }
.tweak-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 12px; transition: border-color 0.2s;
}
.tweak-card:hover { border-color: var(--border); }
.tweak-not-ready { opacity: 0.6; }
.tweak-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tweak-name { font-size: 1rem; font-weight: 700; }
.tweak-badges { display: flex; gap: 4px; }
.tweak-meta { display: flex; gap: 12px; color: var(--text2); font-size: 0.82rem; }
.tweak-action { flex-shrink: 0; }

/* Subscribe CTA */
.subscribe-cta { background: var(--bg2); border-top: 1px solid var(--border); padding: 40px 0; }
.cta-box { text-align: center; }
.cta-box h3 { font-size: 1.5rem; font-weight: 900; margin-bottom: 8px; }
.cta-box p { color: var(--text2); margin-bottom: 24px; }

/* ─── Auth ───────────────────────────────────────────────── */
.auth-page { display: flex; flex-direction: column; min-height: 100vh; }
.auth-container {
  flex: 1; display: flex; align-items: center;
  justify-content: center; padding: 40px 24px;
}
.auth-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px;
  width: 100%; max-width: 420px;
}
.auth-logo {
  font-size: 2rem; font-weight: 900; text-align: center;
  margin-bottom: 24px; color: var(--text);
}
.auth-logo span { color: var(--primary-light); }
.auth-title { font-size: 1.5rem; font-weight: 900; text-align: center; margin-bottom: 6px; }
.auth-sub { color: var(--text2); text-align: center; margin-bottom: 28px; }
.auth-switch { text-align: center; color: var(--text2); font-size: 0.88rem; margin-top: 20px; }
.auth-switch a { color: var(--primary-light); text-decoration: none; }

/* ─── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.88rem; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 12px 16px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.9rem; outline: none;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 100px; }
.input-pw-wrap { position: relative; }
.input-pw-wrap .form-input { padding-left: 40px; }
[dir="ltr"] .input-pw-wrap .form-input { padding-right: 40px; padding-left: 16px; }
.pw-toggle {
  position: absolute; top: 50%; transform: translateY(-50%);
  left: 12px; background: none; border: none; cursor: pointer; font-size: 1rem;
}
[dir="ltr"] .pw-toggle { left: auto; right: 12px; }

/* ─── Alerts ─────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }

/* ─── Loading ────────────────────────────────────────────── */
.loading-center { display: flex; justify-content: center; padding: 60px; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Misc ───────────────────────────────────────────────── */
.no-results { text-align: center; color: var(--text3); padding: 60px 0; font-size: 1.1rem; }
.error-msg { text-align: center; color: #f87171; padding: 40px; }
.footer { background: var(--bg2); border-top: 1px solid var(--border); padding: 32px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; }
.footer p { color: var(--text3); font-size: 0.85rem; }

/* Plan mini */
.plan-list-mini { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.plan-mini-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 18px;
  display: flex; justify-content: space-between;
  cursor: pointer; transition: all 0.2s;
}
.plan-mini-card:hover, .plan-mini-card.selected { border-color: var(--primary); }
.plan-mini-name { font-weight: 600; }
.plan-mini-price { color: var(--primary-light); font-weight: 700; }
.plan-select-title { font-size: 1.1rem; font-weight: 700; text-align: center; margin-bottom: 16px; }

/* ─── Admin ──────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--bg2);
  border-left: 1px solid var(--border); /* RTL */
  padding: 24px 0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
[dir="ltr"] .sidebar { border-left: none; border-right: 1px solid var(--border); }
.sidebar-logo { padding: 0 24px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-logo .logo { font-size: 1.4rem; }
.sidebar-menu { list-style: none; }
.sidebar-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 24px; color: var(--text2);
  text-decoration: none; font-size: 0.92rem; font-weight: 600;
  transition: all 0.2s;
}
.sidebar-menu a:hover, .sidebar-menu a.active {
  color: var(--text); background: var(--bg3);
  border-left: 3px solid var(--primary); /* RTL: right */
}
[dir="ltr"] .sidebar-menu a:hover, [dir="ltr"] .sidebar-menu a.active {
  border-left: none; border-right: 3px solid var(--primary);
}
.sidebar-menu .icon { font-size: 1.1rem; }
.admin-content { flex: 1; padding: 32px; overflow-y: auto; background: var(--bg); }
.admin-header { margin-bottom: 28px; }
.admin-header h1 { font-size: 1.6rem; font-weight: 900; }
.admin-header p { color: var(--text2); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px; text-align: center;
}
.stat-card .stat-num { font-size: 2rem; font-weight: 900; color: var(--primary-light); }
.stat-card .stat-label { color: var(--text2); font-size: 0.85rem; }

/* Table */
.table-wrap { overflow-x: auto; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; text-align: right; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
[dir="ltr"] th, [dir="ltr"] td { text-align: left; }
th { color: var(--text2); font-weight: 700; background: var(--bg3); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-size: 1.2rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 1.4rem; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* Log output */
.log-output {
  background: #000; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; font-family: monospace; font-size: 0.8rem;
  color: #a0f080; max-height: 300px; overflow-y: auto;
  white-space: pre-wrap; margin-top: 12px;
}

/* Status badges */
.status-ready { color: var(--cert-color); }
.status-pending { color: var(--ts-color); }
.status-processing { color: var(--accent); }
.status-failed { color: var(--danger); }
.status-no_files { color: var(--text3); }
.status-no_ipa { color: #f59e0b; }
.status-has_ipa { color: #0ea5e9; }

/* File upload area */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 32px; text-align: center; cursor: pointer;
  transition: border-color 0.2s; color: var(--text2);
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--primary); color: var(--primary-light); }

/* Toggle */
.toggle { display: flex; gap: 8px; align-items: center; }
.toggle input[type=checkbox] { width: 40px; height: 22px; appearance: none;
  background: var(--bg3); border-radius: 100px; cursor: pointer;
  position: relative; transition: background 0.2s; }
.toggle input[type=checkbox]::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--text2);
  transition: transform 0.2s, background 0.2s;
}
.toggle input[type=checkbox]:checked { background: var(--primary); }
.toggle input[type=checkbox]:checked::after { transform: translateX(18px); background: #fff; }

/* Search admin */
.admin-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}

@media (max-width: 768px) {
  .sidebar { width: 56px; }
  .sidebar-menu a span { display: none; }
  .sidebar-logo .logo { display: none; }
  .app-hero-inner { flex-direction: column; text-align: center; }
  .hero-btns { flex-direction: column; align-items: center; }
  .filter-bar .container { flex-direction: column; }
}
