/* Robocode Code Generator Styles - Kid-Friendly Edition */
:root {
  --primary-color: #00CED1;
  --secondary-color: #9B59B6;
  --accent-color: #E8F8F8;
  --dark-color: #2D1B4E;
  --text-color: #333;
  --code-bg: #1a1a2e;
  --code-text: #eee;
  --success-color: #27ae60;
  --error-color: #e74c3c;
  --gradient-start: #00CED1;
  --gradient-mid: #9B59B6;
  --gradient-end: #E91E8C;
  --star-color: #FFD700;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--accent-color) 0%, #fff 100%);
  min-height: 100vh;
  color: var(--text-color);
  font-size: 18px;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 50%, var(--gradient-end) 100%);
  color: white;
  padding: 15px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

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

.logo a {
  display: flex;
  align-items: center;
  gap: 15px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s;
}

.logo a:hover {
  transform: scale(1.05);
}

.logo img {
  height: 55px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.logo h1 {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.nav-links {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-links a {
  color: white;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 25px;
  transition: all 0.3s;
  font-size: 1rem;
  font-weight: 600;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

.nav-links a.active {
  background: rgba(255,255,255,0.25);
}

/* Dropdown Menu */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  color: white;
  background: none;
  border: none;
  padding: 10px 16px;
  border-radius: 25px;
  transition: all 0.3s;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-dropdown-btn:hover {
  background: rgba(255,255,255,0.3);
}

.nav-dropdown-btn.active {
  background: rgba(255,255,255,0.25);
}

.nav-dropdown-btn::after {
  content: "▼";
  font-size: 0.7rem;
  transition: transform 0.3s;
}

.nav-dropdown:hover .nav-dropdown-btn::after {
  transform: rotate(180deg);
}

.nav-dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 1000;
  overflow: hidden;
}

.nav-dropdown:hover .nav-dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(5px);
}

.nav-dropdown-content a {
  display: block;
  color: var(--text-color);
  padding: 12px 20px;
  border-radius: 0;
  font-size: 0.95rem;
}

.nav-dropdown-content a:hover {
  background: linear-gradient(135deg, var(--accent-color) 0%, #d4f5f5 100%);
  transform: none;
}

.nav-dropdown-content a.active {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 100%);
  color: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Main Content - EXTRA WIDE for code */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 30px;
}

.page-title {
  text-align: center;
  margin-bottom: 40px;
}

.page-title h2 {
  color: var(--secondary-color);
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 0 rgba(155, 89, 182, 0.1);
}

.page-title p {
  color: #666;
  font-size: 1.3rem;
}

/* Back Link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 700;
  margin-bottom: 25px;
  font-size: 1.1rem;
  transition: transform 0.2s;
}

.back-link:hover {
  transform: translateX(-5px);
}

/* Course Cards (Index Page) - Old style kept for compatibility */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.course-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  transition: transform 0.3s, box-shadow 0.3s;
  text-decoration: none;
  color: inherit;
  border: 3px solid transparent;
}

.course-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 15px 40px rgba(0,0,0,0.2);
  border-color: var(--primary-color);
}

.course-card-header {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 50%, var(--gradient-end) 100%);
  color: white;
  padding: 25px;
  text-align: center;
}

.course-card-header h3 {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.course-card-header span {
  opacity: 0.9;
  font-size: 1rem;
}

.course-card-body {
  padding: 25px;
}

.course-card-body ul {
  list-style: none;
}

.course-card-body li {
  padding: 10px 0;
  border-bottom: 2px solid #f0f0f0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.course-card-body li::before {
  content: "✨";
  font-size: 1rem;
}

.course-card-body li:last-child {
  border-bottom: none;
}

/* NEW: Project Circle Cards (Homepage) */
.project-circle-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px;
  margin-top: 50px;
  padding: 20px;
}

.project-circle-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: grayscale(100%);
  opacity: 0.7;
}

.project-circle-card:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.15);
}

.project-circle-card .project-emoji {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 50%, var(--gradient-end) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  box-shadow: 0 10px 40px rgba(155, 89, 182, 0.3);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  margin-bottom: 15px;
}

.project-circle-card:hover .project-emoji {
  box-shadow: 0 15px 50px rgba(155, 89, 182, 0.5);
  transform: rotate(10deg);
}

.project-circle-card h3 {
  color: var(--secondary-color);
  font-size: 1.3rem;
  margin-bottom: 5px;
  text-align: center;
  transition: color 0.3s;
}

.project-circle-card:hover h3 {
  color: var(--gradient-end);
}

.project-circle-card span {
  color: #888;
  font-size: 1rem;
  font-weight: 500;
}

.project-circle-card:hover span {
  color: var(--primary-color);
}

@media (max-width: 768px) {
  .project-circle-grid {
    gap: 25px;
  }

  .project-circle-card .project-emoji {
    width: 100px;
    height: 100px;
    font-size: 2.8rem;
  }

  .project-circle-card h3 {
    font-size: 1.1rem;
  }
}

