* {
    -webkit-tap-highlight-color: transparent;
  }  

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    position: fixed; /* Position the header fixed at the top */
    top: 0; /* Align the header at the top of the page */
    left: 0; /* Align the header to the left edge */
    right: 0; /* Align the header to the right edge */
    background-color: white; /* Add a background color to ensure visibility */
    z-index: 999; /* Ensure the header stays above other content */
    height: 48px;
    box-shadow: 0px 1px 16px 3px rgba(0, 0, 0, 0.2);
}

header h1 {
    margin: 0;
    color: #4CAF50; /* Green color for the header text */
    font-size: 2em; /* Set the font size for consistency */
    cursor: pointer;
    transition: color 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    outline: none;
}

/* Desktop: Hover gets blue background */
@media (hover: hover) and (pointer: fine) {
    header h1:hover {
      color: #0056b3;
    }
  }
  
  /* Mobile: Only add blue while pressing */
  header h1:active {
    color: #0056b3;
  }  

.menu {
    display: flex;
    justify-content: flex-end; /* Align items to the right */
    align-items: center;
    gap: 10px; /* Consistent gap between menu items */
}

/* Define styles for the dynamically created language buttons */
.language-btn {
    background-color: transparent; /* Transparent background */
    color: black; /* Text color */
    padding: 8px;
    font-size: 16px;
    border: none;
    cursor: pointer;
    margin: 0;
    transition: background-color 0.3s ease;
    display: block;
    width: 100%;
    text-align: left;
    border-bottom: 1px solid #ccc; /* Add bottom border for separation */
}

/* Remove the bottom border from the last language button */
.language-btn:last-child {
    border-bottom: none;
}

/* Remove the top border and adjust padding for the first language button */
.language-btn:first-child {
    border-top: none;
    padding-top: 20;
    margin-top: 0;
}

.language-btn:hover {
    background-color: #72f377;
}

/* Define styles for the dynamically created voice buttons */
.voice-btn {
    background-color: transparent; /* Transparent background */
    color: black; /* Text color */
    padding: 8px;
    font-size: 16px;
    border: none;
    cursor: pointer;
    margin: 0;
    transition: background-color 0.3s ease;
    display: block;
    width: 100%;
    text-align: left;
    border-bottom: 1px solid #ccc; /* Add bottom border for separation */
}

/* Remove the bottom border from the last language button */
.voice-btn:last-child {
    border-bottom: none;
}

/* Remove the top border and adjust padding for the first language button */
.voice-btn:first-child {
    border-top: none;
    padding-top: 8px;
    margin-top: 0;
}

.voice-btn:hover {
    background-color: #72f377; /* Gray background on hover */
}

/* Add styles for the selected item */
.voice-btn.selected, .language-btn.selected {
    background-color: #4CAF50; /* Green background for the selected item */
    color: white; /* White text for the selected item */
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: #4CAF50;
    color: white;
    padding: 6px;
    font-size: 16px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    margin: 0; /* Remove margin */
    transition: background 0.3s ease;
}

.switch-lang-btn:active {
    background-color: #0056b3; /* Show while pressing on mobile */
  }
  
  @media (hover: hover) and (pointer: fine) {
    .switch-lang-btn:hover {
      background-color: #0056b3; /* Show on hover with mouse */
    }
  }
      
  @media (hover: hover) and (pointer: fine) {
    .dropbtn:hover {
      background: #0056b3;
    }
  }
  
.dropbtn.active {
    background: #0056b3 !important;
  }  

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    border: 1px solid #ccc;  /* Light gray border */
    border-radius: 4px;  /* Optional: rounded corners for aesthetic */
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    text-align: left; /* Align text to the left */
    right: 0; /* Position the menu at the right edge */
    padding: 12px; /* Add padding for better spacing */
}

/* Target only the languageDropdown by its ID */
#languageDropdown {
    left: -50px;         /* Adjust the left position */
    padding-right: 17px; /* Set padding-right to 17px */
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.show {
    display: block;
}

.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(14px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.back-btn, .help-btn {
    background-color: #4CAF50; /* Green color for back button */
    color: white;
    border: none;
    padding: 6px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    transition: background-color 0.3s ease;
    margin: 0; /* Remove margin */
}

@media (hover: hover) and (pointer: fine) {
    .category-item:hover,
    .help-btn:hover,
    .switch-lang-btn:hover {
      background: #0056b3;
    }
  }

  /* Mobile: Only add blue while pressing */
  .category-item:active {
    background-color: #0056b3;
  }  


/* New Styles for Settings Dropdown */
.setting-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px; /* Space between settings */
    border-bottom: 1px solid #ccc; /* Add bottom border for separation */
    padding-bottom: 10px; /* Add padding below each setting item */
}

