/* =========================================
   AI Kids Learning Platform - Shared Styles
   ========================================= */

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

:root {
  --primary: #5c6bc0;
  --primary-dark: #3949ab;
  --secondary: #ff7043;
  --success: #43a047;
  --bg: #f0f4ff;
  --white: #ffffff;
  --text: #2d3748;
  --text-light: #718096;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 14px;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Navigation */
nav {
  background: var(--white);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

nav .nav-links a {
  margin-left: 24px;
  text-decoration: none;
  color: var(--text-light);
  font-weight: 500;
  transition: color 0.2s;
}

nav .nav-links a:hover,
nav .nav-links a.active {
  color: var(--primary);
}

/* Page Layout */
.page-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

/* Buttons */
.btn {
  padding: 12px 28px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #a0aec0;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
}

/* Chat Box */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 460px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header .avatar {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 0.95rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  background: #f7f8fc;
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.message.thinking {
  background: #f7f8fc;
  color: var(--text-light);
  align-self: flex-start;
  border: 1px solid var(--border);
  font-style: italic;
}

.chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-area input:focus {
  border-color: var(--primary);
}

/* Module Cards on Homepage */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.module-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
  display: block;
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  border-color: var(--primary);
}

.module-card .icon {
  font-size: 2.5rem;
  margin-bottom: 14px;
}

.module-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  color: var(--primary);
}

.module-card p {
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Page Hero */
.hero {
  text-align: center;
  padding: 40px 20px 20px;
}

.hero h1 {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.hero p {
  color: var(--text-light);
  font-size: 1.05rem;
  max-width: 500px;
  margin: 0 auto;
}

/* Tip Box */
.tip-box {
  background: #e8f5e9;
  border-left: 4px solid var(--success);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: #2e7d32;
}

/* Reset chat button */
.reset-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 0.85rem;
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.reset-btn:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* Image result */
.image-result {
  margin-top: 20px;
  text-align: center;
}

.image-result img {
  max-width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 600px) {
  nav { padding: 12px 16px; }
  .page-container { padding: 20px 14px; }
  .hero h1 { font-size: 1.5rem; }
  .modules-grid { grid-template-columns: 1fr; }
}
