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

:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --border: #e5e7eb;
  --bot-bubble: #f9fafb;
  --user-bubble: #2563eb;
  --user-bubble-text: #ffffff;
  --text-main: #111827;
  --text-sub: #6b7280;
  --accent: #2563eb;
  --radius-md: 16px;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #e0edff 0, #f3f4f6 55%, #f9fafb 100%);
  color: var(--text-main);
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 16px;
}

.app {
  width: 100%;
  max-width: 960px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.3);
  overflow: hidden;
}

/* Header */

.app-header {
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.12),
    rgba(236, 72, 153, 0.04)
  );
}

.header-left h1 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 650;
}

.subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-sub);
}

.status-pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(248, 250, 252, 0.9);
  color: #4b5563;
  white-space: nowrap;
}

/* Chat */

.chat-container {
  flex: 1;
  padding: 6px 16px 10px;
  display: flex;
}

.chat-messages {
  width: 100%;
  margin: 4px auto;
  padding: 8px 4px 10px;
  overflow-y: auto;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.7);
  border-radius: 999px;
}

/* Messages */

.message-row {
  display: flex;
  margin-bottom: 10px;
}

.message-row.bot {
  justify-content: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 74%;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid rgba(148, 163, 184, 0.4);
  white-space: pre-wrap;
}

.message-row.bot .message-bubble {
  background: var(--bot-bubble);
  border-bottom-left-radius: 4px;
}

.message-row.user .message-bubble {
  background: var(--user-bubble);
  color: var(--user-bubble-text);
  border-bottom-right-radius: 4px;
  border-color: rgba(37, 99, 235, 0.5);
}

/* Input area */

.input-area {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(248, 250, 252, 0.95),
    rgba(255, 255, 255, 0.98)
  );
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#user-input {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 14px;
  outline: none;
  background: #f9fafb;
}

#user-input:focus {
  border-color: rgba(37, 99, 235, 0.7);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.primary-btn {
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.45);
  white-space: nowrap;
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.08s ease;
}

.primary-btn:active {
  transform: translateY(1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

/* Mic button */

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background: #f9fafb;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease, box-shadow 0.1s ease, transform 0.05s ease;
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn.recording {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
  box-shadow: 0 0 14px rgba(220, 38, 38, 0.7);
}

/* Options row */

.options-row {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-sub);
}

.recording-indicator {
  font-size: 13px;
  font-weight: 600;
  color: #dc2626;
}

.hidden {
  display: none;
}

/* Mobile */

@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .app {
    border-radius: 0;
  }

  .message-bubble {
    max-width: 86%;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-pill {
    margin-top: 4px;
  }
}
