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

:root {
  --bg: #0b0d13;
  --bg-gradient: linear-gradient(180deg, #0f131d 0%, #0b0d13 100%);
  --panel-bg: rgba(19, 24, 38, 0.6);
  --panel-border: rgba(255, 255, 255, 0.05);
  --panel-border-hover: rgba(255, 255, 255, 0.1);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  
  /* Soft Soothing Pastel Accents (Low Glare) */
  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.12);
  --accent-violet: #a78bfa;
  --accent-violet-glow: rgba(167, 139, 250, 0.12);
  --accent-emerald: #34d399;
  --accent-emerald-glow: rgba(52, 211, 153, 0.12);
  --accent-rose: #fb7185;
  --accent-rose-glow: rgba(251, 113, 133, 0.12);
  
  --glass-blur: blur(20px);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  position: relative;
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center top;
  mask-image: radial-gradient(ellipse at 50% 0%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black 20%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Typography Extensions */
h1, h2, h3, h4, .brand-font {
  font-family: 'Outfit', sans-serif;
  font-weight: 600; /* Softer weight than 700 */
  letter-spacing: -0.01em;
}

/* Background Glowing Orbs */
.glow-orb {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(150px);
  opacity: 0.08; /* Highly reduced glare */
  z-index: 0;
}
.orb-1 {
  background: var(--accent-violet);
  top: -100px;
  left: 10%;
}
.orb-2 {
  background: var(--accent-cyan);
  bottom: 10%;
  right: 5%;
}

/* Layout Shell */
header {
  position: sticky;
  top: 0;
  background: rgba(11, 13, 19, 0.8);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--panel-border);
  z-index: 100;
  transition: var(--transition-fast);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(167, 139, 250, 0.2);
  font-size: 18px;
  color: #fff;
  font-weight: bold;
}

.logo-text {
  font-size: 22px;
  font-weight: 700; /* Softer weight */
  background: linear-gradient(to right, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--panel-bg);
  border-color: var(--panel-border);
}

/* Page Wrappers */
main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 24px;
  z-index: 10;
  position: relative;
}

.page-view {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-view.active {
  display: block;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 60px 0 40px 0;
  max-width: 800px;
  margin: 0 auto;
}

.hero-tag {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  display: inline-block;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.hero-section h1 {
  font-size: 48px;
  line-height: 1.1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-section p {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 30px;
}

/* Cards & Grid Layouts */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 30px;
}

.card {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(250px circle at var(--mouse-x, 0px) var(--mouse-y, 0px), rgba(255, 255, 255, 0.035), transparent 80%);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.card:hover::after {
  opacity: 1;
}

.card-header, .card h3, .card p, .card-footer {
  position: relative;
  z-index: 2;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan));
  opacity: 0;
  transition: var(--transition-fast);
}

.card:hover {
  transform: translateY(-5px);
  border-color: var(--panel-border-hover);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

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

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

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05);
}

.card-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 6px;
}

.tag-game { background: rgba(244, 63, 94, 0.12); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.2); }
.tag-chat { background: rgba(139, 92, 246, 0.12); color: var(--accent-violet); border: 1px solid rgba(139, 92, 246, 0.2); }
.tag-collab { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.2); }
.tag-custom { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); border: 1px solid rgba(6, 182, 212, 0.2); }

.card h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
  flex: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 16px;
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: white;
}

.username {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.action-btn {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-violet-glow));
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: white;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 8px rgba(167, 139, 250, 0.1);
  text-decoration: none;
  text-align: center;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(167, 139, 250, 0.2);
}

.action-btn:active {
  transform: translateY(0);
}

/* Secondary Button style */
.sec-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sec-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

/* Filter Controls */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  flex-wrap: wrap;
  gap: 15px;
}

.search-box {
  position: relative;
  max-width: 320px;
  width: 100%;
}

.search-box input {
  width: 100%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 16px 10px 40px;
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition-fast);
}

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

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

.category-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.filter-chip:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.filter-chip.active {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-cyan-glow));
  border-color: var(--accent-cyan);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(6, 182, 212, 0.2);
}

/* App Runner Layout (Device Simulator & SDK Debugger) */
.runner-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  margin-top: 20px;
  height: calc(100vh - 160px);
}

.preview-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Keeps the preview header anchored at the top */
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.preview-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  z-index: 10;
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-title h2 {
  font-size: 18px;
}

.preview-title span {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 4px;
}

.device-selectors {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}

.device-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: var(--transition-fast);
}

