/* Meckie Platform — Global Styles */
/* Light theme default, cyan accents, dark mode for app pages */

:root {
  --bg: #ffffff;
  --bg-card: #ffffff;
  --bg-surface: #f8fafc;
  --bg-hover: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --amber: #00b4d8;
  --amber-dim: #0088aa;
  --amber-glow: rgba(0, 180, 216, 0.2);
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --border: #e2e8f0;
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* Dark mode — auto via toggle, or forced via .dark-mode class */
html.dark, body.dark, .dark-mode, .dark-mode body {
  --bg: #0a0a0f;
  --bg-card: #111118;
  --bg-surface: #16161f;
  --bg-hover: #1e1e2a;
  --text: #f5f5f5;
  --text-muted: #888;
  --text-dim: #555;
  --amber: #00d4ff;
  --amber-dim: #0099cc;
  --amber-glow: rgba(0, 212, 255, 0.3);
  --border: #222;
}

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

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

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.btn-primary {
  background: var(--amber);
  color: #000;
}
.btn-primary:hover { background: #00c8e8; }
.btn-icon {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.btn-icon:hover { opacity: 1; }
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.card:hover { border-color: #333; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.form-input, .input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.form-input:focus, .input:focus { border-color: var(--amber); }
.form-input::placeholder, .input::placeholder { color: var(--text-dim); }
textarea.form-input, textarea.input { resize: vertical; min-height: 80px; }
select.form-input, select.input { cursor: pointer; appearance: auto; }
.form-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0 0 0.4rem 0;
  line-height: 1.4;
}
.form-hint a { color: var(--amber); text-decoration: none; }
.form-hint a:hover { text-decoration: underline; }
.form-hint code {
  background: var(--bg-surface);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.78rem;
}
.settings-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-of-type { border-bottom: none; }
.settings-heading {
  font-size: 1.1rem;
  color: var(--amber);
  margin-bottom: 1rem;
  font-weight: 600;
}
.badge-sm {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  vertical-align: middle;
}

/* Usage bar */
.usage-bar-container { margin-top: 0.5rem; }
.usage-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}
.usage-bar-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 2px; bottom: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--amber); border-color: var(--amber); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: #fff; }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.pricing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.pricing-card.featured { border-color: var(--amber); }
.pricing-card.current { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.pricing-price { font-size: 2rem; font-weight: 700; margin: 0.5rem 0; }
.pricing-price span { font-size: 0.9rem; font-weight: 400; color: var(--text-dim); }
.pricing-features {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  text-align: left;
  font-size: 0.9rem;
}
.pricing-features li {
  padding: 0.3rem 0;
  color: var(--text-muted);
}
.pricing-features li::before {
  content: '✓ ';
  color: var(--amber);
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th { color: var(--text-muted); font-weight: 500; font-size: 0.85rem; text-transform: uppercase; }
td { font-size: 0.95rem; }

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.brand-gradient {
  background: linear-gradient(135deg, #00b4d8, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-cta { color: #fff !important; }
.nav-cta:hover { color: #fff !important; }
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--amber); }

/* Droid face — light/dark theme overrides */
.droid-head { background: linear-gradient(135deg, #f1f5f9, #e2e8f0) !important; border-color: rgba(0, 168, 214, 0.25) !important; box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 0 30px rgba(0,168,214,0.08) !important; }
.droid-pupil { background: #0f172a !important; }
.droid-antenna { background: #94a3b8 !important; }
html.dark .droid-head, body.dark .droid-head, .dark-mode .droid-head { background: #111118 !important; border-color: #222 !important; box-shadow: 0 0 20px rgba(0,212,255,0.05) !important; }
html.dark .droid-pupil, body.dark .droid-pupil, .dark-mode .droid-pupil { background: #fff !important; }
html.dark .droid-antenna, body.dark .droid-antenna, .dark-mode .droid-antenna { background: rgba(0,212,255,0.4) !important; }
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-free { background: #064e3b; color: #34d399; }
.badge-paid { background: #78350f; color: var(--amber); }
.badge-installed { background: #064e3b; color: var(--green); }

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  animation: toast-in 0.3s ease;
  min-width: 250px;
}
.toast-success { background: #064e3b; color: #34d399; border: 1px solid #065f46; }
.toast-error { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }
.toast-info { background: #1e1b4b; color: #a5b4fc; border: 1px solid #312e81; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(1rem); }
  to { opacity: 1; transform: translateX(0); }
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 57px);
  padding: 1rem 0;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}
a.sidebar-link { text-decoration: none; color: inherit; font-weight: normal; line-height: inherit; }
.sidebar-link:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.sidebar-link.active { color: var(--amber); background: rgba(245, 158, 11, 0.08); }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-1 { gap: 1rem; }
.gap-2 { gap: 2rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-amber { color: var(--amber); }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-half { margin-top: 0.5rem; }

/* Droid form */
#droid-form { animation: slideDown 0.2s ease-out; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
#droid-form h3 { margin: 0 0 1rem 0; color: var(--amber); }
#droid-form .btn { min-width: 80px; }

/* Memory tabs */
.memory-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.memory-tab {
  padding: 0.4rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.memory-tab:hover { border-color: #444; color: var(--text); }
.memory-tab.active {
  background: var(--amber);
  color: #000;
  border-color: var(--amber);
  font-weight: 600;
}
.mb-2 { margin-bottom: 2rem; }
.p-2 { padding: 2rem; }

/* Grid */
.grid {
  display: grid;
  gap: 1rem;
}
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Trust score bar */
.trust-bar {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.3rem;
}
.trust-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.trust-high { background: var(--green); }
.trust-med { background: var(--amber); }
.trust-low { background: var(--red); }

/* Chat bubbles */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chat-bubble {
  max-width: 80%;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-bubble code {
  background: rgba(0,0,0,0.3);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.chat-bubble-user {
  background: var(--amber);
  color: #000;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-bubble-droid {
  background: var(--bg-surface);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-input-bar input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  font-family: var(--font);
}
.chat-input-bar input:focus { border-color: var(--amber); }

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 1rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--red); }

/* Control bar */
.control-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}
.control-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.control-btn:hover { border-color: var(--amber); color: var(--amber); }
.control-btn.active { background: var(--amber); color: #000; border-color: var(--amber); }

/* Camera preview */
.camera-preview {
  position: fixed;
  bottom: 5rem;
  right: 1rem;
  width: 160px;
  height: 120px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  overflow: hidden;
  background: #000;
  z-index: 50;
}
.camera-preview video { width: 100%; height: 100%; object-fit: cover; }

/* Pricing cards */
.pricing-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}
.pricing-card.featured { border-color: var(--amber); }
.pricing-price { font-size: 2rem; font-weight: 700; margin: 0.5rem 0; }
.pricing-price span { font-size: 0.9rem; font-weight: 400; color: var(--text-muted); }
.pricing-features { list-style: none; text-align: left; margin: 1rem 0; }
.pricing-features li { padding: 0.3rem 0; font-size: 0.9rem; color: var(--text-muted); }
.pricing-features li::before { content: '\2713'; color: var(--amber); margin-right: 0.5rem; }

/* Hero section */
.hero {
  text-align: center;
  padding: 4rem 1.5rem;
}
.hero h1 { font-size: 2.2rem; margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 2rem; }

/* Value props */
.value-props { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); padding: 2rem 0; }
.value-prop { text-align: center; padding: 1.5rem; }
.value-prop-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.value-prop h3 { margin-bottom: 0.5rem; }
.value-prop p { color: var(--text-muted); font-size: 0.95rem; }

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}
.filter-tab {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
}
.filter-tab:hover { border-color: #444; color: var(--text); }
.filter-tab.active { background: var(--amber); color: #000; border-color: var(--amber); }

/* Skill card */
.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}
.skill-card:hover { border-color: #444; }
.skill-card-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.skill-card h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.skill-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.skill-card .installed-check {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: var(--green);
  font-size: 1.1rem;
}

/* Section headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Error message */
.error-msg { color: var(--red); font-size: 0.9rem; margin-top: 0.5rem; }

/* Hidden */
.hidden { display: none !important; }

/* Stats grid */
.stats-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--amber); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Mobile responsive */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.75rem;
  }
  .hamburger { display: block; }
  .hero h1 { font-size: 1.6rem; }
  .sidebar {
    position: fixed;
    left: -240px;
    top: 57px;
    z-index: 90;
    transition: left 0.3s;
    height: calc(100vh - 57px);
  }
  .sidebar.open { left: 0; }
  .camera-preview { width: 120px; height: 90px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
}

/* Typing indicator */
.typing-bubble {
  display: flex;
  gap: 6px;
  padding: 12px 18px;
  min-height: auto;
}
.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0.4;
  animation: typing-bounce 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Thinking droid face glow */
.droid-face.thinking .droid-eye {
  animation: eye-think 1.5s ease-in-out infinite;
}
@keyframes eye-think {
  0%, 100% { opacity: 0.6; box-shadow: 0 0 10px var(--amber); }
  50% { opacity: 1; box-shadow: 0 0 25px var(--amber), 0 0 50px var(--amber); }
}

/* Speaking droid face pulse */
.droid-face.speaking .droid-eye {
  animation: eye-speak 0.3s ease-in-out infinite alternate;
}
@keyframes eye-speak {
  from { transform: scaleY(1); }
  to { transform: scaleY(0.7); }
}

/* Voice picker */
.voice-picker {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  max-width: 150px;
  cursor: pointer;
}
.voice-picker:focus {
  border-color: var(--amber);
  outline: none;
}
