/**
 * UM-CyberSafe - Kids Modules Styles
 * Styles for the kids modules pages
 */

:root {
  --primary-color: #0056b3;
  --secondary-color: #003d82;
  --accent-color: #ff6b6b;
  --success-color: #4CAF50;
  --warning-color: #ffc107;
  --text-color: #333;
  --light-bg: #f8f9fa;
  --white: #ffffff;
  --header-height: 80px;
  --kid-primary: #4a86e8;
  --kid-secondary: #3d71c3;
  --kid-accent: #ff9966;
}

/* Header Styles */
.header {
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  height: 50px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-color);
  cursor: pointer;
  padding: 0.5rem;
  width: 44px;
  height: 44px;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.menu-toggle:hover {
  background: rgba(0, 86, 179, 0.1);
}

.menu-toggle i {
  display: block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
}

.nav-menu {
  display: flex;
  gap: 2rem;
}

.nav-menu a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.nav-menu a:hover {
  color: var(--kid-primary);
  background: rgba(74, 134, 232, 0.1);
}

/* Main Content */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 20px 2rem; /* Reduced top padding, kept side and bottom padding */
  margin-top: var(--header-height);
}

.page-title {
  text-align: center;
  margin-bottom: 1.5rem; /* Reduced bottom margin */
}

.page-title h1 {
  color: var(--kid-primary);
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.page-title p {
  color: var(--text-color);
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto;
}

/* Module Cards */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.module-card {
  background: var(--white);
  border-radius: 15px;
  padding: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  position: relative;
  border-top: 5px solid var(--kid-primary);
}

.module-card:hover {
  transform: translateY(-5px);
}

/* Highlight effect for when a module card is clicked from progress indicator */
@keyframes highlight-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 134, 232, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(74, 134, 232, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 134, 232, 0);
  }
}

.module-card.highlight-card {
  animation: highlight-pulse 1.5s ease-out;
  border-color: var(--kid-primary);
  transform: translateY(-5px);
}

