/* ===============================
   APPANA AI – NANO THEME SYSTEM
   =============================== */

:root {
  --bg-base: #0a0b14;
  --bg-deep: #07080f;
  --bg-pure: #000;
  --nano-blue: rgba(30,144,255,0.14);
  --nano-cyan: rgba(6,182,212,0.14);
  --nano-violet: rgba(138,43,226,0.12);
  --glass-bg: rgba(6, 6, 18, 0.75);
  --glass-border: 1px solid rgba(255,255,255,0.08);
  --accent: #06b6d4;
  --accent-glow: rgba(6,182,212,0.45);
  --secondary: #8a2be2;
  --text-main: #e6e9ef;
  --text-muted: #9aa4b2;
  --input-bg: rgba(0,0,0,0.35);
  --radius: 16px;
}

body {
  background:
    radial-gradient(1200px 600px at 12% 10%, var(--nano-blue), transparent 42%),
    radial-gradient(900px 500px at 88% 22%, var(--nano-violet), transparent 45%),
    radial-gradient(700px 450px at 50% 90%, var(--nano-cyan), transparent 50%),
    linear-gradient(180deg, var(--bg-base), var(--bg-deep));
  color: var(--text-main);
  font-family: 'Inter', system-ui, sans-serif;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  margin: 0;
}

.hidden { display: none !important; }

/* 🧩 MAIN GRID */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 12px;
  padding: 12px;
  height: 100%;
  box-sizing: border-box;
}

/* 🧊 PANELS */
.sidebar, .main-area, .right-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border: var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 🔘 BUTTONS */
button {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: 0.2s;
}
button:hover { background: rgba(255,255,255,0.1); }
button.primary { background: var(--accent); color: #000; font-weight: 700; box-shadow: 0 4px 16px var(--accent-glow); }

/* ✍️ TEXTAREA */
textarea {
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px;
  resize: none;
  outline: none;
}

/* 📱 MOBILE LAYOUT & NAVIGATION */
@media (max-width: 900px) {
  .app-container { display: block; padding: 0; }

  /* Default Hidden State */
  .sidebar, .main-area, .right-panel {
    position: fixed; inset: 0; bottom: 60px;
    display: none; /* JS toggles this */
    border-radius: 0;
    background: #0a0b14;
    z-index: 10;
  }

  /* 🚨 CRITICAL FIX: FORCE CHAT VISIBLE IF ACTIVE OR BY DEFAULT */
  /* This ensures screen is never black */
  #section-chat {
    display: flex; 
  }

  .active-panel {
    display: flex !important;
    z-index: 20;
  }

  .mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
    background: rgba(10, 11, 20, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex; justify-content: space-around; align-items: center;
    z-index: 1000; padding-bottom: env(safe-area-inset-bottom);
  }

  .nav-btn {
    background: none; border: none; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 10px; width: 100%; height: 100%; justify-content: center; padding: 0;
  }
  .nav-btn span { font-size: 22px; margin-bottom: 2px; }
  .nav-btn.active { color: var(--accent); }
}

/* Loader Safety */
#app-loader { z-index: 99999; pointer-events: none; transition: opacity 0.3s; }