/* Adjust spacing for the setting category titles (e.g., TTS Settings, TTS Voices) */
.setting-category {
    margin-bottom: 5px; /* Space between the title and the following items */
    margin-top: -10px;
    font-weight: bold;
    text-align: center;
}

.setting-item:last-child {
    border-bottom: none; /* Remove bottom border from the last item */
    padding-bottom: 0; /* Remove padding from the last item */
}

.switch-lang-btn {
    background-color: #4CAF50; /* Green color for the switch language button */
    color: white;
    border: none;
    padding: 6px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    transition: background-color 0.3s ease;
    margin: 0; /* Remove margin */
}

/* Adjusting space between switch and text for settings menu items */
.setting-item:not(.font-size-item) .switch {
    margin-right: 8px; /* Adjust the space between switch and text */
}

/* Specific styles for the Font Size item */
.font-size-item, .volume-level-item {
    display: flex;
    flex-direction: column; /* Arrange items in a column */
    align-items: flex-start; /* Align items to the start */
}

.font-size-item label, .volume-level-item label {
    margin-bottom: 0px; /* Space between label and slider/switch */
}

.font-size-slider-wrapper {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the content horizontally */
    margin-top: 10px; /* Add some space between the label and slider */
}

.small-text {
    font-size: 12px; /* Small Aa */
    margin-right: 10px; /* Space between the small Aa and slider */
}

.big-text {
    font-size: 18px; /* Bigger Aa */
    margin-left: 10px; /* Space between the slider and big Aa */
}

#fontSizeSlider {
    flex-grow: 1; /* Allow the slider to take up the remaining space */
    margin: 0 10px; /* Space around the slider */
    max-width: 88px;
}

/* Disable pointer events on images inside buttons */
button img {
    pointer-events: none;
}

/* Style specifically for the TTS Speed slider */
#TTSSpeedSlider {
    width: 80px; /* Adjust width for the speed slider */
}

.speed-slider-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Add space between the slider and the text */
}

/* Apply flex-direction: column specifically for .tts-speed-item */
.tts-speed-item {
    display: flex;
    flex-direction: column; /* Stack label and switch vertically */
    align-items: flex-start;
    border-bottom: none !important; /* Force removal of the inline border */
    padding-bottom: 0 !important; /* Remove extra padding as well */
}

/* Ensure margin between the TTS Speed label and the switch */
.tts-speed-item label {
    margin-bottom: 0px; /* Space between label and switch */
}

.unavailable-message {
    color: gray;
    font-style: italic;
}

.disabled-slider {
    background-color: #e0e0e0; /* Light gray background */
    pointer-events: none;      /* Disable interaction */
    opacity: 0.6;              /* Reduce opacity */
}

/* Limit the height of the voice options container and enable scrolling */
#voiceOptions {
    max-height: 200px;  /* Set the maximum height for the list */
    overflow-y: auto;   /* Enable vertical scrolling if content exceeds the height */
    padding-right: 10px; /* Optional: add padding for better readability */
}

/* Optional: Customize the scrollbar appearance */
#voiceOptions::-webkit-scrollbar {
    width: 8px;  /* Width of the scrollbar */
}

#voiceOptions::-webkit-scrollbar-thumb {
    background-color: #ccc;  /* Color of the scrollbar thumb */
    border-radius: 10px;     /* Rounded corners for the scrollbar */
}

.volume-slider-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#volumeLevelSlider {
    flex-grow: 1; /* Make the slider take up the remaining space */
    margin: 0 10px; /* Add some spacing between the slider and the icons */
    max-width: 116px;
}

.speaker-icon {
    width: 24px;
    height: 24px;
}

.speaker-icon.left {
    margin-right: -10px; /* Add some spacing to the right of the quiet speaker */
}

.speaker-icon.right {
    margin-left: -10px; /* Add some spacing to the left of the loud speaker */
}

.beta-label {
    font-weight: bold;
    padding: 6px 12px;
    margin-top: 8px;
    text-align: center;
}

.setting-item.difficulty-setting {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.difficulty-options label {
    display: block;
    margin: 4px 0;
    padding-bottom: 10px;
}

#difficultyLabel {
    text-align: center;
    width: 100%;
    font-weight: bold;
    margin-bottom: 8px;
    padding-top: 12px;
    padding-bottom: 6px;
}

.difficulty-options input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    border: 2px solid #4CAF50;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    position: relative;
    margin-right: 8px;
    margin-bottom: 6px;
    vertical-align: middle;
}

.difficulty-options input[type="radio"]:checked::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    background-color: #4CAF50;
    border-radius: 50%;
}