/* Script List */
.script-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.script-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  padding: 22px 28px;
  border-radius: 15px;
  text-decoration: none;
  color: var(--text-color);
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  transition: all 0.3s;
  border: 3px solid transparent;
}

.script-link:hover {
  transform: translateX(10px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  background: linear-gradient(135deg, #fff 0%, var(--accent-color) 100%);
  border-color: var(--primary-color);
}

.script-link h4 {
  color: var(--secondary-color);
  font-size: 1.3rem;
}

.script-link span {
  color: #777;
  font-size: 1rem;
}

.script-link .arrow {
  color: var(--gradient-end);
  font-size: 1.5rem;
  transition: transform 0.3s;
}

.script-link:hover .arrow {
  transform: translateX(5px);
}

/* Quiz Section */
.quiz-section {
  background: white;
  border-radius: 20px;
  padding: 35px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.script-info {
  background: linear-gradient(135deg, var(--accent-color) 0%, #d4f5f5 100%);
  padding: 20px 25px;
  border-radius: 15px;
  margin-bottom: 30px;
  border-left: 6px solid var(--secondary-color);
}

.script-info h4 {
  color: var(--secondary-color);
  margin-bottom: 8px;
  font-size: 1.3rem;
}

.script-info p {
  color: #444;
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Score Display */
.score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 25px;
  padding: 15px;
  background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
  border-radius: 15px;
  border: 3px solid var(--star-color);
}

.score-display .stars {
  font-size: 1.8rem;
}

.score-display .score-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark-color);
}

/* Code Display with Blanks - AUTO-FIT WIDTH */
.code-quiz {
  background: var(--code-bg);
  border-radius: 15px;
  padding: 25px 20px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 2.2;
  overflow-x: auto;
  color: var(--code-text);
  border: 3px solid #333;
}

.code-quiz .line {
  display: block;
  white-space: nowrap;
  min-height: 40px;
  padding: 3px 0;
  position: relative;
}

/* Line explainer tooltip */
.code-quiz .line[data-explain] {
  padding-left: 30px;
}

/* ? button created by JS */
.explain-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  background: var(--secondary-color);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  font-family: 'Segoe UI', sans-serif;
  transition: all 0.3s;
  border: none;
  padding: 0;
}

.explain-btn:hover {
  background: var(--primary-color);
  transform: translateY(-50%) scale(1.1);
}

/* Tooltip created by JS - shows only on ? hover */
.explain-tooltip {
  position: fixed;
  background: var(--dark-color);
  color: white;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 0.9rem;
  max-width: 350px;
  z-index: 9999;
  font-family: 'Segoe UI', sans-serif;
  box-shadow: 0 5px 20px rgba(0,0,0,0.4);
  line-height: 1.4;
  pointer-events: none;
  white-space: normal;
  word-wrap: break-word;
}

/* Syntax highlighting - BRIGHTER colors for kids */
.code-quiz .keyword {
  color: #5dade2;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(93, 173, 226, 0.3);
}

.code-quiz .function {
  color: #f7dc6f;
  font-weight: 600;
}

.code-quiz .string {
  color: #f8b500;
  font-weight: 600;
}

.code-quiz .number {
  color: #58d68d;
  font-weight: 700;
}

.code-quiz .comment {
  color: #7dcea0;
  font-style: italic;
}

/* Dropdown blanks - COMPACT */
.code-quiz .blank-dropdown {
  background: linear-gradient(135deg, #4a4a6a 0%, #3a3a5a 100%);
  border: 2px solid #888;
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  margin: 2px 4px;
  cursor: pointer;
  min-width: 110px;
  display: inline-block;
  vertical-align: middle;
  transition: all 0.3s;
  font-weight: 600;
}

.code-quiz .blank-dropdown:hover {
  border-color: var(--primary-color);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(0, 206, 209, 0.4);
}

.code-quiz .blank-dropdown:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 20px rgba(0, 206, 209, 0.5);
}

/* Force dropdown option styling for all browsers */
.code-quiz .blank-dropdown option {
  background: #1a1a2e;
  color: white;
  padding: 10px;
  font-weight: 600;
}

.code-quiz .blank-dropdown option:nth-child(1) {
  background: #1a1a2e;
  color: #aaa;
}

.code-quiz .blank-dropdown option:nth-child(2) {
  background: #1a1a2e;
  color: #00ced1;
}

.code-quiz .blank-dropdown option:nth-child(3) {
  background: #1a1a2e;
  color: #ff6b9d;
}

.code-quiz .blank-dropdown option:nth-child(4) {
  background: #1a1a2e;
  color: #a855f7;
}

.code-quiz .blank-dropdown.correct {
  border-color: var(--success-color);
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.4) 0%, rgba(39, 174, 96, 0.2) 100%);
  animation: correctPulse 0.5s ease;
}

.code-quiz .blank-dropdown.incorrect {
  border-color: var(--error-color);
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.4) 0%, rgba(231, 76, 60, 0.2) 100%);
  animation: shake 0.5s ease;
}

