/* Remi Design System — Meckman UX */

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

:root {
  --black: #000000;
  --charcoal: #2A2A2A;
  --tan: #FFF2CC;
  --red: #CC0000;
  --white: #FFFFFF;
  --gray: #CCCCCC;
  --tan-20: rgba(255, 242, 204, 0.2);
  --tan-10: rgba(255, 242, 204, 0.1);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--black);
  color: var(--white);
  overflow: hidden;
}

/* Schematic background pattern */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--tan-10) 1px, transparent 1px),
    linear-gradient(90deg, var(--tan-10) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

/* App shell */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--tan-20);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.remi-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--tan);
  object-fit: cover;
  background-color: var(--black);
  flex-shrink: 0;
}

.header-text h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--white);
}

.header-text h1 span {
  color: var(--red);
}

.header-subtitle {
  font-size: 11px;
  color: var(--gray);
  font-weight: 400;
}

/* Deep Dig toggle */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-label {
  color: var(--gray);
  font-size: 11px;
  font-weight: 500;
  user-select: none;
  cursor: pointer;
  white-space: nowrap;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 18px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--charcoal);
  border: 1px solid var(--tan-20);
  border-radius: 18px;
  transition: 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: var(--gray);
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .toggle-slider {
  border-color: var(--red);
}

input:checked + .toggle-slider:before {
  background-color: var(--red);
  transform: translateX(18px);
}

/* Chat area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.chat-area::-webkit-scrollbar {
  width: 4px;
}

.chat-area::-webkit-scrollbar-track {
  background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
  background: var(--charcoal);
  border-radius: 2px;
}

/* Messages */
.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}

.message.user {
  align-self: flex-end;
  background: var(--charcoal);
  border: 1px solid var(--tan-20);
  color: var(--white);
}

.message.bot {
  align-self: flex-start;
  background: var(--charcoal);
  border: 1px solid var(--tan-20);
  color: var(--gray);
}

.message.bot .label {
  font-size: 11px;
  color: var(--tan);
  margin-bottom: 6px;
  font-weight: 500;
}

.message.error {
  align-self: flex-start;
  background: var(--charcoal);
  border: 1px solid var(--red);
  color: var(--gray);
}

/* Loading indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--tan);
  border-radius: 50%;
  animation: typing 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* Input area */
.input-area {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--tan-20);
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.input-wrapper textarea {
  flex: 1;
  background: var(--charcoal);
  color: var(--white);
  border: 1px solid var(--tan-20);
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-wrapper textarea:focus {
  border-color: var(--tan);
  box-shadow: 0 0 0 1px var(--tan-20);
}

.input-wrapper textarea::placeholder {
  color: #666;
}

/* Icon buttons (mic, speaker) */
.icon-btn {
  background: var(--charcoal);
  border: 1px solid var(--tan-20);
  color: var(--gray);
  cursor: pointer;
  border-radius: 6px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--white);
  border-color: var(--tan);
}

.icon-btn.active {
  color: var(--tan);
  border-color: var(--tan);
}

.icon-btn.listening {
  color: var(--red);
  border-color: var(--red);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Send button */
.send-btn {
  background: var(--tan);
  color: var(--black);
  border: none;
  border-radius: 6px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.send-btn:hover {
  background: var(--white);
}

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

/* Welcome state */
.welcome {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray);
}

.welcome .remi-welcome-avatar {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 2px solid var(--tan);
  object-fit: cover;
  margin-bottom: 16px;
}

.welcome h2 {
  font-size: 24px;
  color: var(--white);
  margin-bottom: 4px;
  font-weight: 600;
}

.welcome h2 span {
  color: var(--red);
}

.welcome .subtitle {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 12px;
}

.welcome p {
  font-size: 14px;
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto;
}

.divider {
  width: 60px;
  height: 1px;
  background: var(--tan-20);
  margin: 24px auto;
  position: relative;
}

.divider::after {
  content: "\2022";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--red);
  font-size: 10px;
}

/* Responsive */
@media (max-width: 600px) {
  .header {
    padding: 12px 16px;
  }

  .remi-avatar {
    width: 34px;
    height: 34px;
  }

  .header-text h1 {
    font-size: 18px;
  }

  .toggle-label {
    font-size: 10px;
  }

  .chat-area {
    padding: 16px;
  }

  .input-area {
    padding: 12px 16px 16px;
  }

  .message {
    max-width: 90%;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .send-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}
