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

:root {
  --bg: #04040f;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --cyan: #6ee7f7;
  --purple: #a78bfa;
  --pink: #f472b6;
  --text: #e2e8f0;
  --text-muted: #64748b;
  --success: #34d399;
  --error: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
}

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

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

/* ── Ambient Background ── */
.ambient-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.ambient-orb {
  position: absolute; border-radius: 50%;
  filter: blur(100px); opacity: 0.18; animation: orbFloat 12s ease-in-out infinite;
}
.orb-1 { width: 600px; height: 600px; background: radial-gradient(circle, #6ee7f7, transparent); top: -200px; left: -100px; animation-delay: 0s; }
.orb-2 { width: 500px; height: 500px; background: radial-gradient(circle, #a78bfa, transparent); bottom: -150px; right: -100px; animation-delay: -4s; }
.orb-3 { width: 400px; height: 400px; background: radial-gradient(circle, #f472b6, transparent); top: 40%; left: 40%; transform: translate(-50%,-50%); animation-delay: -8s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-40px) scale(1.05); }
  66% { transform: translate(-20px,30px) scale(0.95); }
}

#particleCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ── Header ── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px;
  background: rgba(4,4,15,0.8); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-icon svg { width: 36px; height: 36px; }
.logo-name { font-size: 1.4rem; font-weight: 800; background: linear-gradient(135deg, var(--cyan), var(--purple)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: block; line-height: 1; }
.logo-tagline { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px; display: block; }

.header-nav { display: flex; gap: 6px; flex: 1; justify-content: center; }
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 50px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); cursor: pointer;
  font-family: inherit; font-size: 0.85rem; transition: all .25s;
}
.nav-btn:hover, .nav-btn.active {
  background: var(--surface-hover); border-color: rgba(110,231,247,0.3);
  color: var(--cyan); box-shadow: 0 0 16px rgba(110,231,247,0.1);
}

.status-indicator { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.status-dot.online { background: var(--success); box-shadow: 0 0 10px var(--success); animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1;} 50%{opacity:0.5;} }

/* ── Main Content ── */
.main-content { position: relative; z-index: 1; padding: 24px; max-width: 1400px; margin: 0 auto; }

/* ── Tab Panels ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }

/* ── Assistant Grid ── */
.assistant-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }

/* ── Orb ── */
.orb-container {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 0 20px; position: relative;
}

.orb-ring {
  position: absolute; border-radius: 50%; border: 1px solid;
  animation: orbRingPulse 3s ease-in-out infinite; pointer-events: none;
}
.ring-outer  { width: 280px; height: 280px; border-color: rgba(110,231,247,0.15); animation-delay: 0s; }
.ring-middle { width: 220px; height: 220px; border-color: rgba(167,139,250,0.2); animation-delay: -.8s; }
.ring-inner  { width: 165px; height: 165px; border-color: rgba(110,231,247,0.25); animation-delay: -1.6s; }
@keyframes orbRingPulse {
  0%,100%{transform:scale(1);opacity:.6}
  50%{transform:scale(1.06);opacity:1}
}

.orb {
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(110,231,247,0.25), rgba(167,139,250,0.15));
  border: 1.5px solid rgba(110,231,247,0.3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  box-shadow: 0 0 40px rgba(110,231,247,0.15), inset 0 0 30px rgba(167,139,250,0.1);
  transition: all .3s; z-index: 2;
}
.orb:hover { box-shadow: 0 0 60px rgba(110,231,247,0.3), inset 0 0 40px rgba(167,139,250,0.2); transform: scale(1.04); }
.orb-glow {
  position: absolute; inset: -2px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--cyan), var(--purple), var(--pink), var(--cyan));
  filter: blur(8px); opacity: 0; animation: orbRotate 4s linear infinite;
  transition: opacity .3s;
}
.orb.listening .orb-glow { opacity: 0.6; }
@keyframes orbRotate { to{transform:rotate(360deg)} }

.orb-core { position: relative; z-index: 1; }

.waveform {
  display: flex; align-items: center; gap: 4px;
  height: 40px; margin-top: 20px; opacity: 0; transition: opacity .3s;
}
.waveform.active { opacity: 1; }
.wave-bar {
  width: 4px; border-radius: 4px;
  background: linear-gradient(to top, var(--cyan), var(--purple));
  height: 6px; transition: height .1s;
  animation: wavePulse 1.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.1s);
}
@keyframes wavePulse {
  0%,100%{height:6px} 50%{height:32px}
}

