/* --- MicroChat2.0 original stylesheet (kept exactly) --- */

/* --- Global Reset & Typography --- */
:root {
  --primary-color: #007bff;
  /* Modern Blue */
  --primary-dark: #0056b3;
  --background-light: #e8e8e8;
  --text-color: #333;
  --card-bg: #ffffff;
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.08);
  --border-radius: 12px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background-light);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Navigation Bar --- */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 5%;
  background-color: var(--card-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.logo i {
  margin-right: 8px;
}

#language-select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  cursor: pointer;
  appearance: none;
  /* Remove default styling */
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23333'><polygon points='0,0 10,0 5,10'/></svg>") no-repeat right 10px center;
  background-size: 8px;
  padding-right: 30px;
}

/* --- Main Content Layout --- */
.container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 5%;
}

.hero-section {
  text-align: center;
  padding: 40px 0;
  margin-bottom: 20px;
}

.hero-section h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--primary-dark);
}

.hero-section p {
  font-size: 1.1rem;
  color: #666;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--primary-color);
  display: inline-block;
  padding-bottom: 5px;
}

/* --- Options Grid (The modern layout) --- */
.options-grid {
  display: grid;
  /* Responsive grid: 1 column on mobile, up to 3 on desktop */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

.option-card {
  display: flex;
  flex-direction: column;
  padding: 25px;
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--text-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.option-card:hover {
  transform: translateY(-5px);
  /* Lift effect */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  /* Stronger shadow */
}

.card-icon {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.option-card h3 {
  font-size: 1.4rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.option-card p {
  font-size: 0.9rem;
  color: #666;
}

/* Highlight the primary feature (ChatBot) */
.primary-card {
  border: 2px solid var(--primary-color);
}

.primary-card .card-icon {
  color: var(--primary-dark);
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 20px;
  margin-top: 50px;
  border-top: 1px solid #e0e0e0;
  background-color: var(--card-bg);
  color: #999;
  font-size: 0.85rem;
}

/* Site footer as a card-like white box (matches header aesthetics) */
.site-footer {
  background-color: var(--card-bg);
  padding: 18px 5%;
  text-align: center;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(2, 6, 23, 0.04);
  margin: 20px auto;
  width: calc(100% - 10%);
  max-width: 1200px;
  color: #6b7280;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 600px) {
  .options-grid {
    grid-template-columns: 1fr;
    /* Stack cards on very small screens */
  }

  .hero-section h1 {
    font-size: 2rem;
  }
}

/* --- ChatWidget + feature panels (added; styled to match MicroChat2.0 tokens) --- */

.ai-chat-root {
  width: 100%;
  max-width: 440px;
  font-family: inherit;
  color: #0f172a;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  /* Changed from linear-gradient to pure white */
  border: 1px solid rgba(2, 6, 23, 0.04);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
}

/* Header */
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
  background: transparent;
}

.ai-chat-title {
  font-size: 15px;
  font-weight: 600;
  color: #0b1220;
}

.ai-chat-close {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  border-radius: 8px;
}

.ai-chat-close:focus {
  outline: 2px solid rgba(30, 144, 255, 0.14)
}

/* Chat area */
.ai-chat-body {
  min-height: 340px;
  max-height: 60vh;
  /* Increased from 60vh */
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
}

/* Message bubbles (map to MicroChat2.0 look) */
.msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.35;
  word-break: break-word;
  box-shadow: 0 2px 6px rgba(2, 6, 23, 0.04);
  font-size: 14px;
}

.msg.assistant {
  margin-right: auto;
  background: #f3f4f6;
  color: #0f172a;
  border-bottom-left-radius: 6px;
}

.msg.user {
  margin-left: auto;
  background: #e6f7ff;
  color: #0b1220;
  border-bottom-right-radius: 6px;
  text-align: right;
}

/* meta time text */
.msg-meta {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
  opacity: 0.9;
  text-align: right;
}

/* Input area */
.ai-chat-footer {
  padding: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.04);
  background: #ffffff;
  /* Ensure footer is solid white for input area */
  position: relative;
  /* Anchor for absolute suggestions */
  z-index: 20;
}

.ai-chat-composer {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  resize: none;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 14px;
  color: #0b1220;
  background: #fff;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.ai-chat-input:focus {
  box-shadow: 0 0 0 4px rgba(30, 144, 255, 0.08);
  border-color: var(--primary-color);
}

/* Buttons */
.ai-chat-send {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.ai-chat-send:disabled {
  opacity: 0.6;
  cursor: default;
}

/* small usage info text under composer */
.ai-chat-usage {
  font-size: 12px;
  color: #9ca3af;
  text-align: left;
  padding-left: 4px;
}

/* Typing indicator */
.typing-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px;
}

.typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.6);
  opacity: 0.4;
  animation: bounce 1s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: .15s
}

.typing-dots span:nth-child(3) {
  animation-delay: .3s
}

@keyframes bounce {

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

  50% {
    transform: translateY(-6px);
    opacity: 1
  }
}

