/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #0a1628;
  --secondary: #1a2a4a;
  --accent: #00d4aa;
  --accent-glow: rgba(0, 212, 170, 0.3);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.6);
  --card-bg: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.12);
  --chat-bot-bg: rgba(255, 255, 255, 0.12);
  --chat-user-bg: rgba(0, 212, 170, 0.2);
  --danger: #ff4757;
  --warning: #ffc107;
  --radius: 12px;
  --radius-lg: 16px;
  --font: 'Noto Sans TC', 'Inter', -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: linear-gradient(135deg, var(--primary) 0%, #0d1f3c 50%, var(--secondary) 100%);
  color: var(--text);
  overflow: hidden;
}

/* === Header === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: rgba(10, 22, 40, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  z-index: 100;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-right: 12px;
}

.sidebar-toggle:hover {
  background: var(--card-bg);
  border-color: var(--accent);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  height: 32px;
  width: auto;
  background: #fff;
  border-radius: 6px;
  padding: 2px;
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.header-tagline {
  font-size: 13px;
  font-weight: 400;
  color: var(--accent);
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--card-border);
}

.header-tagline:empty {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}

.nav-item:hover { color: var(--text); background: var(--card-bg); }

.nav-item.highlight {
  background: var(--accent);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.highlight:hover {
  background: #00e6b8;
}

/* === Language Selector === */
.lang-selector {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  color: var(--text);
  background: var(--card-bg);
  border-color: var(--accent);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 120px;
  background: linear-gradient(135deg, #1a2a4a, #0d1f3c);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
  z-index: 200;
}

.lang-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.lang-option:hover {
  color: var(--text);
  background: var(--card-bg);
}

/* === Sidebar Overlay === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 56px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

/* === Main Container === */
.main-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 56px);
  gap: 0;
}

/* === Showcase Panel === */
.showcase-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  border-right: 1px solid var(--card-border);
}

.showcase-content {
  text-align: center;
  padding: 16px 0 32px;
}

.hero-logo-img {
  width: 120px;
  height: auto;
  margin-bottom: 16px;
  background: #fff;
  border-radius: 16px;
  padding: 8px;
}

.hero-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.hero-title:empty { display: none; }

.hero-subtitle {
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero-subtitle:empty {
  display: none;
}

.hero-description {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 420px;
  margin: 0 auto 16px;
}

.hero-description:empty { display: none; }

.hero-keywords {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.hero-keywords:empty { display: none; }

.keyword-tag {
  padding: 4px 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

/* === Brand Story === */
.brand-story {
  max-width: 480px;
  padding: 0 24px 32px;
  text-align: center;
}

.brand-story-headline {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
}

.brand-story-text {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 2;
  margin-bottom: 24px;
}

.brand-story-text p {
  margin-bottom: 12px;
}

.brand-story-text p:last-child {
  margin-bottom: 0;
}

.brand-values {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-value-item {
  padding: 10px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  text-align: center;
  transition: all 0.3s;
}

.brand-value-item:hover {
  background: rgba(0, 212, 170, 0.1);
  border-color: rgba(0, 212, 170, 0.3);
}

.brand-value-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.brand-value-en {
  font-size: 11px;
  color: var(--text-muted);
}

/* === Chat Panel === */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(0, 0, 0, 0.15);
}

.chat-mode-badge {
  padding: 4px 12px;
  background: var(--warning);
  color: var(--primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  margin: 8px 20px 0;
}

/* === Chat Messages === */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 92%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  animation: messageIn 0.3s ease;
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: messageIn 0.3s ease;
}

.message-row.bot {
  align-self: flex-start;
}

.message-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
  margin-top: 2px;
}

.message-row.user .message-avatar {
  display: none;
}

.message.bot {
  background: var(--chat-bot-bg);
  border: 1px solid var(--card-border);
}

.message.user {
  background: var(--chat-user-bg);
  border: 1px solid rgba(0, 212, 170, 0.3);
}

.message.system {
  align-self: center;
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.3);
  color: var(--warning);
  font-size: 13px;
  text-align: center;
}

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
  background: var(--chat-bot-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s 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% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* === Chat Input === */
.chat-input-area {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.1);
}

#chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}

#chat-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

#chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  padding: 12px 24px;
  background: var(--accent);
  color: var(--primary);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chat-send-btn:hover { background: #00e6b8; }
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: linear-gradient(135deg, #1a2a4a, #0d1f3c);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 380px;
  max-width: 90vw;
}

.modal-box h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.modal-box p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-box input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  margin-bottom: 20px;
}

.modal-box input:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-primary {
  padding: 10px 24px;
  background: var(--accent);
  color: var(--primary);
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover { background: #00e6b8; }

.btn-secondary {
  padding: 10px 24px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover { background: var(--card-bg); color: var(--text); }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* === Responsive === */
@media (max-width: 900px) {
  .sidebar-toggle {
    display: flex;
  }

  .header-tagline {
    display: none !important;
  }

  .main-container {
    grid-template-columns: 1fr;
  }

  .showcase-panel {
    position: fixed;
    top: 56px;
    left: 0;
    width: 85%;
    max-width: 400px;
    height: calc(100vh - 56px);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
    background: linear-gradient(135deg, var(--primary) 0%, #0d1f3c 50%, var(--secondary) 100%);
    border-right: 1px solid var(--card-border);
  }

  .showcase-panel.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
  }

  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .chat-panel {
    height: calc(100vh - 56px);
  }
}

@media (max-width: 480px) {
  .header { padding: 0 12px; }
  .showcase-panel { padding: 16px; }
  .chat-messages { padding: 12px; }
  .chat-input-area { padding: 12px; }
  .nav-item { padding: 6px 12px; font-size: 13px; }
  .lang-btn { min-width: 32px; height: 32px; font-size: 12px; }
}
