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

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-chat: #0f3460;
  --text-primary: #ffffff;
  --text-secondary: #b0b0c8;
  --accent: #e94560;
  --user-bubble: #2563eb;
  --ai-bubble: #334155;
  --font-size-base: 24px;
  --font-size-large: 32px;
  --font-size-small: 20px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--font-size-base);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

/* Main layout: side by side */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* === ASSISTANT PANEL (Left 35%) === */
#assistant-panel {
  width: 35%;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 2px solid rgba(255,255,255,0.1);
}

/* Status bar */
#status-bar {
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
}

#mic-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}

#mic-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

#mic-dot.inactive {
  background: #666;
  animation: none;
}

#mic-dot.recording {
  background: #22c55e;
  animation: pulse 0.6s ease-in-out infinite;
}

#mic-dot.error {
  background: #ff4444;
  animation: none;
}

#mic-label {
  font-size: var(--font-size-small);
  color: var(--text-secondary);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Chat messages */
#chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
}

#messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  max-width: 90%;
  padding: 16px 20px;
  border-radius: 16px;
  line-height: 1.5;
  word-wrap: break-word;
  font-size: var(--font-size-base);
}

.message.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.ai {
  align-self: flex-start;
  background: var(--ai-bubble);
  color: white;
  border-bottom-left-radius: 4px;
}

/* Interim (in-progress) text */
#input-bar {
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid rgba(255,255,255,0.1);
  min-height: 60px;
}

#interim-text {
  font-size: var(--font-size-small);
  color: var(--text-secondary);
  font-style: italic;
  min-height: 1.5em;
}

/* === BROWSER PANEL (Right 65%) === */
#browser-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  position: relative;
}

#browser-bar {
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: var(--font-size-small);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#web-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: white;
  display: none;
}

#web-frame.active {
  display: block;
}

#browser-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

#browser-placeholder.hidden {
  display: none;
}

#placeholder-icon {
  font-size: 80px;
  margin-bottom: 24px;
  opacity: 0.5;
}

#placeholder-text {
  font-size: var(--font-size-large);
  text-align: center;
  line-height: 1.5;
  opacity: 0.6;
}

/* Scrollbar styling */
#chat-container::-webkit-scrollbar {
  width: 8px;
}

#chat-container::-webkit-scrollbar-track {
  background: transparent;
}

#chat-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

/* Mobile / portrait fallback (stacked layout) */
@media (max-width: 768px) {
  #app {
    flex-direction: column;
  }

  #assistant-panel {
    width: 100%;
    min-width: unset;
    height: 40%;
    border-right: none;
    border-bottom: 2px solid rgba(255,255,255,0.1);
  }

  #browser-panel {
    height: 60%;
  }
}
