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

:root {
  --bg: #0f172a;
  --surface: rgba(30, 41, 59, 0.7);
  --surface-opaque: #1e293b;
  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.05);
  --accent: #0d9488;
  --accent-light: #2dd4bf;
  --accent-glow: rgba(13, 148, 136, 0.3);
  --red: #e11d48;
  --red-glow: rgba(225, 29, 72, 0.3);
  --amber: #f59e0b;
  --green: #10b981;
  --text: #f8fafc;
  --text-dim: #94a3b8;
  --text-dark: #64748b;
  --radius: 12px;
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass: blur(12px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(13, 148, 136, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(225, 29, 72, 0.03) 0%, transparent 40%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Outfit', sans-serif;
}

/* PREMIUM SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dark); }

/* GLASSMORPHISM */
.glass {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* NAVIGATION */
.nav-portal {
  position: fixed; top: 0; left: 0; right: 0; height: 70px;
  z-index: 1000; display: flex; align-items: center; padding: 0 2rem;
}

.logo {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
  font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.4rem;
}

.logo-icon {
  width: 38px; height: 38px; background: var(--accent);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.4rem; box-shadow: 0 0 15px var(--accent-glow);
}

/* CARDS & GRIDS */
.container {
  max-width: 1200px; margin: 0 auto; padding: 100px 1.5rem 2rem;
}

.grid-portal {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem;
}

.card-module {
  padding: 2.5rem; text-align: center; cursor: pointer; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative; overflow: hidden;
}

.card-module:hover {
  transform: translateY(-10px);
  border-color: var(--accent);
  background: rgba(30, 41, 59, 0.9);
}

.card-module::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0; transition: opacity 0.3s;
}

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

.module-icon {
  font-size: 3.5rem; margin-bottom: 1.5rem; display: block;
}

.module-title { font-size: 1.8rem; margin-bottom: 0.5rem; color: var(--text); }
.module-desc { font-size: 0.9rem; color: var(--text-dim); line-height: 1.6; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 24px; border-radius: 8px;
  font-weight: 600; font-size: 0.9rem; transition: all 0.2s;
  cursor: pointer; border: none; font-family: 'Inter', sans-serif;
}

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 15px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-light); transform: translateY(-2px); }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--border-light); border-color: var(--text-dark); }

/* STATS BAR */
.stats-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem; margin-bottom: 2rem;
}

.stat-box { padding: 1.25rem; text-align: center; }
.stat-val { font-size: 2rem; font-weight: 800; font-family: 'Outfit', sans-serif; line-height: 1; }
.stat-lbl { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 8px; }

/* MODALS */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(8px);
  z-index: 2000; display: none; align-items: center; justify-content: center;
  padding: 1.5rem; opacity: 0; transition: opacity 0.3s;
}

.modal-overlay.open { display: flex; opacity: 1; }

.modal {
  width: 100%; max-width: 800px; max-height: 90vh; overflow-y: auto;
  background: var(--surface-opaque); border: 1px solid var(--border);
  border-radius: 16px; padding: 2rem; position: relative;
  transform: translateY(20px); transition: transform 0.3s;
}

.modal-overlay.open .modal { transform: translateY(0); }

/* FORMS */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 0.75rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
input, select, textarea {
  background: rgba(15, 23, 42, 0.5); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 0.95rem; outline: none;
  transition: all 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* STANDALONE PAGE SPECIFICS */
.standalone-layout { display: grid; grid-template-columns: 320px 1fr; height: 100vh; overflow: hidden; }
.sidebar { border-right: 1px solid var(--border); background: rgba(15, 23, 42, 0.3); display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.sidebar-header { flex-shrink: 0; }
.sidebar-list { flex: 1; overflow-y: auto; min-height: 0; }
.sidebar-footer { flex-shrink: 0; }
.main-view { flex: 1; overflow-y: auto; padding: 2rem; position: relative; }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeIn 0.5s ease forwards; }

/* ── AI PANEL ─────────────────────────────────────── */
.ai-panel { display: flex; flex-direction: column; gap: 1rem; }

.ai-quick-prompts { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-qp-btn {
  padding: 5px 12px; border-radius: 20px; font-size: 0.72rem; font-weight: 600;
  border: 1px solid var(--border); background: rgba(255,255,255,0.04);
  color: var(--text-dim); cursor: pointer; transition: all 0.2s;
  font-family: 'Inter', sans-serif; white-space: nowrap;
}
.ai-qp-btn:hover { background: var(--accent-glow); border-color: var(--accent); color: var(--accent-light); }
.ai-qp-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent-light); }

.ai-output-wrap {
  background: rgba(15,23,42,0.6); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.25rem; min-height: 160px;
  max-height: 380px; overflow-y: auto;
}
.ai-output {
  font-size: 0.82rem; line-height: 1.75; color: var(--text-dim);
  white-space: pre-wrap; word-break: break-word;
}
.ai-output strong, .ai-output b { color: var(--text); }

.ai-typing { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-light); font-size: 0.8rem; }
.ai-typing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: aiDot 1.2s infinite; }
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDot { 0%,80%,100% { opacity: 0.2; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

.ai-chat-wrap { display: flex; gap: 8px; align-items: flex-end; }
.ai-chat-input {
  flex: 1; background: rgba(15,23,42,0.5); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 0.85rem; outline: none;
  resize: none; min-height: 42px; max-height: 120px; transition: border-color 0.2s;
  line-height: 1.5;
}
.ai-chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.ai-chat-input::placeholder { color: var(--text-dark); }
.ai-send-btn {
  padding: 10px 16px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; transition: all 0.2s;
  font-family: 'Inter', sans-serif; flex-shrink: 0; height: 42px;
}
.ai-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ai-action-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.ai-copy-btn {
  padding: 5px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  cursor: pointer; transition: 0.2s; font-family: 'Inter', sans-serif;
}
.ai-copy-btn:hover { background: var(--border-light); color: var(--text); }