.orb-status-text { margin-top: 12px; font-size: 0.85rem; color: var(--text-muted); letter-spacing: 1px; }

/* ── Controls ── */
.control-bar {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 640px; padding: 0 10px;
}

.mic-btn {
  width: 54px; height: 54px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  border: none; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 24px rgba(110,231,247,0.3);
  transition: all .25s; position: relative; overflow: hidden;
}
.mic-btn:hover { transform: scale(1.08); box-shadow: 0 0 36px rgba(110,231,247,0.5); }
.mic-btn.listening { animation: micPulse .8s ease-in-out infinite alternate; }
.mic-btn svg { width: 22px; height: 22px; position: relative; z-index: 1; }
.mic-ripple {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(255,255,255,0.2); transform: scale(0); opacity: 0;
}
.mic-btn.listening .mic-ripple { animation: ripple 1s ease-out infinite; }
@keyframes ripple { to{transform:scale(2.5);opacity:0} }
@keyframes micPulse { from{box-shadow:0 0 20px rgba(110,231,247,0.4)} to{box-shadow:0 0 50px rgba(110,231,247,0.8)} }

.text-input-group { flex: 1; display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 50px; overflow: hidden; transition: border-color .2s; }
.text-input-group:focus-within { border-color: rgba(110,231,247,0.4); box-shadow: 0 0 20px rgba(110,231,247,0.08); }
.text-input-group input { flex: 1; background: transparent; border: none; outline: none; padding: 14px 20px; color: var(--text); font-family: inherit; font-size: 0.95rem; }
.text-input-group input::placeholder { color: var(--text-muted); }
.send-btn { width: 48px; height: 48px; margin: 3px; border-radius: 50%; background: linear-gradient(135deg, var(--cyan), var(--purple)); border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s; flex-shrink: 0; }
.send-btn:hover { transform: scale(1.08); }
.send-btn svg { width: 18px; height: 18px; }

/* ── Chat Window ── */
.chat-window {
  width: 100%; max-width: 640px; min-height: 300px; max-height: 420px;
  overflow-y: auto; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  scroll-behavior: smooth;
}
.chat-window::-webkit-scrollbar { width: 4px; }
.chat-window::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.chat-welcome { text-align: center; padding: 24px 16px; }
.welcome-icon { font-size: 3rem; margin-bottom: 12px; }
.chat-welcome h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; background: linear-gradient(135deg, var(--cyan), var(--purple)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.chat-welcome p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }

