/* ============================================
   Mr Hope's Classroom - Class Whiteboard App
   Matching the main classroom design system
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500&family=Roboto:wght@400;500&display=swap');

/* ===== Design System Variables ===== */
:root {
  /* Typography */
  --font-display: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* Neutrals */
  --white: #ffffff;
  --grey-50: #f8f9fa;
  --grey-100: #f1f3f4;
  --grey-200: #e8eaed;
  --grey-300: #dadce0;
  --grey-600: #5f6368;
  --grey-900: #202124;
  
  /* Colors - Matching index.html and KS3 */
  --green: #34a853;
  --green-hover: #2e7d32;
  --green-light: #e6f4ea;
  --green-gradient: linear-gradient(135deg, #81c995 0%, #34a853 100%);
  
  --blue: #1a73e8;
  --blue-light: #e8f0fe;
  --blue-gradient: linear-gradient(135deg, #64b5f6 0%, #1a73e8 100%);
  
  --orange: #E67E22;
  --orange-hover: #D35400;
  --orange-light: #FDF2E9;
  --orange-gradient: linear-gradient(135deg, #ffb74d 0%, #E67E22 100%);
  
  --purple: #9c27b0;
  --purple-light: #f3e5f5;
  --purple-gradient: linear-gradient(135deg, #ce93d8 0%, #9c27b0 100%);
  
  --teal: #00796b;
  --teal-light: #e0f2f1;
  --teal-gradient: linear-gradient(135deg, #80cbc4 0%, #00796b 100%);
  
  --yellow: #f9a825;
  --yellow-light: #fef7e0;
  --yellow-gradient: linear-gradient(135deg, #fff176 0%, #f9a825 100%);
  
  --red: #d93025;
  --red-light: #fce8e6;
  
  /* Shadows - Matching main app */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-modal: 0 30px 100px rgba(0, 0, 0, 0.1);
  
  /* Radii - Matching main app */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-modal: 40px;
  --radius-full: 100px;
  
  /* Semantic Aliases */
  --primary: var(--green);
  --primary-hover: var(--green-hover);
  --primary-light: var(--green-light);
  --text-primary: var(--grey-900);
  --text-secondary: var(--grey-600);
  --bg-white: var(--white);
  --bg-light: var(--grey-50);
  --border-color: var(--grey-200);
  
  /* Legacy error colors for compatibility */
  --success-green: var(--green);
  --error-red: var(--red);
  --primary-blue: var(--blue);
}

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-light);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-top: 72px;
}

/* ===== Navigation Bar ===== */
.flex-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: var(--white);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
}

.flex-nav-left {
  display: flex;
  align-items: center;
}

.flex-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.flex-logo-icon {
  width: 40px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-avatar {
  width: 100%;
  height: 100%;
}

.flex-logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.3px;
}

.flex-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Home Button - Matching KS3 icon-btn style */
.home-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-600);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}
.home-btn:hover { 
  background: var(--green-light); 
  color: var(--green);
}
.home-btn svg { 
  width: 22px; 
  height: 22px;
  stroke: currentColor;
}

/* ===== Buttons - Matching main app ===== */
.flex-btn-outline {
  padding: 10px 24px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--primary);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  background: transparent;
  cursor: pointer;
}

.flex-btn-outline:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.flex-btn-primary {
  padding: 10px 24px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(52, 168, 83, 0.2);
}

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

.flex-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.flex-link:hover {
  color: #2e7d32;
  text-decoration: underline;
}

/* ===== Main Content ===== */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ===== Sections ===== */
.app-section {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 24px;
}

.app-section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.app-section-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.flex-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

/* ===== Activity Cards Grid ===== */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.activity-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.activity-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  border-color: var(--primary);
}

.activity-icon {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 12px 0;
  border-radius: 12px;
}

.activity-icon svg {
  width: 100%;
  height: 100%;
  max-width: 120px;
}

.activity-card-content {
  padding: 16px 20px 20px;
}

.activity-label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  color: var(--grey-600);
  background: var(--grey-100);
  padding: 4px 10px;
  border-radius: 100px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.activity-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.activity-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Activity color themes */
.activity-icon.wordcloud { background: var(--orange-gradient); }
.activity-icon.multiplechoice { background: var(--blue-gradient); }
.activity-icon.anagram { background: var(--purple-gradient); }
.activity-icon.exam { background: var(--teal-gradient); }

/* ===== Form Elements ===== */
.app-input-group {
  margin-bottom: 20px;
}

.app-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.app-input,
.app-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--white);
  transition: all 0.2s;
}

.app-input:focus,
.app-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.12);
}

.app-textarea {
  min-height: 100px;
  resize: vertical;
}

.app-file-input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--grey-50);
}

.app-input-group small {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ===== Actions ===== */
.app-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ===== Modal - Matching main app style ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-modal);
  padding: 64px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  border: 1px solid #f0f0f0;
  animation: modalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--grey-100);
  color: var(--text-primary);
}

