/* ================================================
   Nevie Apps Platform – Main Stylesheet
   ================================================ */

:root {
  --app-primary: #6c63ff;
  --app-primary-dark: #5a52e0;
  --app-secondary: #ff6584;
  --app-accent: #43e97b;
  --app-dark: #0d0f1a;
  --app-dark-2: #12152a;
  --app-dark-3: #1a1e35;
  --app-card: #1e2238;
  --app-border: rgba(108, 99, 255, 0.15);
  --app-text-muted: #8b8fa8;
  --app-gradient: linear-gradient(135deg, #6c63ff 0%, #a855f7 100%);
  --app-gradient-hero: linear-gradient(135deg, #0d0f1a 0%, #12152a 50%, #1a0a2e 100%);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--app-dark);
  color: #e2e4f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--app-dark-2); }
::-webkit-scrollbar-thumb { background: var(--app-primary); border-radius: 3px; }

/* ---- Navbar ---- */
#mainNav {
  background: rgba(13, 15, 26, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--app-border);
  padding: 0.75rem 0;
  transition: all 0.3s ease;
}

#mainNav .brand-icon {
  width: 36px; height: 36px;
  background: var(--app-gradient);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
}

#mainNav .nav-link {
  color: rgba(226, 228, 240, 0.75);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

#mainNav .nav-link:hover,
#mainNav .nav-link.active {
  color: #fff;
  background: rgba(108, 99, 255, 0.12);
}

/* ---- Hero Section ---- */
.hero-section {
  background: var(--app-gradient-hero);
  position: relative;
  overflow: hidden;
  padding: 120px 0 100px;
  min-height: 90vh;
  display: flex; align-items: center;
}

.hero-section::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(108, 99, 255, 0.18) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 80%, rgba(168, 85, 247, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid rgba(108, 99, 255, 0.35);
  color: #a5b4fc;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 1.25rem;
}

.hero-title .gradient-text {
  background: var(--app-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--app-text-muted);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 2rem;
}

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn-primary {
  background: var(--app-gradient);
  border: none;
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  transition: opacity 0.2s, transform 0.2s;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-outline-light {
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  border-radius: 8px;
  padding: 0.6rem 1.5rem;
  transition: all 0.2s;
}

.btn-outline-light:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}

/* ---- Hero visual ---- */
.hero-visual {
  position: relative;
}

.hero-phone-mockup {
  width: 260px;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 32px;
  padding: 12px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(108,99,255,0.2);
  margin: 0 auto;
  position: relative;
}

.phone-screen {
  background: #0f1121;
  border-radius: 22px;
  overflow: hidden;
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  color: #a5b4fc;
  padding: 16px;
  min-height: 420px;
}

.phone-statusbar {
  display: flex; justify-content: space-between;
  font-size: 0.5rem; color: #6b7280; margin-bottom: 12px;
}

.code-line { margin: 2px 0; line-height: 1.6; }
.code-kw { color: #c084fc; }
.code-str { color: #86efac; }
.code-cm { color: #4b5563; }
.code-fn { color: #93c5fd; }
.code-cursor {
  display: inline-block; width: 2px; height: 12px;
  background: var(--app-primary);
  animation: blink 1s step-end infinite;
  vertical-align: middle; margin-left: 1px;
}

@keyframes blink { 50% { opacity: 0; } }

.glow-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.glow-1 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(108,99,255,0.15) 0%, transparent 70%);
  top: -60px; right: -60px;
}

.glow-2 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(168,85,247,0.12) 0%, transparent 70%);
  bottom: -40px; left: -40px;
}

/* ---- Stats Bar ---- */
.stats-bar {
  background: var(--app-dark-2);
  border-top: 1px solid var(--app-border);
  border-bottom: 1px solid var(--app-border);
  padding: 24px 0;
}

.stat-item { text-align: center; }
.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  background: var(--app-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 0.8rem; color: var(--app-text-muted); font-weight: 500; }

/* ---- Section Titles ---- */
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.section-subtitle {
  color: var(--app-text-muted);
  font-size: 1.05rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ---- Feature Cards ---- */
.features-section { padding: 100px 0; background: var(--app-dark); }

.feature-card {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 16px;
  padding: 2rem;
  height: 100%;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(108, 99, 255, 0.4);
  box-shadow: 0 20px 40px rgba(108, 99, 255, 0.1);
}

.feature-icon {
  width: 52px; height: 52px;
  background: rgba(108, 99, 255, 0.12);
  border: 1px solid rgba(108, 99, 255, 0.2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  transition: background 0.2s;
}

.feature-card:hover .feature-icon {
  background: rgba(108, 99, 255, 0.25);
}

.feature-card h5 { color: #fff; font-weight: 700; margin-bottom: 0.5rem; }
.feature-card p { color: var(--app-text-muted); font-size: 0.9rem; line-height: 1.6; }

/* ---- Why Section ---- */
.why-section { padding: 100px 0; background: var(--app-dark-2); }

.why-card {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 1.5rem;
}

.why-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  background: var(--app-gradient);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.2rem;
}

/* ---- Download Section ---- */
.download-section {
  padding: 100px 0;
  background: var(--app-dark);
}

.download-card {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 20px;
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
}

.download-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--app-gradient);
}