.device-btn:hover {
  color: var(--text-primary);
}

.device-btn.active {
  background: var(--accent-cyan);
  color: #fff;
}

/* Device Shells */
.device-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
  min-height: 0; /* Let flex item shrink and respect layout bounds */
}

.device-shell {
  box-sizing: border-box;
  background: #000;
  border-radius: 12px;
  border: 2px solid var(--panel-border);
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  transition: var(--transition-normal);
}

/* Device Shell Sizes */
.device-shell.desktop {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.device-shell.tablet {
  height: 100%;
  max-height: 640px;
  aspect-ratio: 768 / 1024;
  width: auto;
  max-width: 100%;
  border: 10px solid #1c1f2e;
  border-radius: 24px;
}

.device-shell.mobile {
  height: 100%;
  max-height: 667px;
  aspect-ratio: 375 / 667;
  width: auto;
  max-width: 100%;
  border: 12px solid #1c1f2e;
  border-radius: 36px;
}

/* Sandbox Iframe */
.device-shell iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* Right-side SDK panel */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.sidebar-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
}

.sidebar-card h3 {
  font-size: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.sidebar-card h3 span {
  color: var(--accent-emerald);
}

.info-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 10px;
}

.info-item .label { color: var(--text-secondary); }
.info-item .val { font-weight: bold; }

/* DB Debugger Live List */
.db-debugger-list {
  font-family: monospace;
  font-size: 12px;
  max-height: 250px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.db-debugger-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.db-debugger-key {
  color: var(--accent-cyan);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-debugger-val {
  color: var(--accent-violet);
  word-break: break-all;
}

.db-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 20px 0;
}

/* Studio Editor page */
.studio-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 24px;
  margin-top: 20px;
  min-height: 500px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition-fast);
}

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

/* Code Editor container */
.code-editor-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  overflow: hidden;
  height: 550px;
}

.editor-header {
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
}

.editor-header h3 {
  font-size: 14px;
  font-family: monospace;
}

.code-textarea {
  flex: 1;
  background: #090b11;
  color: #bae6fd; /* Soothing soft blue instead of neon green */
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.5;
  padding: 20px;
  border: none;
  resize: none;
  outline: none;
  tab-size: 4;
}

/* Prompt Box under code */
.ai-helper-box {
  background: rgba(139, 92, 246, 0.05);
  border-top: 1px solid rgba(139, 92, 246, 0.2);
  padding: 12px 20px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.ai-helper-box input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 8px;
  padding: 10px 16px;
  color: white;
  font-size: 13px;
  transition: var(--transition-fast);
}

.ai-helper-box input:focus {
  outline: none;
  border-color: var(--accent-violet);
  box-shadow: 0 0 8px var(--accent-violet-glow);
}

.drag-drop-zone {
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: rgba(255,255,255,0.01);
  cursor: pointer;
  transition: var(--transition-fast);
  margin-top: 15px;
}

.drag-drop-zone:hover {
  background: rgba(255,255,255,0.03);
  border-color: var(--accent-cyan);
}

.drag-drop-zone p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .runner-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .device-shell.tablet, .device-shell.mobile {
    height: 500px;
  }
  .studio-layout {
    grid-template-columns: 1fr;
  }
}

/* Language Switcher Styling */
.lang-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  padding: 2px;
  border-radius: 8px;
  margin-left: 12px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--accent-cyan);
  color: #0c0f16;
}

/* Profile Chip & Modal Enhancements */
.profile-chip:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: var(--accent-violet) !important;
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.15);
}

.close-modal-btn:hover {
  color: white !important;
  transform: scale(1.1);
}

/* Security Audit Styling */
.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(0, 0, 0, 0.15);
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid transparent;
}

.audit-item.critical {
  border-left-color: var(--accent-rose);
  color: #fda4af;
  background: rgba(251, 113, 133, 0.05);
}

.audit-item.warning {
  border-left-color: #f59e0b;
  color: #fde047;
  background: rgba(245, 158, 11, 0.05);
}

.audit-status-badge.safe {
  background: rgba(52, 211, 153, 0.1) !important;
  border-color: #34d399 !important;
  color: #34d399 !important;
}

.audit-status-badge.warning {
  background: rgba(245, 158, 11, 0.1) !important;
  border-color: #f59e0b !important;
  color: #f59e0b !important;
}

.audit-status-badge.blocked {
  background: rgba(251, 113, 133, 0.1) !important;
  border-color: #fb7185 !important;
  color: #fb7185 !important;
}
