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

html {
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    sans-serif;
  color: #111827;
}

.app-shell {
  display: flex;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  position: relative;
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }
}

.sidebar {
  width: 320px;
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    max-height: 40vh;
  }
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f3f4f6;
}

.sidebar-header h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.sidebar-subtitle {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: #6b7280;
}

.model-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.model-list-item {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  margin: 4px 0;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}

.model-list-item:hover {
  background: #e5e7eb;
}

.model-list-item.active {
  background: #f97316;
  border-color: #ea580c;
  color: #ffffff;
}

.model-list-item-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.model-list-item-subtitle {
  font-size: 0.78rem;
  color: #6b7280;
}

.model-list-item.active .model-list-item-subtitle {
  color: #fef3c7;
}

.chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.chat-header {
  padding: 12px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.chat-header-text h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
}

.chat-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  display: none;
}

.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #e5e7eb;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.3);
  transition: transform 0.15s ease;
}

.toggle input:checked + .toggle-track {
  background: #276a3a;
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
}

.toggle-label {
  white-space: nowrap;
}

.chat-header-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: #6b7280;
}

.chat-window {
  flex: 1;
  padding: 16px 14px 80px; /* Extra bottom padding to ensure content isn't hidden behind form */
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  min-height: 0;
  position: relative;
}

.chat-placeholder {
  text-align: center;
  margin-top: 20%;
  color: #6b7280;
  font-size: 0.9rem;
}

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

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

.message.assistant {
  justify-content: flex-start;
}

.message-bubble {
  max-width: min(80%, 640px);
  padding: 10px 12px;
  border-radius: 16px;
  position: relative;
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.message-bubble p {
  margin: 0 0 6px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble ul,
.message-bubble ol {
  margin: 4px 0 6px 1.25rem;
  padding-left: 0;
}

.message-bubble li + li {
  margin-top: 2px;
}

.message.user .message-bubble {
  background: #276a3a;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: #f3f4f6;
  color: #111827;
  border-bottom-left-radius: 4px;
}

.message-text {
  margin: 0 0 3px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-meta {
  display: inline-block;
  font-size: 0.7rem;
  opacity: 0.7;
  float: right;
  color: #6b7280;
}

.tts-button {
  border: none;
  background: transparent;
  cursor: pointer;
  margin-right: 6px;
  padding: 0;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tts-button svg {
  width: 18px;
  height: 18px;
}

.tts-button:hover {
  color: #111827;
}

.message-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0; /* Prevent form from shrinking */
  position: relative;
  z-index: 10;
}

.message-input-wrapper {
  flex: 1;
  background: #ffffff;
  border-radius: 8px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  display: flex;
}

.message-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: #111827;
  font-size: 0.9rem;
  resize: none;
  max-height: 120px;
}

.message-input::placeholder {
  color: #9ca3af;
}

.message-input:disabled {
  color: #6b7280;
}

.send-button {
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  background: #276a3a;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
  transition: background 0.15s ease, box-shadow 0.15s ease,
    transform 0.05s ease;
}

.send-button:hover:not(:disabled) {
  background: #ea580c;
  transform: translateY(-0.5px);
}

.send-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 0 0 rgba(15, 23, 42, 0.15);
}

.send-button:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: default;
  box-shadow: none;
}

.send-button-tts {
  background: #276a3a;
  min-width: 64px;
}

.send-button-tts-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.send-button-tts-svg {
  width: 22px;
  height: 22px;
}

.send-button-tts-svg .wave-group rect {
  fill: #ffffff;
  animation: wave-pulse 0.9s ease-in-out infinite;
  transform-origin: center bottom;
}

.send-button-tts-svg .wave-group rect:nth-child(2) {
  animation-delay: 0.15s;
}

.send-button-tts-svg .wave-group rect:nth-child(3) {
  animation-delay: 0.3s;
}

.send-button-tts-svg .stop-rect {
  fill: #ffffff;
  opacity: 0.9;
}

@keyframes wave-pulse {
  0%,
  100% {
    transform: scaleY(0.6);
  }
  50% {
    transform: scaleY(1);
  }
}

.status-banner {
  text-align: center;
  font-size: 0.8rem;
  padding: 2px 10px;
  color: #6b7280;
}

.status-banner span {
  opacity: 0.7;
}

.status-banner.error {
  color: #fecaca;
}

.table-like-list {
  margin: 8px 0;
  padding-left: 18px;
}

.table-like-list li {
  margin-bottom: 2px;
}

.table-like-list li strong {
  color: #111827;
}

