@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600&display=swap');

/* === Base Styles === */
body {
  margin: 0;
  font-family: 'Fredoka', 'Comic Sans MS', cursive, sans-serif;
  background: radial-gradient(circle at top left, #fff3cc, #ffe082, #ffca28);
  background-size: 200% 200%;
  animation: backgroundShift 18s ease-in-out infinite;
  min-height: 100vh;
  overflow-x: hidden;
}

@keyframes backgroundShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.layout {
  display: flex;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* === Full Width Main Content === */
.main-wrapper.full-width {
  flex: 1;
  width: 100%;
  margin-left: 0;
  padding: 0 20px;
}

/* === Sidebar === */
.sidebar {
  width: 240px;
  background-color: #fff8e1;
  padding: 20px;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: 2;
}

.sidebar h2 {
  margin-top: 0;
  font-size: 20px;
  color: #333;
  text-align: center;
}

.sidebar-profiles,
.profile-list {
  list-style: none;
  padding: 0;
  margin-top: 20px;
}

/* === Sidebar Profiles List === */
.sidebar-profiles li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  margin-bottom: 10px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  font-size: 0.95rem;
}

.sidebar-buttons {
  display: flex;
  gap: 6px;
}

.sidebar-profiles button,
.delete-btn {
  margin-left: 8px;
  font-size: 14px;
  padding: 5px 8px;
  background-color: #e57373;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.sidebar-profiles button:hover {
  background-color: #c62828;
}

/* === Main Wrapper === */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px;
}

/* === Welcome Section === */
.welcome-container {
  text-align: center;
  max-width: 800px;
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}

.welcome-title {
  font-size: 2rem;
  color: #f75f5f;
  margin-bottom: 25px;
}

.profiles-heading {
  font-size: 20px;
  color: #444;
  margin: 30px 0 10px;
  font-weight: bold;
}

form {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

/* === Form Fields === */
input[type="text"],
select {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
  margin-bottom: 10px;
  width: 100%;
}

/* === Avatar Selection === */
.avatar-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 10px 0 20px;
}

.avatar-selection label {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 10px;
  transition: border 0.3s;
}

.avatar-selection input {
  display: none;
}

.avatar-selection img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.avatar-selection input:checked + img {
  border: 2px solid #4CAF50;
  transform: scale(1.1);
}

/* === Buttons === */
button,
.start-btn {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
}

button:hover,
.start-btn:hover {
  background-color: #1b5e20;
}

.start-btn.danger {
  background-color: #b22222;
}

/* === Profile Cards === */
.profile-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 15px;
}

.profile-card {
  background: #fefefe;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  transition: transform 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.profile-card:hover {
  transform: scale(1.03);
}

.profile-card img,
.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
}

/* === Modal === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  width: 400px;
  text-align: center;
  position: relative;
}

.modal-content h2 {
  margin-top: 0;
  font-size: 24px;
}

.modal-content input,
.modal-content select {
  width: 100%;
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 20px;
  font-size: 24px;
  color: #666;
  cursor: pointer;
}

/* === Top-Right Profile Manager === */
.profile-manager {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 240px;
  background: #fff;
  border: 2px solid #ccc;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  overflow: hidden;
  z-index: 1000;
  transition: max-height 0.3s ease;
}

.profile-manager.collapsed .profile-body {
  display: none;
}

.profile-header {
  background-color: #f0f0f0;
  padding: 10px;
  font-weight: bold;
  cursor: pointer;
  border-bottom: 1px solid #ccc;
}

.profile-body {
  padding: 10px;
}

.profile-body select {
  width: 100%;
  margin-bottom: 0.5rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    padding: 10px;
    border-top: 1px solid #ccc;
  }

  .main-wrapper {
    width: 100%;
  }

  .profile-list {
    grid-template-columns: 1fr;
  }

  .profile-card {
    width: 90%;
    margin: 0 auto;
  }

  .start-btn {
    width: 100%;
  }

  .avatar-selection {
    grid-template-columns: repeat(3, 1fr);
    justify-items: center;
  }

  .avatar-selection img {
    width: 55px;
    height: 55px;
  }
}

/* === Avatar Video Container === */
.avatar-animation-container {
  text-align: center;
  margin-bottom: 20px;
}

.avatar-animation-container video {
  max-width: 90%;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* === Mute Toggle === */
.mute-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  font-size: 20px;
  background: #fff;
  border: 2px solid #ccc;
  border-radius: 50%;
  padding: 8px 10px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: background 0.2s;
}
.mute-toggle:hover {
  background: #f0f0f0;
}

/* === Floating Blobs (3D Decoration) === */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  z-index: 0;
  animation: floatBlob 20s infinite ease-in-out;
}

.blob1 {
  top: 10%;
  left: -15%;
  width: 350px;
  height: 350px;
  background: #ffd54f;
}

.blob2 {
  bottom: 5%;
  right: -15%;
  width: 400px;
  height: 400px;
  background: #ffe082;
}

@keyframes floatBlob {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-20px) translateX(20px); }
}

/* === Reset Section === */
.reset-section {
  margin-top: 30px;
  text-align: center;
  padding: 20px;
  border-top: 2px dashed #ddd;
}

.reset-btn {
  background: #ff5722;
  color: white;
  border: none;
  border-radius: 25px;
  padding: 12px 24px;
  font-size: 14px;
  font-family: 'Fredoka', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3);
}

.reset-btn:hover {
  background: #f44336;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 87, 34, 0.4);
}

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

/* === Grade Selection === */
.grade-selection {
  margin: 20px 0;
}

.grade-selection.hidden {
  display: none;
}

.grade-selection select {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 15px;
  font-size: 16px;
  font-family: 'Fredoka', sans-serif;
  background: white;
  transition: border-color 0.3s ease;
}

.grade-selection select:focus {
  outline: none;
  border-color: #4CAF50;
}

/* === Level Selection Styles === */
.level-selection,
.grade-selection {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 12px;
  margin: 15px 0;
  border: 2px solid #e0e0e0;
  transition: all 0.3s ease;
}

.level-selection.hidden,
.grade-selection.hidden {
  display: none;
}

.level-selection select,
.grade-selection select {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: bold;
  border: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.level-selection select option,
.grade-selection select option {
  background: white;
  color: #333;
  padding: 8px;
}

.level-selection label,
.grade-selection label {
  font-size: 1.1rem;
  font-weight: bold;
  color: #444;
  margin-bottom: 10px;
  display: block;
}

/* Level progress indicator */
.level-indicator {
  display: inline-block;
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  margin-left: 8px;
}

/* Profile card level styling */
.profile-level-badge {
  background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  display: inline-block;
  margin-top: 5px;
}

/* Back button styling */
.back-btn {
  background: #9E9E9E !important;
  margin-top: 10px;
}

.back-btn:hover {
  background: #757575 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(158, 158, 158, 0.3);
}

/* Mobile responsiveness for profile options */
@media (max-width: 768px) {
  .profile-options {
    gap: 12px;
  }
  
  .profile-options .start-btn {
    padding: 12px 18px;
    font-size: 14px;
  }
}
