/* --- CSS Design System & Variables --- */
:root {
  --font-heading: 'Outfit', 'Inter', 'Noto Sans TC', sans-serif;
  --font-body: 'Inter', 'Noto Sans TC', sans-serif;

  /* Colors */
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1524;
  --card-bg: rgba(20, 27, 45, 0.55);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(99, 102, 241, 0.3);

  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --hover-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-color: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.4);
  --success-color: #10b981;
  --error-color: #ef4444;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* --- Background Glow Effects --- */
.app-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
    url('backgroud.png') no-repeat center center;
  background-size: cover;
}

/* --- Layout Container --- */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Header Section --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.avatar-ring {
  position: relative;
  width: 48px;
  height: 48px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  color: #fff;
  font-size: 1.1rem;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
}

.avatar-glow {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--primary-gradient);
  border-radius: 50%;
  z-index: -1;
  filter: blur(6px);
  opacity: 0.7;
  animation: pulse-glow 3s infinite alternate;
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, #c7d2fe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-pulse {
  width: 8px;
  height: 8px;
  background-color: var(--success-color);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--success-color);
  animation: pulse-status 1.8s infinite;
}

.status-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Card Styles (Glassmorphism) --- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  transition: var(--transition-smooth);
}

.card:hover {
  border-color: var(--card-border-hover);
  box-shadow: 0 12px 40px 0 rgba(99, 102, 241, 0.1);
}

/* --- Main Layout Grid --- */
.app-main {
  display: grid;
  grid-template-columns: 0.75fr 1.8fr 1.25fr;
  gap: 20px;
  flex: 1;
}

/* --- Decorative Cat Column --- */
.cat-section-deco {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.cat-card-deco {
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.video-container {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  background-color: #000;
}

.cat-video-player {
  width: 110%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.cat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
}

/* --- Chat Section (Left Column) --- */
.chat-section {
  display: flex;
  flex-direction: column;
}

.chat-card {
  display: flex;
  flex-direction: column;
  height: 680px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* --- Chat Message Bubbles --- */
.message-wrapper {
  display: flex;
  gap: 15px;
  max-width: 85%;
  animation: message-slide-in 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.message-wrapper.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-wrapper.assistant {
  align-self: flex-start;
}

.message-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user .message-avatar {
  background: var(--text-muted);
  color: var(--text-primary);
}

.assistant .message-avatar {
  background: var(--primary-gradient);
  color: #fff;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  line-height: 1.6;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
}

.user .message-bubble {
  background: var(--accent-color);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.assistant .message-bubble {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 4px;
}

.message-bubble p {
  margin-bottom: 8px;
}

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

/* Tool call status block in chat */
.tool-call-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--accent-color);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 5px;
  margin-bottom: 5px;
}

.tool-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* --- Typing Indicator --- */
.typing-indicator-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 25px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.indicator-dots {
  display: flex;
  gap: 4px;
}

.indicator-dots span {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: typing-dots 1.4s infinite ease-in-out both;
}

.indicator-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.indicator-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.indicator-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* --- Suggestion Area --- */
.suggestion-area {
  padding: 15px 20px 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-bounce);
  white-space: nowrap;
}

.chip:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-color);
  color: #fff;
  transform: translateY(-2px);
}

/* --- Chat Input Area --- */
.chat-input-area {
  padding: 15px 20px 20px 20px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input-area textarea {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: none;
  max-height: 120px;
  outline: none;
  transition: var(--transition-smooth);
}

.chat-input-area textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.send-btn {
  background: var(--primary-gradient);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: var(--transition-bounce);
  flex-shrink: 0;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.send-btn:hover {
  background: var(--hover-gradient);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.send-btn:active {
  transform: translateY(0);
}

/* --- Info Column (Right Column) --- */
.info-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-section h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.info-card,
.booking-card {
  padding: 25px;
}

.bio {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 15px;
}

.section-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 15px;
}

/* --- Badges --- */
.tech-stack-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* --- Booking Form --- */
.booking-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.15);
}

.submit-btn {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: var(--transition-bounce);
  margin-top: 5px;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.submit-btn:hover {
  background: var(--hover-gradient);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.booking-status-message {
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 15px;
}

.booking-status-message.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success-color);
  color: var(--success-color);
}

.booking-status-message.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error-color);
  color: var(--error-color);
}

/* --- Footer --- */
.app-footer {
  text-align: center;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 10px;
}

.app-footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Keyframe Animations --- */
@keyframes pulse-glow {
  0% {
    transform: scale(0.97);
    opacity: 0.5;
  }

  100% {
    transform: scale(1.03);
    opacity: 0.85;
  }
}

@keyframes pulse-status {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes message-slide-in {
  0% {
    transform: translateY(12px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes typing-dots {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1.0);
  }
}

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

  100% {
    transform: rotate(360deg);
  }
}

/* --- Responsive Layout (Mobile / Tablet) --- */
@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
  }

  .cat-section-deco {
    display: none;
  }

  .chat-card {
    height: 520px;
  }

  .app-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .status-indicator {
    align-self: flex-end;
  }
}