/* =============================================
   NeuralCraft — style.css
   ============================================= */

/* ===== CSS VARIABLES ===== */
:root {
  --bg:       #0a0a0f;
  --surface:  #111118;
  --surface2: #1a1a24;
  --border:   #2a2a38;
  --accent:   #7c5cfc;
  --accent2:  #00e5b4;
  --text:     #f0f0f8;
  --muted:    #7070a0;
  --danger:   #ff4f6a;
  --radius:   8px;
  --radius-lg: 12px;
}

/* ===== RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, .logo, .plan-price, .plan-name, .agent-name {
  font-family: 'Syne', sans-serif;
}

h1 {
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 1.5rem;
}
h1 em  { font-style: normal; color: var(--accent); }
h1 .teal { color: var(--accent2); }

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
}

/* ===== SECTIONS ===== */
section {
  padding: 6rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

.pricing-section {
  background: var(--surface);
  max-width: 100%;
  padding: 6rem 0;
}
.pricing-section > *:not(.pricing-grid) {
  padding-left: 3rem;
  padding-right: 3rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
}

.section-sub {
  color: var(--muted);
  max-width: 480px;
  line-height: 1.7;
  margin-bottom: 3rem;
  font-weight: 300;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: white;
  padding: 0.9rem 2rem;
  border-radius: var(--radius);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124, 92, 252, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  padding: 0.9rem 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-ghost:hover {
  border-color: var(--accent);
  background: rgba(124, 92, 252, 0.08);
}

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

/* ===== NAV ===== */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 3rem;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }

nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}
nav a:hover { color: var(--text); }

.nav-cta {
  background: var(--accent);
  color: white !important;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  font-weight: 500;
}
.nav-cta:hover { opacity: 0.85; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

.mobile-nav {
  display: none;
  position: fixed;
  top: 60px; left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  z-index: 99;
  padding: 1rem 1.5rem;
  gap: 0.5rem;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.6rem 0;
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover { color: var(--text); }

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 8rem 3rem 5rem;
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 60% at 70% 40%, rgba(124,92,252,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(0,229,180,0.1) 0%, transparent 60%);
  pointer-events: none;
}

.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(124,92,252,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,92,252,0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 700px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(124,92,252,0.15);
  border: 1px solid rgba(124,92,252,0.3);
  padding: 0.4rem 1rem;
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-weight: 500;
}
.hero-badge::before {
  content: '●';
  font-size: 0.5rem;
  animation: pulse 2s infinite;
}

.hero p {
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 2.5rem;
  font-weight: 300;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ===== SERVICES GRID ===== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.service-card {
  background: var(--surface);
  padding: 2.5rem;
  transition: background 0.2s;
}
.service-card:hover { background: var(--surface2); }

.service-icon {
  width: 48px; height: 48px;
  background: rgba(124,92,252,0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
}

.service-card p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.9rem;
  font-weight: 300;
}

/* ===== PRICING GRID ===== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 3rem;
}

.price-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
}
.price-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}
.price-card.featured {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(124,92,252,0.08) 0%, var(--bg) 100%);
}

.featured-badge {
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.8rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.plan-name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.plan-price {
  font-size: 3rem;
  font-weight: 800;
  margin: 1rem 0;
}
.plan-price span {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
}

.plan-desc {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  font-weight: 300;
}

.plan-features {
  list-style: none;
  margin-bottom: 2rem;
}
.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 300;
}
.plan-features li::before {
  content: '✓';
  color: var(--accent2);
  font-weight: 700;
  flex-shrink: 0;
}

.btn-plan {
  width: 100%;
  padding: 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: block;
  text-decoration: none;
}
.btn-plan:hover,
.price-card.featured .btn-plan {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.price-card.featured .btn-plan:hover { opacity: 0.85; }

/* ===== FOOTER ===== */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
footer p {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 300;
}
.footer-admin-link {
  color: var(--accent);
  text-decoration: none;
}

/* ===== CHAT WIDGET ===== */
#chat-toggle {
  position: fixed;
  bottom: 2rem; right: 2rem;
  width: 60px; height: 60px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(124, 92, 252, 0.5);
  z-index: 1000;
  transition: transform 0.2s;
}
#chat-toggle:hover { transform: scale(1.1); }

#chat-window {
  position: fixed;
  bottom: 6rem; right: 2rem;
  width: 380px;
  height: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  z-index: 999;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.95) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}

