/*
======================================================
Student Chatbot Template
Web Design Course Project

This file is the main design playground.

Students are encouraged to change:
- colors
- fonts
- layout
- spacing
- borders
- backgrounds
- message bubble styles
- prompt button styles
- fallback response styles
- animation

Keep class names if you want script.js to work unchanged.
======================================================
*/


/*
======================================================
DESIGN VARIABLES

Start here. Changing these variables changes the whole
interface quickly.
======================================================
*/

:root {
  --page-bg: #202124;
  --surface: #f7f3ea;
  --surface-2: #ebe3d4;

  --text-main: #171717;
  --text-soft: #676056;

  --accent: #2f6f5e;
  --accent-dark: #1d463b;
  --accent-light: #d8f4e7;

  --user-bg: #171717;
  --user-text: #ffffff;

  --bot-bg: #ffffff;
  --bot-text: #171717;

  --fallback-bg: #fff0c2;
  --fallback-text: #4a3600;
  --fallback-border: #c99613;

  --line: rgba(0, 0, 0, 0.12);

  --radius-large: 30px;
  --radius-medium: 18px;
  --radius-small: 10px;

  --shadow: 0 30px 80px rgba(0, 0, 0, 0.34);

  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}


/*
======================================================
BASE
======================================================
*/

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--text-main);
  background:
	radial-gradient(circle at 20% 10%, rgba(216, 244, 231, 0.18), transparent 28rem),
	radial-gradient(circle at 90% 80%, rgba(255, 240, 194, 0.14), transparent 30rem),
	var(--page-bg);
}


/*
======================================================
ACCESSIBILITY HELPER
======================================================
*/

.visually-hidden {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}


/*
======================================================
MAIN LAYOUT
======================================================
*/

.chatbot-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.chatbot-shell {
  width: min(900px, 100%);
  min-height: min(820px, calc(100vh - 56px));
  display: grid;
  grid-template-rows: auto auto auto 1fr auto auto;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius-large);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}


/*
======================================================
HEADER / BOT IDENTITY
======================================================
*/

.chatbot-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.bot-symbol {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
	radial-gradient(circle at 35% 25%, var(--accent-light), var(--accent));
  box-shadow:
	inset 0 0 0 2px rgba(255, 255, 255, 0.45),
	0 14px 28px rgba(47, 111, 94, 0.22);
}

.bot-symbol-core {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
	0 0 0 7px rgba(255, 255, 255, 0.22),
	0 0 24px rgba(255, 255, 255, 0.8);
}

.bot-heading h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.7rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.bot-heading p {
  margin: 8px 0 0;
  color: var(--text-soft);
}


/*
======================================================
WELCOME
======================================================
*/

.welcome-card {
  padding: 16px 18px;
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.welcome-card p {
  margin: 0;
  max-width: 68ch;
  line-height: 1.5;
  color: var(--text-soft);
}


/*
======================================================
STARTER PROMPTS
======================================================
*/

.starter-area h2 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.starter-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prompt-button {
  appearance: none;
  border: 1px solid rgba(47, 111, 94, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  padding: 10px 14px;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition:
	transform 160ms ease,
	background 160ms ease,
	border-color 160ms ease;
}

.prompt-button:hover,
.prompt-button:focus-visible {
  transform: translateY(-2px);
  background: var(--accent-light);
  border-color: var(--accent);
  outline: none;
}

.empty-prompts {
  margin: 0;
  color: var(--text-soft);
}


/*
======================================================
CHAT LOG
======================================================
*/

.chat-log {
  min-height: 280px;
  max-height: 48vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-medium);
  background:
	linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.55);
}


/*
======================================================
MESSAGES

Design challenge:
How should the chatbot sound visually?

Try changing:
- bubble shape
- alignment
- color
- borders
- typography
- meta labels
- fallback style
======================================================
*/

.message-row {
  display: flex;
  width: 100%;
}

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

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

.message-bubble {
  max-width: min(72ch, 84%);
  padding: 13px 15px;
  border-radius: 18px;
  line-height: 1.45;
  font-size: 0.98rem;
  animation: messageIn 220ms ease both;
}

.user-message {
  color: var(--user-text);
  background: var(--user-bg);
  border-bottom-right-radius: 5px;
}

.bot-message {
  color: var(--bot-text);
  background: var(--bot-bg);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom-left-radius: 5px;
}

.bot-message.matched {
  border-color: rgba(47, 111, 94, 0.42);
}

.bot-message.fallback {
  color: var(--fallback-text);
  background: var(--fallback-bg);
  border-color: var(--fallback-border);
}

.message-meta {
  display: block;
  margin-top: 8px;
  font-size: 0.72rem;
  opacity: 0.58;
}


/*
======================================================
CATEGORY HOOKS

The JavaScript adds category classes when available.

Examples:
.category-design
.category-system
.category-interface

Students can add their own category styles.
======================================================
*/

.category-design {
  box-shadow: inset 4px 0 0 rgba(201, 150, 19, 0.5);
}

.category-system {
  box-shadow: inset 4px 0 0 rgba(47, 111, 94, 0.5);
}

.category-interface {
  box-shadow: inset 4px 0 0 rgba(20, 20, 20, 0.35);
}


/*
======================================================
FORM
======================================================
*/

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.message-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.86);
}

.message-input:focus {
  outline: 3px solid rgba(47, 111, 94, 0.18);
  border-color: var(--accent);
}

.send-button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0 22px;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
  transition:
	transform 160ms ease,
	background 160ms ease;
}

.send-button:hover,
.send-button:focus-visible {
  transform: translateY(-1px);
  background: var(--accent-dark);
  outline: none;
}

.send-button:disabled {
  opacity: 0.55;
  cursor: wait;
}


/*
======================================================
FOOTER
======================================================
*/

.chatbot-footer {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.chatbot-footer p {
  margin: 0;
}


/*
======================================================
ANIMATION
======================================================
*/

@keyframes messageIn {
  from {
	opacity: 0;
	transform: translateY(8px) scale(0.98);
  }

  to {
	opacity: 1;
	transform: translateY(0) scale(1);
  }
}


/*
======================================================
MOBILE
======================================================
*/

@media (max-width: 680px) {
  .chatbot-page {
	padding: 0;
  }

  .chatbot-shell {
	min-height: 100vh;
	border-radius: 0;
  }

  .message-bubble {
	max-width: 92%;
  }

  .chat-form {
	grid-template-columns: 1fr;
  }

  .send-button {
	min-height: 48px;
  }
}