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

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --secondary: #06b6d4;
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.3);
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 36, 56, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px var(--primary-glow);

  --font-arabic: 'Cairo', system-ui, sans-serif;
  --font-code: 'Inter', monospace, sans-serif;
}

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

body {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.10) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.7) 0%, transparent 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
}

/* Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(9, 13, 22, 0.85);
  border-bottom: 1px solid var(--border-glass);
  padding: 1rem 0;
  transition: all 0.3s ease;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
  font-size: 1.3rem;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-link:hover {
  color: #fff;
  background: var(--bg-glass);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-arabic);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #fff;
  box-shadow: 0 4px 18px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.btn-download {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 1.15rem;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 22px var(--accent-glow);
}

.btn-download:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #ef4444;
  color: #fff;
}

/* Hero Section */
.hero {
  padding: 4.5rem 0 3rem;
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-full);
  color: #818cf8;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  animation: pulseGlow 3s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(99, 102, 241, 0); }
  50% { box-shadow: 0 0 16px rgba(99, 102, 241, 0.35); }
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 1.25rem;
  letter-spacing: -0.5px;
}

.hero-gradient {
  background: linear-gradient(135deg, #fff 30%, #94a3b8 60%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  max-width: 650px;
  margin: 0 auto 2rem;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1.8;
}

/* Search & Filter Bar */
.search-bar-wrap {
  max-width: 600px;
  margin: 0 auto 3rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 16px 54px 16px 20px;
  background: rgba(18, 24, 38, 0.85);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  color: #fff;
  font-family: var(--font-arabic);
  font-size: 1.05rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), var(--shadow-md);
}

.search-icon {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 1.2rem;
  pointer-events: none;
}

/* Category Filter Tabs */
.filter-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 2.5rem;
}

.tab-btn {
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-family: var(--font-arabic);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover, .tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* App Grid */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 4rem;
}

/* App Card */
.app-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.app-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.app-card:hover {
  transform: translateY(-6px);
  border-color: rgba(99, 102, 241, 0.35);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.15);
}

.app-card:hover::before {
  opacity: 1;
}

.app-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.app-icon {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.app-info {
  flex: 1;
  min-width: 0;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.app-pkg {
  font-family: var(--font-code);
  direction: ltr;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-glass);
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.meta-version {
  font-family: var(--font-code);
  font-weight: 700;
  color: var(--secondary);
}

/* App Detail Page */
.detail-hero {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin: 3rem 0;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  align-items: center;
}

@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .app-pkg {
    text-align: center;
  }
}

.detail-main {
  display: flex;
  gap: 28px;
  align-items: center;
}

@media (max-width: 600px) {
  .detail-main {
    flex-direction: column;
    text-align: center;
  }
}

.detail-icon {
  width: 110px;
  height: 110px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 2px solid var(--border-glass);
}

.detail-title {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 6px;
  color: #fff;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-glass);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(0, 0, 0, 0.25);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  text-align: center;
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius-md);
  margin-top: 8px;
  width: fit-content;
  margin-inline: auto;
}

.qr-label {
  font-size: 0.8rem;
  color: #334155;
  font-weight: 700;
}

/* Changelog & Versions Box */
.section-box {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.section-title i {
  color: var(--primary);
}

.changelog-content {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  border-right: 4px solid var(--accent);
  color: var(--text-main);
  white-space: pre-wrap;
  line-height: 1.8;
}

/* Releases list table */
.releases-table {
  width: 100%;
  border-collapse: collapse;
}

.releases-table th, .releases-table td {
  padding: 14px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border-glass);
}

.releases-table th {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.releases-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 4rem;
  color: var(--text-dim);
  margin-bottom: 16px;
  opacity: 0.6;
}

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-glass);
  background: rgba(9, 13, 22, 0.95);
  padding: 30px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.footer a {
  color: var(--text-muted);
}
.footer a:hover {
  color: var(--primary);
}