.version-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(67, 233, 123, 0.1);
  border: 1px solid rgba(67, 233, 123, 0.25);
  color: #4ade80;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
}

.hash-box {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  color: var(--app-text-muted);
  word-break: break-all;
}

/* ---- Changelog Section ---- */
.changelog-section { padding: 100px 0; background: var(--app-dark-2); }

.changelog-card {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-left: 3px solid var(--app-primary);
  border-radius: 12px;
  padding: 1.75rem;
  height: 100%;
  transition: border-color 0.2s;
}

.changelog-card:hover { border-left-color: #a855f7; }

.changelog-version {
  font-size: 1.1rem; font-weight: 800; color: #fff;
}

.changelog-date {
  font-size: 0.8rem; color: var(--app-text-muted);
}

.changelog-tag {
  font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 100px;
}

.tag-feature { background: rgba(108,99,255,0.15); color: #a5b4fc; }
.tag-fix { background: rgba(239,68,68,0.12); color: #f87171; }
.tag-improve { background: rgba(67,233,123,0.12); color: #4ade80; }

/* ---- Cards Generic ---- */
.app-card {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 16px;
}

/* ---- Footer ---- */
.footer {
  background: var(--app-dark-2);
  border-top: 1px solid var(--app-border);
  margin-top: auto;
}

.footer-link {
  color: var(--app-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}
.footer-link:hover { color: #a5b4fc; }

/* ---- Admin Layout ---- */
.admin-sidebar {
  width: 260px; min-height: 100vh;
  background: var(--app-dark-2);
  border-right: 1px solid var(--app-border);
  position: fixed; top: 0; left: 0; z-index: 100;
  display: flex; flex-direction: column;
}

.admin-content {
  margin-left: 260px;
  min-height: 100vh;
  background: var(--app-dark);
}

.admin-topbar {
  background: var(--app-dark-2);
  border-bottom: 1px solid var(--app-border);
  padding: 1rem 1.5rem;
  position: sticky; top: 0; z-index: 50;
}

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--app-text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  margin: 1px 0;
}

.sidebar-link:hover, .sidebar-link.active {
  background: rgba(108, 99, 255, 0.12);
  color: #a5b4fc;
}

.sidebar-link.active { color: #c4b5fd; font-weight: 600; }

.stat-card {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 16px;
  padding: 1.5rem;
}

.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}

/* ---- Table ---- */
.table-dark-custom { --bs-table-bg: transparent; }
.table-dark-custom thead th { color: var(--app-text-muted); font-size: 0.8rem; font-weight: 600; border-bottom-color: var(--app-border); letter-spacing: 0.05em; text-transform: uppercase; }
.table-dark-custom tbody td { border-color: var(--app-border); vertical-align: middle; color: #d1d5db; }
.table-dark-custom tbody tr:hover td { background: rgba(108,99,255,0.05); }

/* ---- Form Styles ---- */
.form-control, .form-select {
  background-color: var(--app-dark-3);
  border-color: var(--app-border);
  color: #e2e4f0;
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  background-color: var(--app-dark-3);
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
  color: #e2e4f0;
}
.form-label { color: #c4c9e0; font-size: 0.875rem; font-weight: 500; }
.form-text { color: var(--app-text-muted); }
textarea.form-control { resize: vertical; }

/* ---- Alert ---- */
.alert-success { background: rgba(67,233,123,0.1); border-color: rgba(67,233,123,0.25); color: #4ade80; }
.alert-danger { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.25); color: #f87171; }

/* ---- Login ---- */
.login-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--app-gradient-hero);
}

.login-card {
  width: 100%; max-width: 420px;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 20px;
  padding: 2.5rem;
}

/* ---- Utilities ---- */
.text-muted { color: var(--app-text-muted) !important; }
.border-dark-custom { border-color: var(--app-border) !important; }
.bg-dark-2 { background-color: var(--app-dark-2) !important; }
.bg-card { background-color: var(--app-card) !important; }

/* ---- Pagination ---- */
.page-link {
  background: var(--app-card);
  border-color: var(--app-border);
  color: var(--app-text-muted);
  border-radius: 6px;
  margin: 0 2px;
}
.page-link:hover { background: rgba(108,99,255,0.15); color: #a5b4fc; border-color: var(--app-border); }
.page-item.active .page-link { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }

/* ---- HTMX Loading ---- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }

/* ---- Responsive ---- */
@media (max-width: 991px) {
  .admin-sidebar { display: none; }
  .admin-content { margin-left: 0; }
  .hero-section { padding: 80px 0 60px; min-height: auto; }
}

@media (max-width: 576px) {
  .hero-phone-mockup { width: 220px; }
  .hero-actions { flex-direction: column; }
}