/* Suggestion Chips - Marquee Style */
.ai-chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  /* Reduced gap from 8px */
  padding: 10px 0;
  background: transparent;
  border-top: none;

  /* Overlay positioning */
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
}

.suggestion-row {
  display: flex;
  width: 100%;
  overflow: hidden;
  position: relative;
  pointer-events: auto;
  justify-content: center;
  /* Start centered */
}

.suggestion-track {
  display: flex;
  gap: 12px;
  white-space: nowrap;
  pointer-events: auto;
}

/* Animations */
/* Slower: 15s */
/* Start from center: 0% */
@keyframes marqueeLeft {
  0% {
    transform: translateX(0%);
  }

  100% {
    transform: translateX(-150%);
  }
}

@keyframes marqueeRight {
  0% {
    transform: translateX(0%);
  }

  100% {
    transform: translateX(150%);
  }
}

.scroll-left .suggestion-track {
  animation: marqueeLeft 15s linear infinite;
}

.scroll-right .suggestion-track {
  animation: marqueeRight 15s linear infinite;
  display: flex;
  /* Ensure reverse works */
  flex-direction: row-reverse;
  justify-content: flex-end;
}


.suggestion-chip {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  /* Increased size: 7px 11px padding, 11px font */
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  text-align: center;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.suggestion-chip:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.6);
  z-index: 100;
}

/* Specific Colors via JS classes */
.chip-color-1 {
  background: rgba(254, 226, 226, 0.4);
  border-color: rgba(252, 165, 165, 0.4);
  color: #a21111;
}

.chip-color-2 {
  background: rgba(254, 243, 199, 0.4);
  border-color: rgba(253, 230, 138, 0.4);
  color: #ebe306;
}

.chip-color-3 {
  background: rgba(209, 250, 229, 0.4);
  border-color: rgba(110, 231, 183, 0.4);
  color: #219b03;
}

.chip-color-4 {
  background: rgba(219, 234, 254, 0.4);
  border-color: rgba(147, 197, 253, 0.4);
  color: #1e40af;
}


.suggestion-chip:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.1),
    inset 0 0 20px rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.9);
  z-index: 10;
}

.suggestion-chip::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg,
      rgba(255, 255, 255, 0) 40%,
      rgba(255, 255, 255, 0.7) 50%,
      rgba(255, 255, 255, 0) 60%);
  transform: rotate(45deg);
  transition: all 0.5s;
  opacity: 0;
}

.suggestion-chip:hover::after {
  opacity: 1;
  left: 100%;
  transition: 0.7s;
}

.suggestion-chip:active {
  transform: translateY(0);
}

/* Feature panel base (drawing, games, stories) - visually consistent */
.feature-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 880px;
  max-width: calc(100% - 48px);
  background: linear-gradient(180deg, #fff, #f8fafc);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.12);
  border: 1px solid rgba(2, 6, 23, 0.04);
  z-index: 1100;
  overflow: hidden;
}

.feature-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(254, 255, 255, 0.04);
  background: transparent;
}

.feature-title {
  font-weight: 700;
  color: #0b1220;
}

.feature-close {
  background: transparent;
  border: 0;
  color: #333;
  font-size: 20px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.feature-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #000;
}

.feature-body {
  padding: 16px;
  background: hsl(0, 0%, 100%);
  max-height: 75vh;
  /* Limit height to allow scrolling */
  overflow-y: auto;
  /* Enable vertical scrolling */
}

/* Story panel body: make scrollable when content exceeds a comfortable height */
.story-body {
  max-height: 60vh;
  /* responsive max height relative to viewport */
  overflow-y: auto;
  padding-right: 8px;
  /* space for scrollbar */
  line-height: 1.6;
}

/* Small tasteful scrollbar for WebKit */
.story-body::-webkit-scrollbar {
  width: 10px;
}

.story-body::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.12);
  border-radius: 8px;
}

.story-body::-webkit-scrollbar-track {
  background: transparent;
}

.colorPalette {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.colorButton {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(2, 6, 23, 0.06);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 6, 23, 0.04);
}

/* Responsive adjusts for feature panels */
@media (max-width:920px) {
  .feature-panel {
    width: calc(100% - 48px);
    right: 24px;
    left: 24px;
    bottom: 24px;
  }

  .ai-chat-root {
    right: 14px;
    bottom: 14px;
    max-width: 96%;
  }
}

/* To-Do List Styling */
.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.todo-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border-color: #cbd5e1;
}

.todo-item.completed {
  background: #f8fafc;
  opacity: 0.8;
}

.todo-item.completed span {
  text-decoration: line-through;
  color: #94a3b8;
}

/* Custom Checkbox */
.todo-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  margin-right: 12px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.todo-checkbox:checked {
  background-color: #10b981;
  border-color: #10b981;
}

.todo-checkbox:checked::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 14px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
}

.todo-checkbox:hover {
  border-color: #10b981;
}

.todo-delete {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  margin-left: 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.todo-delete:hover {
  background: #fee2e2;
}