@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Tooltips */
[data-tooltip] {
  position: relative;
  cursor: help;
}

/* Keyword tooltip - created by JS */
.keyword-tooltip {
  position: fixed;
  background: var(--dark-color);
  color: white;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 0.95rem;
  white-space: nowrap;
  z-index: 9999;
  font-family: 'Segoe UI', sans-serif;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* Check Button - BIGGER */
.check-btn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 50%, var(--gradient-end) 100%);
  color: white;
  border: none;
  padding: 20px 40px;
  border-radius: 15px;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 30px;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 5px 20px rgba(155, 89, 182, 0.4);
}

.check-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(155, 89, 182, 0.5);
}

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

/* Feedback Message - BIGGER */
.feedback {
  text-align: center;
  padding: 20px;
  border-radius: 15px;
  margin-top: 20px;
  font-weight: 700;
  font-size: 1.3rem;
  display: none;
}

.feedback.show {
  display: block;
  animation: fadeIn 0.5s ease;
}

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

.feedback.success {
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.2) 0%, rgba(39, 174, 96, 0.1) 100%);
  color: var(--success-color);
  border: 3px solid var(--success-color);
}

.feedback.error {
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.2) 0%, rgba(231, 76, 60, 0.1) 100%);
  color: var(--error-color);
  border: 3px solid var(--error-color);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: white;
  border-radius: 25px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: modalPop 0.4s ease;
}

@keyframes modalPop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  background: linear-gradient(135deg, var(--success-color) 0%, #2ecc71 100%);
  color: white;
  padding: 25px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h3::before {
  content: "🎉";
  font-size: 1.8rem;
}

.modal-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  transition: all 0.3s;
}

.modal-close:hover {
  background: rgba(255,255,255,0.3);
  transform: rotate(90deg);
}

.modal-body {
  padding: 30px;
  max-height: 55vh;
  overflow-y: auto;
}

.modal-body > p {
  font-size: 1.2rem;
  color: #555;
}

.modal-code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 25px;
  border-radius: 15px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 1rem;
  line-height: 1.8;
  white-space: pre;
  overflow-x: auto;
  border: 3px solid #333;
}

.modal-footer {
  padding: 20px 30px 30px;
}

.copy-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 50%, var(--gradient-end) 100%);
  color: white;
  border: none;
  padding: 20px 30px;
  border-radius: 15px;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.copy-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(155, 89, 182, 0.5);
}

.copy-btn.copied {
  background: var(--success-color);
}

/* Confetti Animation */
.confetti {
  position: fixed;
  width: 15px;
  height: 15px;
  background: var(--star-color);
  top: -20px;
  animation: confettiFall 3s ease-out forwards;
  z-index: 9999;
  pointer-events: none;
}

@keyframes confettiFall {
  to {
    top: 100vh;
    transform: rotate(720deg);
  }
}

/* Variables Section */
.variables-section {
  background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 3px solid #e8e8ff;
}

.variables-section h4 {
  color: var(--secondary-color);
  margin-bottom: 20px;
  font-size: 1.4rem;
}

.variables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.var-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.var-group label {
  font-weight: 700;
  font-size: 1.1rem;
  color: #444;
}

.var-group input, .var-group select {
  padding: 14px 18px;
  border: 3px solid #ddd;
  border-radius: 12px;
  font-size: 1.1rem;
  transition: all 0.3s;
}

.var-group input:focus, .var-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 15px rgba(0, 206, 209, 0.3);
}

.var-group .hint {
  font-size: 0.95rem;
  color: #888;
  font-style: italic;
}

/* Footer */
.footer {
  background: var(--dark-color);
  color: white;
  text-align: center;
  padding: 25px;
  margin-top: 50px;
}

.footer p {
  opacity: 0.9;
  font-size: 1.1rem;
}

/* Progress Indicator */
.progress-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
}

.progress-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ddd;
  transition: all 0.3s;
}

.progress-dot.current {
  background: var(--secondary-color);
  transform: scale(1.2);
  box-shadow: 0 0 10px var(--secondary-color);
}

.progress-dot.completed {
  background: var(--success-color);
}

/* Streak Counter */
.streak-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 25px;
  background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
  border-radius: 50px;
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 20px;
  box-shadow: 0 5px 20px rgba(255, 107, 107, 0.4);
}

.streak-counter .fire {
  font-size: 1.5rem;
  animation: flamePulse 0.5s ease infinite;
}

@keyframes flamePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Responsive */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
    padding: 20px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-links a {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .container {
    padding: 25px 15px;
  }

  .page-title h2 {
    font-size: 1.8rem;
  }

  .code-quiz {
    font-size: 0.95rem;
    padding: 20px 15px;
  }

  .code-quiz .blank-dropdown {
    min-width: 120px;
    font-size: 0.9rem;
    padding: 6px 10px;
  }

  .modal {
    margin: 10px;
    border-radius: 15px;
  }

  .check-btn, .copy-btn {
    font-size: 1.1rem;
    padding: 15px 25px;
  }
}