@media (max-width: 600px) {
  .app-shell {
    border-radius: 0;
    height: 80vh;
    height: 80dvh; /* Dynamic viewport height for mobile */
    max-height: 80vh;
    max-height: 80dvh;
  }

  .chat-pane {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-window {
    padding: 10px 8px 100px; /* Extra bottom padding on mobile to ensure Send button is accessible */
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
  }

  .message-bubble {
    max-width: 85%;
    font-size: 0.85rem;
  }

  .message-form {
    padding: 8px 10px;
    flex-shrink: 0;
    position: relative;
    background: #f9fafb;
  }

  .send-button {
    padding: 8px 14px;
    font-size: 0.8rem;
    min-height: 36px; /* Ensure button is tappable */
  }

  .chat-header {
    padding: 10px 12px;
    flex-shrink: 0;
  }

  .chat-header-text h2 {
    font-size: 0.95rem;
  }

  .chat-header-subtitle {
    font-size: 0.75rem;
  }
}


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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(0, 166, 166, 0.12), transparent 55%), linear-gradient(to bottom, #f9fafb, #eef2f7);
  min-height: 100vh;
  padding: 20px;
  color: #111827;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  padding: 40px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

.seagry-header h1 {
  font-size: 2.2em;
  color: #003046;
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

.header-banner {
  position: relative;
  margin-bottom: 20px;
  height: 200px;
  overflow: hidden;
  width: 100%;
}

.header-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/img/support.jpg");
  background-size: cover;
  background-position: center -130px;
  background-repeat: no-repeat;
  opacity: 0.6;
  pointer-events: none;
}

.header-banner .logo-container {
  position: relative;
  z-index: 1;
  height: 100%;
}

.logo-container {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.company-logo {
  max-height: 72px;
  max-width: 100%;
  height: auto;
  width: auto;
  object-fit: contain;
  margin-bottom: 10px;
}

header h1 {
  font-size: 2.2em;
  color: #003046;
  margin-bottom: 10px;
}

.subtitle {
  color: #6b7280;
  font-size: 1.05em;
}

.recording-section {
  margin-bottom: 40px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin-bottom: 30px;
}

.btn {
  padding: 15px 30px;
  font-size: 1.1em;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

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

.btn-primary {
  background: #00a6a6;
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #0f766e;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.btn-secondary {
  background: #003046;
  color: #ffffff;
}

.btn-secondary:hover:not(:disabled) {
  background: #021a28;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(118, 75, 162, 0.4);
}

.btn-warning {
  background: #ff9f1c;
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background: #e67e22;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

.btn-outline {
  background: transparent;
  color: #003046;
  border: 2px solid #cbd5e1;
}

.btn-outline:hover {
  background: #e0f2f2;
  color: #003046;
}

.icon {
  font-size: 1.2em;
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  margin-bottom: 20px;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #95a5a6;
}

.status-indicator.recording {
  background: #e74c3c;
  animation: pulse 1.5s infinite;
}

.status-indicator.paused {
  background: #f39c12;
  animation: pulse 1.5s infinite;
}

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

#statusText {
  font-weight: 500;
  color: #555;
}

.transcription-section {
  margin-top: 30px;
}

.transcription-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 15px;
}

.transcription-section h2 {
  color: #667eea;
  margin: 0;
  font-size: 1.5em;
}

.btn-small {
  padding: 10px 20px;
  font-size: 0.9em;
}

.transcription-box {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 20px;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 15px;
  line-height: 1.6;
  color: #333;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.transcription-box:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: #ffffff;
}

.transcription-box p {
  margin: 0 0 10px 0;
}

.transcription-box p:last-child {
  margin-bottom: 0;
}

.transcription-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  background: #e8f4f8;
  border-left: 4px solid #667eea;
  border-radius: 5px;
  margin-bottom: 20px;
  font-size: 0.9em;
  color: #555;
  font-style: italic;
}

.transcription-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.summary-section {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 2px solid #e9ecef;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.summary-section h2 {
  color: #667eea;
  margin: 0;
  font-size: 1.5em;
}

.summary-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-content {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 30px;
}

.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.summary-section-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-section-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.summary-section-title {
  color: #667eea;
  font-size: 1.4em;
  font-weight: 700;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 3px solid #667eea;
  display: flex;
  align-items: center;
  gap: 10px;
}

.summary-section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

.summary-text {
  line-height: 1.8;
  color: #555;
  margin: 0;
  font-size: 1.05em;
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.summary-list li {
  padding: 15px 20px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-left: 4px solid #667eea;
  border-radius: 8px;
  line-height: 1.7;
  color: #333;
  font-size: 1.05em;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.summary-list li:hover {
  background: linear-gradient(135deg, #f0f4ff 0%, #ffffff 100%);
  border-left-color: #764ba2;
  transform: translateX(4px);
}

.summary-list li.na-item {
  color: #999;
  font-style: italic;
  background: #f8f9fa;
  border-left-color: #ddd;
}

.summary-list li.na-item:hover {
  background: #f8f9fa;
  transform: none;
  border-left-color: #ddd;
}

.summary-section strong {
  color: #667eea;
  font-weight: 600;
}

.summary-section em {
  color: #764ba2;
  font-style: italic;
}

.app-footer {
  margin-top: 60px;
  padding-top: 30px;
  border-top: 2px solid #e9ecef;
  text-align: center;
  color: #666;
  font-size: 0.9em;
}

.app-footer p {
  margin: 0;
  line-height: 1.6;
}

