/* ==========================================================================
   AI8GHT STUDIO - DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

:root {
  --bg-dark: #07090e;
  --bg-card: rgba(15, 20, 32, 0.75);
  --bg-card-hover: rgba(22, 30, 48, 0.85);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-card-hover: rgba(0, 242, 254, 0.3);
  
  --primary-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --purple-gradient: linear-gradient(135deg, #7928ca 0%, #ff0080 100%);
  --cyan-glow: rgba(0, 242, 254, 0.25);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-cyan: #00f2fe;
  --accent-blue: #38bdf8;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --status-live: #10b981;
  --status-beta: #f59e0b;
  --status-dev: #3b82f6;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* RESET & BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* BACKGROUND ORBS & GRID */
.bg-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -2;
  pointer-events: none;
}

.glow-orb {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.25;
}

.glow-orb-1 { top: -100px; left: -100px; background: #7928ca; }
.glow-orb-2 { bottom: -100px; right: -100px; background: #00f2fe; }

/* TYPOGRAPHY & UTILITIES */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.text-center { text-align: center; }
.hidden { display: none !important; }

/* NAVBAR */
.navbar-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 9, 14, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-card);
  padding: 14px 0;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.3));
}

.brand-text { display: flex; flex-direction: column; }

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-labs {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: var(--purple-gradient);
  border-radius: var(--radius-full);
  color: white;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.brand-subtitle { font-size: 0.72rem; color: var(--text-muted); }

/* SEARCH BOX */
.search-box {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.88rem;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: rgba(18, 24, 38, 0.8);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px var(--cyan-glow);
}

/* NAV ACTIONS */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--status-live);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--status-live);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--status-live);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--accent-cyan);
}

.user-name { font-size: 0.82rem; font-weight: 600; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #000;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.5);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px;
  transition: var(--transition-fast);
}

.btn-icon:hover { color: #f43f5e; }

/* HERO SECTION */
.hero-section { padding: 50px 0 30px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(121, 40, 202, 0.15);
  border: 1px solid rgba(121, 40, 202, 0.3);
  border-radius: var(--radius-full);
  color: var(--accent-purple);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero-title { font-size: 2.8rem; line-height: 1.18; margin-bottom: 16px; }

.hero-description {
  max-width: 680px;
  margin: 0 auto 36px;
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* STATS BAR */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.stat-label { font-size: 0.82rem; color: var(--text-muted); }

/* CATEGORY TABS */
.filters-section { margin: 36px 0 24px; }

.category-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: rgba(18, 24, 38, 0.6);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn:hover { color: var(--text-main); border-color: rgba(255, 255, 255, 0.2); }

.tab-btn.active {
  background: var(--primary-gradient);
  color: #000;
  border-color: transparent;
  box-shadow: 0 0 15px var(--cyan-glow);
}

/* APPS GRID */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

.app-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.app-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: var(--border-card-hover);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--cyan-glow);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.app-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.1) 0%, rgba(121, 40, 202, 0.1) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.status-live { background: rgba(16, 185, 129, 0.15); color: var(--status-live); border: 1px solid rgba(16, 185, 129, 0.3); }
.status-beta { background: rgba(245, 158, 11, 0.15); color: var(--status-beta); border: 1px solid rgba(245, 158, 11, 0.3); }
.status-dev { background: rgba(59, 130, 246, 0.15); color: var(--status-dev); border: 1px solid rgba(59, 130, 246, 0.3); }

.app-title { font-size: 1.2rem; margin-bottom: 6px; }
.app-category { font-size: 0.78rem; color: var(--accent-cyan); font-weight: 600; text-transform: uppercase; margin-bottom: 8px; }
.app-description { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 16px; flex-grow: 1; }

.app-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

.tag-pill {
  font-size: 0.72rem;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.app-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border-card);
  padding-top: 14px;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.wide-modal { max-width: 640px; }

.modal-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.modal-logo { height: 42px; margin-bottom: 10px; }
.modal-title { font-size: 1.5rem; margin-bottom: 4px; }
.modal-subtitle { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 20px; }

/* FORMS */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 11px 14px;
  background: rgba(10, 14, 24, 0.8);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.btn-full { width: 100%; padding: 12px; margin-top: 10px; }

.alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  margin-bottom: 16px;
}

.alert-error { background: rgba(244, 63, 94, 0.15); border: 1px solid rgba(244, 63, 94, 0.3); color: #f43f5e; }
.alert-success { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--status-live); }

.db-notice { font-size: 0.75rem; color: var(--text-dim); margin-top: 16px; }
.db-notice code { color: var(--accent-cyan); background: rgba(255, 255, 255, 0.05); padding: 2px 6px; border-radius: 4px; }

/* FOOTER */
.footer-wrapper {
  border-top: 1px solid var(--border-card);
  padding: 24px 0;
  background: rgba(7, 9, 14, 0.95);
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.footer-logo { height: 26px; }
.footer-title { font-family: var(--font-heading); font-weight: 700; font-size: 1rem; }
.footer-copy { font-size: 0.8rem; color: var(--text-muted); }

.loading-spinner-container {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 0;
  color: var(--text-muted);
}

.spinner { font-size: 2.2rem; color: var(--accent-cyan); margin-bottom: 12px; }

/* ==========================================================================
   TABLET & MOBILE RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */

@media (max-width: 992px) {
  .navbar { flex-wrap: wrap; }
  .search-box { order: 3; max-width: 100%; flex-basis: 100%; margin-top: 10px; }
  .hero-title { font-size: 2.2rem; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat-value { font-size: 1.6rem; }
  .stat-label { font-size: 0.75rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .ratios-container { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .container { padding: 0 14px; }
  .navbar-wrapper { padding: 10px 0; }
  .brand-logo { height: 32px; }
  .brand-title { font-size: 1.05rem; }
  .brand-subtitle { display: none; }
  .server-status-pill { display: none; }
  .nav-actions { gap: 8px; }
  .btn { padding: 8px 14px; font-size: 0.8rem; }
  
  .hero-section { padding: 30px 0 20px; }
  .hero-title { font-size: 1.8rem; }
  .hero-description { font-size: 0.92rem; }
  
  .stats-grid { grid-template-columns: 1fr; gap: 8px; }
  .stat-card { padding: 12px; }

  .category-tabs { gap: 6px; }
  .tab-btn { padding: 7px 12px; font-size: 0.78rem; }

  .apps-grid { grid-template-columns: 1fr; gap: 14px; }
  .app-card { padding: 16px; }

  .scenario-bar { flex-direction: column; align-items: stretch; padding: 12px; }
  .scenario-buttons { flex-direction: column; }
  .scenario-btn { width: 100%; justify-content: center; }

  .upload-card { padding: 24px 14px; }
  .upload-icon { font-size: 2rem; }
  .upload-title { font-size: 1.05rem; }

  .ratios-container { grid-template-columns: 1fr; gap: 10px; }
  .decision-hero-card { flex-direction: column; text-align: center; }
  .decision-status-pill { font-size: 1.1rem; padding: 8px 16px; }
  
  .modal-content { padding: 20px; }
  .modal-title { font-size: 1.3rem; }
}
