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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f4f4f4;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Header styling */

header {
  background-color: #c73030;
  color: white;
  text-align: center;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.header-content h1 {
  padding: 0.5rem;
  font-size: 1.5rem;
}

.level-selector {
  position: relative;
  display: flex;
  align-items: center;
}

.level-selector-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background-color: #a52222;
  color: white;
  border: 1px solid #8a1c1c;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.level-selector-btn:hover {
  background-color: #8a1c1c;
}

.dropdown-icon {
  font-size: 0.8rem;
}

.level-popup {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 5px;
  background-color: white;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  padding: 10px;
  z-index: 100;
  min-width: 150px;
  color: #333; /* Ensure text is dark */
}

.level-selector select {
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 1rem;
}

/* Home page styling */
.home-page {
  padding: 1rem;
}

/* Family and technique pages styling */
.technique-page {
  background-color: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.family-list,
.technique-list {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.technique-family-card,
.technique-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1rem;
  transition: transform 0.3s;
  text-decoration: none;
  color: #1a1a2e;
}

.technique-family-card:hover,
.technique-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.random-btn {
  background-color: #4a7bab;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 10px 15px;
  margin: 15px 0;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.random-btn .fa-forward {
  margin-left: 8px;
}

.random-btn:before {
  content: "\f074";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 8px;
}

.random-btn:hover {
  background-color: #3a6491;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.random-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.global-random-btn {
  background-color: #a52222;
  border: 1px solid #8a1c1c;
}

.global-random-btn:hover {
  background-color: #8a1c1c;
}

.navigation-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.action-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Favorite button */
.favorite-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  padding: 5px 10px;
}

.favorite-btn:hover {
  transform: scale(1.1);
  color: #f5bb2d;
}

.favorite-btn.favorite-active {
  color: #f5bb2d;
}

/* Favorites section on home page */
.favorites-section {
  margin: 30px 0;
}

.favorites-card {
  background-color: rgba(245, 187, 45, 0.1);
  border: 1px solid rgba(245, 187, 45, 0.3);
  border-radius: 8px;
  padding: 15px;
  margin-top: 10px;
}

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

.favorite-technique {
  background-color: rgba(245, 187, 45, 0.05);
  border-color: rgba(245, 187, 45, 0.3);
}

.favorite-technique h3 {
  margin-bottom: 5px;
}

.technique-family {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
}

.favorite-random-btn {
  background-color: #f5bb2d;
  border: 1px solid #e5ab1d;
}

.favorite-random-btn:hover {
  background-color: #e5ab1d;
}

.video-section {
  margin: 20px 0;
}

.family-video-container {
  margin: 20px 0;
}

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: 100%;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-container {
  margin-top: 15px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.video-container h4 {
  margin-top: 0;
  margin-bottom: 8px;
}

.video-container iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
}

footer {
  background-color: #c73030;
  color: white;
  text-align: center;
  padding: 1rem;
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: #333;
}

.checkbox-label input {
  margin-right: 5px;
}

@media screen and (min-width: 768px) {
  main {
    padding: 2rem;
  }
  .technique-page {
    padding: 2rem;
  }
}

.menu-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.menu-separator {
  height: 1px;
  background-color: #ddd;
  margin: 6px 0;
  list-style: none;
}

.menu-item {
  display: flex;
  align-items: center;
  text-align: left;
  padding: 8px 12px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s;
  color: #333; /* Explicit text color */
}

.menu-item:hover {
  background-color: #f1f1f1;
}

.checkmark {
  color: #4a7bab; /* Blue color for the checkmark */
  margin-right: 8px;
  width: 16px;
  display: inline-block;
  text-align: center;
}

.menu-text {
  flex: 1;
}

/* Style for the technique title and favorite button container */
.technique-title-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.technique-title-container h2 {
  margin: 0;
}

.technique-title-container .favorite-btn {
  padding: 8px;
  margin: 0;
  font-size: 1.3rem;
}

/* Style for the favorites link on home page */
.home-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  margin: 20px 0 30px;
}

