/* ============================================
   ACET AI — Stage 1
   Premium Black & Green Voice Interface
   ============================================ */

:root {
  --bg-deep: #030605;
  --bg-panel: rgba(6, 14, 10, 0.72);
  --green-50: #ecfdf5;
  --green-100: #d1fae5;
  --green-300: #6ee7b7;
  --green-400: #34d399;
  --green-500: #10b981;
  --green-600: #059669;
  --green-glow: rgba(16, 185, 129, 0.45);
  --green-strong: #00e68a;
  --text-primary: #f0fdf4;
  --text-secondary: #a7f3d0;
  --text-muted: #6b9b82;
  --border: rgba(16, 185, 129, 0.12);
  --border-strong: rgba(16, 185, 129, 0.28);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Animated Background ---------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #0a1f14 0%, #030605 55%);
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite;
}

.orb-1 {
  width: 55vw;
  height: 55vw;
  max-width: 700px;
  max-height: 700px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.35) 0%, transparent 70%);
  top: -15%;
  left: -10%;
  animation-delay: 0s;
}

.orb-2 {
  width: 45vw;
  height: 45vw;
  max-width: 520px;
  max-height: 520px;
  background: radial-gradient(circle, rgba(5, 150, 105, 0.28) 0%, transparent 70%);
  bottom: -10%;
  right: -5%;
  animation-delay: -6s;
  animation-duration: 22s;
}

.orb-3 {
  width: 35vw;
  height: 35vw;
  max-width: 420px;
  max-height: 420px;
  background: radial-gradient(circle, rgba(0, 230, 138, 0.18) 0%, transparent 70%);
  top: 40%;
  left: 55%;
  animation-delay: -12s;
  animation-duration: 26s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(3%, 4%) scale(1.05); }
  66% { transform: translate(-4%, 2%) scale(0.97); }
}

.noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
}

/* ---------- App Shell ---------- */
.app {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 12px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.08));
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  position: relative;
}

.logo-core {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green-strong);
  box-shadow: 0 0 18px var(--green-glow), 0 0 4px var(--green-strong);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tagline {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-400);
  box-shadow: 0 0 8px var(--green-glow);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ---------- Main Layout ---------- */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  min-height: 0;
  padding-bottom: 12px;
}

/* ---------- Conversation Panel ---------- */
.conversation-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
  color: var(--green-400);
  background: rgba(16, 185, 129, 0.1);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 185, 129, 0.25) transparent;
}

.messages::-webkit-scrollbar {
  width: 5px;
}
.messages::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.25);
  border-radius: 10px;
}

.message {
  max-width: 92%;
  animation: msg-in 0.35s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
}

.message.assistant, .message.system {
  align-self: flex-start;
}

.message-content {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 400;
}

.message.user .message-content {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(5, 150, 105, 0.12));
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  background: rgba(8, 20, 14, 0.7);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message.system .message-content {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  max-width: 100%;
}

.input-area {
  padding: 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.text-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 4px 4px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input-wrapper:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

#textInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font);
  padding: 10px 0;
}

#textInput::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(145deg, var(--green-500), var(--green-600));
  color: #022c22;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  flex-shrink: 0;
}

.send-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.send-btn:active {
  transform: scale(0.94);
}

/* ---------- Voice Core (Major Focus) ---------- */
.voice-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
}

.voice-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(16, 185, 129, 0.12);
  pointer-events: none;
  transition: border-color 0.4s, transform 0.6s ease;
}

.ring-1 { width: 70%; height: 70%; }
.ring-2 { width: 85%; height: 85%; opacity: 0.7; }
.ring-3 { width: 100%; height: 100%; opacity: 0.45; }

.voice-core.listening .ring,
.voice-core.thinking .ring,
.voice-core.speaking .ring {
  border-color: rgba(16, 185, 129, 0.35);
}

.voice-core.listening .ring-1 { animation: ring-pulse 1.8s ease-out infinite; }
.voice-core.listening .ring-2 { animation: ring-pulse 1.8s ease-out 0.25s infinite; }
.voice-core.listening .ring-3 { animation: ring-pulse 1.8s ease-out 0.5s infinite; }

@keyframes ring-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.08); opacity: 0; }
}

.orb {
  position: relative;
  width: 160px;
  height: 160px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  z-index: 2;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.orb:hover {
  transform: scale(1.04);
}

.orb:active {
  transform: scale(0.97);
}

.orb-inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #1a3d2e 0%, #0a1a12 45%, #040a07 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow:
    0 0 40px rgba(16, 185, 129, 0.15),
    inset 0 0 30px rgba(16, 185, 129, 0.08);
  overflow: hidden;
}

.orb-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #34d399, #059669 60%, #047857);
  box-shadow:
    0 0 28px rgba(16, 185, 129, 0.7),
    0 0 8px #10b981;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.orb-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, transparent 65%);
  opacity: 0.6;
  transition: opacity 0.4s;
}

.orb-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(16, 185, 129, 0.3);
  opacity: 0;
  pointer-events: none;
}

.voice-core.listening .orb-core {
  transform: scale(1.15);
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.9), 0 0 12px #10b981;
  animation: core-breathe 1.4s ease-in-out infinite;
}

.voice-core.thinking .orb-core {
  animation: core-spin 2.2s linear infinite;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.6);
}

.voice-core.speaking .orb-core {
  animation: core-speak 0.6s ease-in-out infinite;
}

@keyframes core-breathe {
  0%, 100% { transform: scale(1.1); }
  50% { transform: scale(1.25); }
}

@keyframes core-spin {
  from { transform: rotate(0deg) scale(1.05); }
  to { transform: rotate(360deg) scale(1.05); }
}

@keyframes core-speak {
  0%, 100% { transform: scale(1.08); }
  50% { transform: scale(1.22); }
}

.voice-core.listening .orb-pulse {
  animation: pulse-ring 1.6s ease-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}

.voice-status {
  margin-top: 36px;
  text-align: center;
}

.status-label {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
  transition: color 0.3s;
}

.voice-core.listening .status-label { color: var(--green-300); }
.voice-core.thinking .status-label { color: var(--green-400); }
.voice-core.speaking .status-label { color: var(--green-strong); }

.status-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.quick-actions {
  display: flex;
  gap: 12px;
  margin-top: 40px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(6, 14, 10, 0.6);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: rgba(16, 185, 129, 0.1);
  color: var(--green-300);
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-btn .action-icon {
  font-size: 0.65rem;
  color: var(--green-400);
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.footer .sep {
  opacity: 0.5;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .conversation-panel {
    order: 2;
    max-height: 280px;
  }

  .voice-core {
    order: 1;
    padding: 20px 0;
  }

  .voice-stage {
    max-width: 320px;
  }

  .orb {
    width: 130px;
    height: 130px;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 0 12px;
  }

  .brand-text h1 {
    font-size: 1.1rem;
  }

  .orb {
    width: 110px;
    height: 110px;
  }

  .status-label {
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gradient-orb,
  .ring,
  .orb-core,
  .orb-pulse,
  .status-dot {
    animation: none !important;
  }
}
