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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #e8fff2 0, #f7fbff 55%, #edf7ff 100%);
  color: #0f172a;
}

/* -------- Header -------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10b981, #22c55e);
  color: #f9fafb;
  font-weight: 700;
  font-size: 0.9rem;
}

.app-header h1 {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.app-header p {
  font-size: 0.78rem;
  color: #64748b;
}

/* -------- Main Layout -------- */
.app-main {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.6fr);
  gap: 18px;
  padding: 14px 18px 18px;
}

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* -------- Chat Section -------- */
.chat-section {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: 78vh;
}

.chat-box {
  flex: 1;
  padding: 14px 14px 8px;
  overflow-y: auto;
}

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

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

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

.message-bubble {
  max-width: 75%;
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

.user .message-bubble {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ecfdf3;
  border-bottom-right-radius: 4px;
}

.bot .message-bubble {
  background: #eff6ff;
  color: #0f172a;
  border-bottom-left-radius: 4px;
}

/* Input bar */
.input-bar {
  display: flex;
  padding: 8px 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  gap: 8px;
}

.input-bar input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
}

.input-bar input:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.input-bar button {
  border-radius: 999px;
  padding: 10px 18px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.input-bar button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.4);
}

/* -------- Analytics Section -------- */
.analytics-section {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  padding: 12px 13px 14px;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.06);
  min-height: 420px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
}

.analytics-section h2 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  flex: 1;
}

@media (max-width: 900px) {
  .analytics-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card {
  background: #f9fafb;
  border-radius: 10px;
  padding: 9px 10px 11px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  flex-direction: column;
  min-height: 90px;
}

.card.wide {
  grid-column: span 2;
}

.card h3 {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.card-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 4px;
}

/* Pills / chips */
.pill-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bfdbfe;
}

.pill.secondary {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.pill-container.empty {
  opacity: 0.8;
  font-size: 0.8rem;
  color: #94a3b8;
}

/* Next word prediction box */
.prediction-box {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #ecfdf3;
  border: 1px dashed #16a34a;
  font-size: 0.9rem;
  min-height: 34px;
  display: flex;
  align-items: center;
}

/* -------- Footer -------- */
.app-footer {
  text-align: center;
  padding: 8px 10px 14px;
  font-size: 0.7rem;
  color: #6b7280;
}