.module-card h2 {
  color: var(--kid-primary);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.module-card p {
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

.module-card .objectives {
  margin-bottom: 0.75rem;
}

.module-card .objectives h3 {
  color: var(--kid-primary);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.module-card .objectives ul {
  list-style: none;
  padding-left: 1.5rem;
}

.module-card .objectives li {
  margin-bottom: 0.5rem;
  position: relative;
}

.module-card .objectives li:before {
  content: "✓";
  color: var(--success-color);
  position: absolute;
  left: -1.5rem;
}

.start-btn {
  display: inline-block;
  background: var(--kid-primary);
  color: var(--white);
  padding: 0.8rem 1.5rem;
  border-radius: 5px;
  text-decoration: none;
  transition: background-color 0.3s ease;
  font-weight: 500;
  width: 100%;
  text-align: center;
}

.start-btn:hover {
  background: var(--kid-secondary);
}

/* Progress Indicator */
.progress-container {
  margin: 2rem 0 3rem 0;
  text-align: center;
  background: var(--white);
  padding: 1.5rem;
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-left: 5px solid var(--kid-primary);
}

.progress-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.progress-step {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  background: var(--white);
  border: 2px solid var(--kid-primary);
  color: var(--kid-primary);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.progress-step:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.progress-step:active {
  transform: translateY(-1px);
}

.progress-step::after {
  content: "Click to view";
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 10px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

html[lang="ms"] .progress-step::after {
  content: "Klik untuk lihat";
}

.progress-step:hover::after {
  opacity: 1;
  visibility: visible;
}

.progress-step.completed {
  background: var(--kid-primary);
  color: var(--white);
}

.progress-bar {
  width: 100%;
  max-width: 600px;
  height: 10px;
  background: var(--light-bg);
  border-radius: 5px;
  margin: 1rem auto;
  overflow: hidden;
}

.progress {
  height: 100%;
  background: var(--kid-primary);
  width: 0%;
  transition: width 0.3s ease;
}

.module-card.completed {
  border-top: 5px solid var(--success-color);
  background: rgba(76, 175, 80, 0.05);
}

.module-card.completed::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--success-color);
  color: var(--white);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.module-card.completed h2 {
  color: var(--success-color);
}

.module-card.completed .start-btn {
  background: var(--success-color);
}

.module-card.completed .start-btn:hover {
  background: #45a049;
}

/* Add style for the progress text */
#progress-text {
  margin-top: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

/* Section Headers */
.section-header {
  text-align: center;
  margin: 2rem 0;
  padding: 1rem;
  background: var(--white);
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-bottom: 5px solid var(--kid-primary);
}

.section-header h2 {
  color: var(--kid-primary);
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--text-color);
  font-size: 1.1rem;
}

/* Kid-friendly elements */
.kid-icon {
  font-size: 2.5rem;
  color: var(--kid-primary);
  margin-bottom: 1rem;
  display: block;
  text-align: center;
}

/* Progress Level Colors */
.module-card.easy-completed {
  border-left: 4px solid #ffc107;
}

.module-card.medium-completed {
  border-left: 4px solid #ff9800;
}

.module-card.difficult-completed {
  border-left: 4px solid #4CAF50;
}

.module-card.easy-completed .start-btn {
  background: #ffc107;
}

.module-card.medium-completed .start-btn {
  background: #ff9800;
}

.module-card.difficult-completed .start-btn {
  background: #4CAF50;
}

.module-card.easy-completed .start-btn:hover {
  background: #ffa000;
}

.module-card.medium-completed .start-btn:hover {
  background: #f57c00;
}

.module-card.difficult-completed .start-btn:hover {
  background: #388e3c;
}

/* Progress Step Colors */
/* Yellow for easy level completed */
.progress-step.easy-completed {
  background-color: #ffc107;
  border: 2px solid #ffc107;
  color: #333;
}

/* Orange for medium level completed */
.progress-step.medium-completed {
  background-color: #fd7e14;
  border: 2px solid #fd7e14;
  color: white;
}

/* Green for all levels completed */
.progress-step.all-completed {
  background-color: #28a745;
  border: 2px solid #28a745;
  color: white;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .header-container {
    flex-direction: row;
    height: var(--header-height);
    padding: 0 15px;
  }

  .logo {
    height: 40px;
    margin-bottom: 0;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--white);
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    align-items: center;
    z-index: 1000;
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-menu a {
    width: 100%;
    text-align: center;
    padding: 0.8rem;
    margin: 0.2rem 0;
    font-size: 1rem;
  }

  .container {
    padding: 0.25rem 15px 2rem; /* Reduced top padding for mobile */
    margin-top: var(--header-height); /* Keep the margin-top to account for fixed header */
  }

  .page-title {
    margin-bottom: 1.5rem;
  }

  .page-title h1 {
    font-size: 1.8rem;
    line-height: 1.2;
    padding: 0 1rem;
  }

  .page-title p {
    font-size: 1rem;
    padding: 0 1rem;
  }

  .progress-container {
    padding: 1rem;
    margin: 1.5rem 0;
  }

  .progress-steps {
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 1rem;
  }

  .progress-step {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }

  .progress-bar {
    height: 8px;
    margin: 0.5rem auto;
  }

  .section-header {
    margin: 1.5rem 0;
    padding: 1rem;
  }

  .section-header h2 {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  .section-header p {
    font-size: 1rem;
  }

  .module-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
  }

  .module-card {
    padding: 1.5rem;
    margin: 0;
  }

  .module-card h2 {
    font-size: 1.3rem;
    line-height: 1.3;
  }

  .module-card p {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .module-card .objectives {
    margin-bottom: 1rem;
  }

  .module-card .objectives h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }

  .module-card .objectives ul {
    padding-left: 1.2rem;
  }

  .module-card .objectives li {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
  }

  /* Add safe area for notched devices */
  @supports (padding: max(0px)) {
    .container {
      padding-left: max(15px, env(safe-area-inset-left));
      padding-right: max(15px, env(safe-area-inset-right));
      padding-top: 0.25rem; /* Maintain the reduced top padding */
    }
  }
}

/* Additional breakpoint for very small devices */
@media (max-width: 360px) {
  .progress-step {
    width: 25px;
    height: 25px;
    font-size: 0.8rem;
  }

  .module-card {
    padding: 1.2rem;
  }

  .module-card h2 {
    font-size: 1.2rem;
  }

  .page-title {
    margin-bottom: 1rem; /* Further reduce margin for very small screens */
  }

  .container {
    padding-top: 0.2rem; /* Slightly reduce top padding for very small screens */
  }
}

/* Animations for kid-friendly UI */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.kid-icon {
  animation: bounce 2s ease infinite;
}

/* Fun background patterns */
.fun-pattern {
  background-image: url('../images/pattern.png');
  background-repeat: repeat;
  background-size: 200px;
  opacity: 0.05;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* Progress indicator for partially completed modules */
.module-card .progress-indicator {
  display: flex;
  margin-top: 5px;
  margin-bottom: 15px;
  gap: 8px;
  justify-content: flex-start;
  padding-left: 0;
}

.module-card .progress-indicator::before {
  content: "Levels:";
  font-size: 0.85rem;
  color: var(--text-color);
  opacity: 0.7;
  margin-right: 5px;
  align-self: center;
}

html[lang="ms"] .module-card .progress-indicator::before {
  content: "Tahap:";
}

.module-card .progress-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #e0e0e0;
  transition: all 0.3s ease;
  position: relative;
  border: 2px solid #d0d0d0;
}

/* Module Progress Dots */
.module-card .progress-dot.easy-completed {
  background-color: #ffc107;
  border-color: #e0a800;
  box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
}

.module-card .progress-dot.medium-completed {
  background-color: #ff9800;
  border-color: #e68900;
  box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

.module-card .progress-dot.difficult-completed {
  background-color: #4CAF50;
  border-color: #3d8b40;
  box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

/* Add tooltip to show level name on hover */
.module-card .progress-dot[data-level="easy"]::after {
  content: "Easy";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  white-space: nowrap;
  pointer-events: none;
}

.module-card .progress-dot[data-level="medium"]::after {
  content: "Medium";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  white-space: nowrap;
  pointer-events: none;
}

.module-card .progress-dot[data-level="difficult"]::after {
  content: "Difficult";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  white-space: nowrap;
  pointer-events: none;
}

/* Malay tooltips */
html[lang="ms"] .module-card .progress-dot[data-level="easy"]::after {
  content: "Mudah";
}

html[lang="ms"] .module-card .progress-dot[data-level="medium"]::after {
  content: "Sederhana";
}

html[lang="ms"] .module-card .progress-dot[data-level="difficult"]::after {
  content: "Sukar";
}

.module-card .progress-dot:hover::after {
  opacity: 1;
  visibility: visible;
  bottom: 120%;
}