.mc-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

/* ===== Room Code Display ===== */
.room-code-display {
  text-align: center;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
}

.room-code-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
}

/* ===== Activities List ===== */
.activities-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s;
}

.activity-item:hover {
  box-shadow: var(--shadow-sm);
}

/* ===== Word Cloud ===== */
.wordcloud-container {
  padding: 32px;
  background: var(--grey-50);
  border-radius: var(--radius-md);
  min-height: 300px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  align-content: center;
}

.wordcloud-word {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  font-weight: 500;
  transition: transform 0.2s;
  cursor: default;
}

.wordcloud-word:hover {
  transform: scale(1.05);
}

.wordcloud-word-wrapper {
  display: inline-flex;
  position: relative;
}

.wordcloud-word-wrapper:hover .wordcloud-delete-btn {
  opacity: 1;
}

.wordcloud-delete-btn {
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.wordcloud-delete-btn:hover {
  opacity: 1 !important;
}

/* ===== Multiple Choice ===== */
.mc-question-item {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.mc-question-item h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.mc-options-list {
  list-style: none;
  margin: 12px 0;
}

.mc-options-list li {
  padding: 10px 14px;
  margin: 6px 0;
  background: var(--grey-50);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
}

.mc-options-list li.correct {
  background: var(--green-light);
  color: var(--green);
  font-weight: 500;
}

/* ===== Anagram ===== */
.anagram-item {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.anagram-item h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.anagram-scrambled {
  font-size: 22px;
  font-weight: 600;
  color: var(--purple);
  letter-spacing: 4px;
  margin: 12px 0;
  font-family: 'Courier New', monospace;
}

.anagram-hint {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== Exam Questions ===== */
.exam-question-item {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.exam-question-item h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-primary);
}

/* ===== Student Activity Styles ===== */
.student-option-btn {
  width: 100%;
  padding: 14px 18px;
  background: var(--white);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  margin-bottom: 10px;
}

.student-option-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.student-option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.student-option-btn.correct {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}

.student-option-btn.incorrect {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red);
}

/* ===== Fullscreen Modals ===== */
.fullscreen-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.fullscreen-content {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 95vw;
  max-height: 95vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fullscreen-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
}

.fullscreen-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: var(--grey-50);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  body {
    padding-top: 56px;
  }
  
  .flex-navbar {
    height: 56px;
    padding: 0 16px;
  }

  .flex-logo-text {
    font-size: 16px;
  }

  .flex-btn-outline,
  .flex-btn-primary {
    padding: 8px 16px;
    font-size: 13px;
  }

  .home-btn {
    width: 36px;
    height: 36px;
  }
  .home-btn svg {
    width: 20px;
    height: 20px;
  }

  .app-main {
    padding: 24px 16px;
  }

  .app-section {
    padding: 24px;
    border-radius: var(--radius-md);
  }
  
  .app-section-title {
    font-size: 18px;
  }
  
  .app-section-description {
    font-size: 13px;
  }

  .activity-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .activity-icon {
    height: 100px;
    margin: 8px 8px 0;
  }

  .activity-card-content {
    padding: 12px 14px 16px;
  }

  .activity-name {
    font-size: 14px;
  }

  .activity-description {
    font-size: 12px;
  }

  .mc-options-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 32px 24px;
    border-radius: var(--radius-2xl);
  }
  
  .modal-header h2 {
    font-size: 18px;
  }
  
  .app-input-group label {
    font-size: 12px;
  }
  
  .app-input, .app-textarea {
    padding: 10px 14px;
    font-size: 14px;
  }
  
  /* Room code display */
  .room-code-badge {
    font-size: 16px;
    padding: 8px 16px;
    letter-spacing: 3px;
  }
  
  /* Student activity styles */
  .student-option-btn {
    padding: 12px 14px;
    font-size: 14px;
  }
  
  /* Fullscreen modals */
  .fullscreen-content {
    border-radius: var(--radius-md);
  }
  
  .fullscreen-header {
    padding: 16px;
  }
  
  .fullscreen-body {
    padding: 20px;
  }
}

@media (max-width: 500px) {
  .flex-navbar {
    padding: 0 12px;
  }
  
  .flex-logo-text {
    font-size: 14px;
  }
  
  .activity-grid {
    grid-template-columns: 1fr;
  }
  
  .app-section {
    padding: 20px;
  }
  
  .modal-content {
    padding: 24px 20px;
  }
  
  .app-actions {
    flex-direction: column;
  }
  
  .app-actions button {
    width: 100%;
  }
  
  /* Word cloud */
  .wordcloud-container {
    padding: 20px;
    min-height: 200px;
  }
  
  /* MC question styles for student */
  .mc-question-item {
    padding: 16px;
  }
  
  .mc-question-item h4 {
    font-size: 15px;
  }
  
  /* Anagram styles */
  .anagram-scrambled {
    font-size: 18px;
    letter-spacing: 3px;
  }
}

/* ===== Focus States ===== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