.quick-commands { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.quick-cmd { padding: 8px 16px; border-radius: 50px; background: var(--surface-hover); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-family: inherit; font-size: 0.82rem; transition: all .2s; }
.quick-cmd:hover { border-color: rgba(110,231,247,0.4); color: var(--cyan); background: rgba(110,231,247,0.05); }

/* Chat Messages */
.chat-msg { display: flex; gap: 10px; margin-bottom: 14px; animation: msgSlide .3s ease; }
.chat-msg.user { flex-direction: row-reverse; }
@keyframes msgSlide { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

.msg-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.chat-msg.user .msg-avatar { background: linear-gradient(135deg, var(--cyan), var(--purple)); }
.chat-msg.assistant .msg-avatar { background: var(--surface-hover); border: 1px solid var(--border); }

.msg-bubble { max-width: 75%; padding: 10px 16px; border-radius: 18px; font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; }
.chat-msg.user .msg-bubble { background: linear-gradient(135deg, rgba(110,231,247,0.15), rgba(167,139,250,0.15)); border: 1px solid rgba(110,231,247,0.2); border-radius: 18px 18px 4px 18px; }
.chat-msg.assistant .msg-bubble { background: var(--surface-hover); border: 1px solid var(--border); border-radius: 18px 18px 18px 4px; }
.chat-msg .msg-content { display: flex; flex-direction: column; gap: 4px; max-width: 75%; }
.chat-msg .msg-sender { font-size: 0.72rem; font-weight: 700; color: var(--cyan); letter-spacing: 0.04em; text-transform: uppercase; }

/* ── Glass Card / Side Panels ── */
.glass-card {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(10px);
}

.side-panels { display: flex; flex-direction: column; gap: 16px; }

.panel-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-icon { font-size: 1.2rem; }
.panel-header h3 { font-size: 0.95rem; font-weight: 600; flex: 1; }
.refresh-btn, .panel-toggle-btn { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-hover); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.refresh-btn:hover, .panel-toggle-btn:hover { color: var(--cyan); border-color: rgba(110,231,247,0.3); }

/* Weather Display */
.weather-display { font-size: 0.85rem; }
.weather-placeholder { color: var(--text-muted); font-size: 0.8rem; text-align: center; padding: 12px 0; }
.weather-main { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.weather-icon-big { font-size: 2.8rem; }
.weather-temp { font-size: 2.2rem; font-weight: 700; }
.weather-desc { color: var(--text-muted); font-size: 0.8rem; }
.weather-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.weather-stat { background: var(--surface); border-radius: var(--radius-sm); padding: 8px; text-align: center; }
.weather-stat .label { color: var(--text-muted); font-size: 0.72rem; }
.weather-stat .value { font-size: 0.9rem; font-weight: 600; }

/* Tip List */
.tip-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tip-list li {
  padding: 9px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
  border-left: 3px solid transparent;
  transition: all .18s ease;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.tip-list li::after {
  content: '▶';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%) scale(0.7);
  opacity: 0;
  font-size: 0.65rem;
  color: var(--cyan);
  transition: opacity .18s, transform .18s;
}
.tip-list li:hover {
  border-left-color: var(--cyan);
  color: var(--text);
  background: rgba(110,231,247,0.07);
  transform: translateX(3px);
  box-shadow: 0 2px 12px rgba(110,231,247,0.08);
}
.tip-list li:hover::after { opacity: 1; transform: translateY(-50%) scale(1); }
.tip-list li:active { transform: translateX(3px) scale(0.97); }

/* ── Forms ── */
.panel-form, .form-grid { display: flex; flex-direction: column; gap: 10px; }
.form-input, .form-textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; color: var(--text); font-family: inherit; font-size: 0.85rem; outline: none;
  transition: border-color .2s; width: 100%;
}
.form-input:focus, .form-textarea:focus { border-color: rgba(110,231,247,0.4); }
.form-textarea { resize: vertical; min-height: 80px; }

.action-btn {
  padding: 10px 20px; border-radius: 50px; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.88rem; font-weight: 600; transition: all .25s;
}
.action-btn.primary { background: linear-gradient(135deg, var(--cyan), var(--purple)); color: #0a0a1a; box-shadow: 0 0 20px rgba(110,231,247,0.2); }
.action-btn.primary:hover { transform: translateY(-2px); box-shadow: 0 0 30px rgba(110,231,247,0.35); }
.action-btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.action-btn.ghost:hover { border-color: rgba(110,231,247,0.3); color: var(--text); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Tab Content Wrapper ── */
.tab-content-wrapper { max-width: 900px; margin: 0 auto; }
.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.section-header h2 { font-size: 1.5rem; font-weight: 700; flex: 1; }
.section-hint { color: var(--text-muted); font-size: 0.85rem; }

/* ── Reminders ── */
.add-reminder-form { margin-bottom: 20px; }
.add-reminder-form h3 { margin-bottom: 16px; font-size: 1rem; }
.reminders-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.reminder-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; animation: fadeIn .3s ease; transition: border-color .2s; }
.reminder-card:hover { border-color: rgba(110,231,247,0.3); }
.reminder-card h4 { font-size: 1rem; margin-bottom: 4px; }
.reminder-card .rem-time { font-size: 1.4rem; font-weight: 700; background: linear-gradient(135deg, var(--cyan), var(--purple)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.reminder-card .rem-note { color: var(--text-muted); font-size: 0.82rem; margin-top: 6px; }
.reminder-card .rem-actions { margin-top: 12px; display: flex; gap: 8px; }
.delete-btn { padding: 5px 14px; border-radius: 50px; border: 1px solid rgba(248,113,113,0.3); background: transparent; color: var(--error); font-size: 0.78rem; cursor: pointer; font-family: inherit; transition: all .2s; }
.delete-btn:hover { background: rgba(248,113,113,0.1); }

/* ── Smart Home ── */
.smart-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.device-card { display: flex; flex-direction: column; gap: 14px; transition: all .25s; }
.device-card:hover { border-color: rgba(110,231,247,0.3); transform: translateY(-2px); }
.device-card.active-device { border-color: rgba(110,231,247,0.4); background: rgba(110,231,247,0.04); box-shadow: 0 0 20px rgba(110,231,247,0.08); }
.device-icon { font-size: 2rem; }
.device-info h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 2px; }
.device-status { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.device-status.on { color: var(--cyan); }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--surface-hover); border-radius: 26px; cursor: pointer; border: 1px solid var(--border); transition: all .3s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: var(--text-muted); border-radius: 50%; transition: all .3s; }
.toggle-switch input:checked + .toggle-slider { background: linear-gradient(135deg, var(--cyan), var(--purple)); border-color: transparent; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: white; }

/* Thermostat */
.thermostat-card .thermostat-control { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 600; }
.thermo-btn { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-hover); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 1.2rem; transition: all .2s; display: flex; align-items: center; justify-content: center; }
.thermo-btn:hover { border-color: rgba(110,231,247,0.4); color: var(--cyan); }

/* ── History ── */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; animation: fadeIn .3s ease; }
.history-item .h-user { color: var(--cyan); font-size: 0.82rem; margin-bottom: 4px; font-weight: 600; }
.history-item .h-query { font-size: 0.92rem; margin-bottom: 6px; }
.history-item .h-response { color: var(--text-muted); font-size: 0.82rem; line-height: 1.5; }
.history-item .h-meta { display: flex; gap: 10px; margin-top: 8px; }
.h-tag { font-size: 0.72rem; padding: 2px 10px; border-radius: 50px; border: 1px solid var(--border); color: var(--text-muted); }
.h-time { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.85rem; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--surface-hover); border: 1px solid var(--border); border-radius: 50px;
  padding: 10px 24px; font-size: 0.88rem; backdrop-filter: blur(20px);
  transition: transform .3s ease, opacity .3s ease; opacity: 0; z-index: 1000;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: rgba(52,211,153,0.4); color: var(--success); }
.toast.error { border-color: rgba(248,113,113,0.4); color: var(--error); }

/* ── Loading Overlay ── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(4,4,15,0.7); backdrop-filter: blur(4px);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.loading-overlay.visible { display: flex; }
.loading-spinner { width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--cyan); animation: spin 1s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }

/* ── Responsive ── */
@media (max-width: 900px) {
  .assistant-grid { grid-template-columns: 1fr; }
  .side-panels { grid-row: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); }
  .header-nav { gap: 4px; }
  .nav-btn { padding: 6px 10px; font-size: 0.78rem; }
}
@media (max-width: 600px) {
  .app-header { flex-wrap: wrap; padding: 12px 16px; }
  .header-nav { order: 3; width: 100%; justify-content: center; }
  .main-content { padding: 14px; }
}