.favorites-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.favorites-link:hover {
  background-color: #f5f5f5;
  border-color: #ccc;
}

.favorites-link i {
  color: #f5bb2d;
}

.favorites-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 10px;
  height: 10px;
  background-color: #f5bb2d;
  border-radius: 50%;
}

/* Styling for the favorites page */
.favorites-page {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.favorites-page .navigation-links {
  margin-bottom: 20px;
}

.no-favorites {
  text-align: center;
  padding: 40px 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin-top: 20px;
}

.family-info,
.description-info {
  margin-bottom: 12px;
}

.family-label,
.description-label {
  font-weight: bold;
  margin-right: 6px;
}

.family-name {
  text-transform: uppercase;
}

/* Header back button */
.header-back-btn,
.header-back-spacer {
  min-width: 46px;
  min-height: 46px;
  justify-self: start;
  display: none;
}

.header-back-btn {
  padding: 10px;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 20px;
  touch-action: manipulation;
}

.header-back-spacer {
  visibility: hidden;
}

/* Update notification toast */
.update-notification {
  position: fixed;
  bottom: -100px;
  left: 0;
  right: 0;
  background-color: #c73030;
  color: white;
  padding: 15px;
  text-align: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease-in-out;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 9999;
}

.update-notification p {
  margin: 0;
  font-weight: 500;
}

.update-notification button {
  background-color: white;
  color: #c73030;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.update-notification.visible {
  transform: translateY(-100px);
}

.update-notification.hidden {
  transform: translateY(100px);
}

/* Note icon styling */
.note-icon {
  margin-left: 0.5rem;
  transition: color 0.2s ease;
  color: #f5bb2d;
}

.note-textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
  margin-top: 0.5rem;
}

.technique-section h3 i.fas {
  margin-right: 0.5rem;
  transition: transform 0.3s ease;
}

/* Make the section header show a pointer cursor to indicate it's clickable */
.section-header {
  cursor: pointer;
}

/* Animation for the section content */
.section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
  opacity: 0;
}

/* Expanded state for section content - with larger max-height for the details section */
.section-content.expanded {
  max-height: 1000px; /* Increased to accommodate video content */
  opacity: 1;
  padding-top: 0.5rem;
  overflow: visible;
}

/* Chevron animation and styling */
.chevron-icon {
  margin-right: 0.5rem;
  transition: transform 0.3s ease;
  transform: rotate(0deg);
}

/* Expanded state (rotated) - pointing down */
.expanded .chevron-icon,
.chevron-icon.expanded {
  transform: rotate(90deg);
}

/* Details container styling */
.details-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Add spacing between technique sections */
.technique-section {
  margin-bottom: 1.5rem;
}

/* Responsive styles */
@media screen and (max-width: 767px) {
  .header-back-btn,
  .header-back-spacer {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Only hide the back link inside navigation-links, not the entire container */
  body:not(.is-home) .navigation-links a {
    display: none;
  }

  /* Keep the navigation-links container visible */
  body:not(.is-home) .navigation-links {
    display: flex;
    justify-content: flex-end; /* Push content to the right */
  }

  /* Adjust header layout for mobile */
  .header-content {
    grid-template-columns: auto 1fr auto;
    display: grid;
    padding: 0 5px 0 2px; /* Reduced left padding to 2px */
  }

  .header-content h1 {
    font-size: 1.2rem;
    text-align: center;
  }

  .level-selector-btn {
    padding: 4px 8px;
    font-size: 0.8rem;
  }

  /* Make technique detail page visually appear full-height on mobile */
  .technique-detail-page {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  /* Remove box-shadow and change background on mobile */
  main {
    background-color: white;
  }

  .technique-page {
    box-shadow: none;
    background-color: white;
  }
}