.agent-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.agent-info { flex: 1; }

.agent-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.agent-status {
  font-size: 0.75rem;
  color: var(--accent2);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.agent-status::before {
  content: '●';
  font-size: 0.5rem;
  animation: pulse 2s infinite;
}

.chat-header-actions { display: flex; gap: 0.5rem; }

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.icon-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  scroll-behavior: smooth;
}
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.msg {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  animation: msgIn 0.2s ease;
}
.msg.user { flex-direction: row-reverse; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.msg-bubble {
  max-width: 80%;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  font-weight: 300;
  word-wrap: break-word;
}
.msg.agent .msg-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}
.msg.user .msg-bubble {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.msg.agent .msg-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0.3rem 0;
}
.typing-indicator span {
  width: 6px; height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

.chat-input-area {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  transition: border-color 0.2s;
  font-weight: 300;
  line-height: 1.4;
}
#chat-input:focus {
  outline: none;
  border-color: var(--accent);
}
#chat-input::placeholder { color: var(--muted); }

#send-btn {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  transition: opacity 0.2s;
  flex-shrink: 0;
  height: 40px;
  display: flex;
  align-items: center;
}
#send-btn:hover { opacity: 0.85; }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== ADMIN PANEL ===== */
#admin-panel {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
#admin-panel.open { display: flex; }

.admin-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.admin-modal::-webkit-scrollbar { width: 4px; }
.admin-modal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.admin-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.admin-header h3 {
  font-size: 1.1rem;
}

.admin-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-btn {
  padding: 0.8rem 1.5rem;
  border: none;
  background: none;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-weight: 500;
}
.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.admin-body {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tab-content { display: none; }
.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ===== FORM FIELDS ===== */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
textarea,
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 300;
  width: 100%;
  transition: border-color 0.2s;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
select option { background: var(--surface); }

.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.5;
}
.field-hint a { color: var(--accent); text-decoration: none; }
.field-hint a:hover { text-decoration: underline; }

.api-warning {
  background: rgba(255, 79, 106, 0.1);
  border: 1px solid rgba(255, 79, 106, 0.3);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  color: #ff8fa0;
  display: none;
}

.save-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  align-self: flex-start;
}
.save-btn:hover { opacity: 0.85; }

/* ===== LOGS ===== */
.logs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.clear-btn {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.clear-btn:hover { background: rgba(255, 79, 106, 0.1); }

.log-entry {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.8rem;
}
.log-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.log-session {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  font-family: monospace;
}
.log-time { font-size: 0.75rem; color: var(--muted); }
.log-preview { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; font-weight: 300; }
.log-msgs { border-top: 1px solid var(--border); }
.log-msg {
  font-size: 0.8rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.log-msg:last-child { border-bottom: none; }
.log-msg strong { color: var(--accent2); }
.log-msg.user-msg strong { color: var(--accent); }

.no-logs {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem;
  font-weight: 300;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 7rem; right: 2rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  z-index: 9999;
  animation: toastIn 0.3s ease;
  max-width: 300px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.success { border-color: var(--accent2); }
.toast.error   { border-color: var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav { padding: 1rem 1.5rem; }
  nav ul { display: none; }
  .mobile-menu-btn { display: block; }

  section { padding: 4rem 1.5rem; }
  .hero { padding: 7rem 1.5rem 4rem; max-width: 100%; }

  .pricing-grid { padding: 0 1.5rem; }
  .pricing-section > *:not(.pricing-grid) { padding-left: 1.5rem; padding-right: 1.5rem; }

  footer { flex-direction: column; text-align: center; padding: 2rem 1.5rem; }

  #chat-window {
    width: calc(100vw - 2rem);
    right: 1rem;
    bottom: 5.5rem;
    height: 70vh;
  }

  .admin-tabs { overflow-x: auto; }
  .tab-btn { white-space: nowrap; padding: 0.8rem 1rem; }
  .admin-body { padding: 1.5rem; }
}

@media (max-width: 480px) {
  h1 { font-size: 2.2rem; }
  .hero-btns { flex-direction: column; }
  .btn-primary, .btn-ghost { width: 100%; text-align: center; }
}
