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

:root {
  --navy: #0d1b2a;
  --navy-mid: #1a2d42;
  --navy-light: #243b55;
  --navy-border: #2d4a6a;
  --accent: #4a9eff;
  --accent-dim: #2d6db5;
  --white: #f0f4f8;
  --white-dim: #a8b8cc;
  --white-faint: #6b7f94;
  --user-bubble: #1e3a5f;
  --ai-bubble: #162233;
  --input-bg: #1a2d42;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background-color: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  line-height: 1.6;
}

/* ===== Layout ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Header ===== */
header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--navy-border);
  background: var(--navy);
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.header-title h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
}

.header-title .subtitle {
  font-size: 0.8rem;
  color: var(--white-dim);
  margin-top: 2px;
}

.header-contact {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.78rem;
  transition: color 0.15s;
}

.contact-link:hover {
  color: var(--white);
}

.contact-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ===== Chat Container ===== */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}
.chat-container::-webkit-scrollbar-track {
  background: transparent;
}
.chat-container::-webkit-scrollbar-thumb {
  background: var(--navy-border);
  border-radius: 3px;
}

/* ===== Messages ===== */
.message {
  display: flex;
  gap: 12px;
  animation: fadeSlideIn 0.2s ease;
}

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

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--white-dim);
  flex-shrink: 0;
  margin-top: 2px;
}

.message.ai .message-avatar {
  background: linear-gradient(135deg, var(--accent-dim), var(--navy-light));
  border-color: var(--accent-dim);
  color: var(--white);
}

.message-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.65;
}

.message.ai .message-bubble {
  background: var(--ai-bubble);
  border: 1px solid var(--navy-border);
  border-top-left-radius: 4px;
  color: var(--white);
}

.message.user .message-bubble {
  background: var(--user-bubble);
  border: 1px solid #2a4d7a;
  border-top-right-radius: 4px;
  color: var(--white);
}

/* Markdown-like formatting in AI responses */
.message-bubble strong {
  color: var(--accent);
  font-weight: 600;
}

.message-bubble em {
  color: var(--white-dim);
  font-style: italic;
}

.message-bubble p + p {
  margin-top: 0.75em;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--white-faint);
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ===== Suggestion Chips ===== */
.suggestions {
  padding: 0 24px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.suggestion-chip {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--navy-border);
  border-radius: 20px;
  color: var(--white-dim);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.suggestion-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74, 158, 255, 0.08);
}

/* ===== Input Area ===== */
.input-area {
  padding: 12px 24px 20px;
  border-top: 1px solid var(--navy-border);
  background: var(--navy);
  flex-shrink: 0;
}

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

#message-input {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--white);
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  min-height: 46px;
  max-height: 160px;
  line-height: 1.5;
  transition: border-color 0.15s;
  outline: none;
}

#message-input::placeholder {
  color: var(--white-faint);
}

#message-input:focus {
  border-color: var(--accent-dim);
}

#send-btn {
  width: 46px;
  height: 46px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

#send-btn:hover {
  background: #5baeff;
}

#send-btn:active {
  transform: scale(0.95);
}

#send-btn:disabled {
  background: var(--navy-light);
  cursor: not-allowed;
}

#send-btn svg {
  width: 18px;
  height: 18px;
  color: white;
}

/* ===== Access Notice ===== */
.access-notice {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 24px;
  color: var(--white-dim);
  text-align: center;
  font-size: 1rem;
  line-height: 1.6;
}

/* ===== Access Notice Elements ===== */
.notice-name {
  color: var(--white);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.notice-tagline {
  color: var(--white-dim);
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 4px;
}

.notice-sub {
  color: var(--white-faint);
  font-size: 0.875rem;
  margin: 0 0 20px;
}

.notice-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.notice-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.notice-email {
  font-size: 0.82rem;
  color: var(--white-faint);
  margin: 12px 0 0;
}

.notice-email a {
  color: var(--white-dim);
  text-decoration: underline;
}

.notice-hint {
  font-size: 0.78rem;
  color: var(--white-faint);
  font-style: italic;
  margin: 6px 0 0;
  opacity: 0.7;
}

/* ===== Cap Message ===== */
.cap-notice {
  text-align: center;
  padding: 16px;
  color: var(--white-faint);
  font-size: 0.82rem;
  border-top: 1px solid var(--navy-border);
}

.cap-notice a {
  color: var(--accent);
  text-decoration: none;
}

.cap-notice a:hover {
  text-decoration: underline;
}

/* ===== Footer ===== */
footer {
  padding: 10px 24px;
  border-top: 1px solid var(--navy-border);
  text-align: center;
  font-size: 0.72rem;
  color: var(--white-faint);
  flex-shrink: 0;
}

footer a {
  color: var(--white-faint);
  text-decoration: none;
}

footer a:hover {
  color: var(--white-dim);
  text-decoration: underline;
}

/* ===== Imprint Page ===== */
.imprint-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  width: 100%;
}

.imprint-header {
  margin-bottom: 40px;
  border: none;
  padding: 0;
}

.imprint-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--white);
  margin-top: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
}

.back-link:hover {
  text-decoration: underline;
}

.imprint-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.imprint-content section h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--white-faint);
  margin-bottom: 10px;
}

.imprint-content section p {
  color: var(--white-dim);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 8px;
}

.imprint-content section p:last-child {
  margin-bottom: 0;
}

.imprint-content a {
  color: var(--accent);
  text-decoration: none;
}

.imprint-content a:hover {
  text-decoration: underline;
}

/* ===== Error State ===== */
.error-bubble {
  background: rgba(220, 50, 50, 0.1);
  border-color: rgba(220, 50, 50, 0.3);
  color: #ff8080;
}

/* ===== Mobile ===== */
@media (max-width: 600px) {
  header {
    padding: 14px 16px 12px;
  }

  .header-title h1 {
    font-size: 1rem;
  }

  .chat-container {
    padding: 16px 16px 8px;
    gap: 12px;
  }

  .message-bubble {
    max-width: 88%;
    font-size: 0.875rem;
  }

  .suggestions {
    padding: 0 16px 12px;
  }

  .suggestion-chip {
    font-size: 0.78rem;
    padding: 7px 12px;
  }

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