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



/* Modernes Basis-Styling */
:root {
  --primary-color: #5162d4; /* Tieferes, moderneres Blauviolett */
  --primary-color-light: #7986d981; /* Leicht transparentes Blauviolett für Hover-Effekte */  
  --secondary-color: #6BCEBB; /* Gedämpfteres, eleganteres Türkis */
  --thirdary-color: #fff; /* Sehr helles, fast weißes Grau */
  --background-color: #ffffff; /* Very Light Cool Grey */
  --text-color: #2A2D3E; /* Dunkleres, tieferes Blau-Grau */
  --card-bg: #ffffff; /* Weißer Kartenhintergrund */
  --card-secondary-bg: #F7F9FC; /* Sehr leicht abgetönter Hintergrund für Abwechslung */
  --shadow: 0 10px 30px rgba(37, 45, 90, 0.07); /* Weicherer, farbiger Schatten */
  --border-radius: 14px; /* Etwas weniger abgerundet für einen moderneren Look */
  --border-color: #919ce6; /* Tieferes, moderneres Blauviolett */
  --success-color: #34D399; /* Erfolgsfarbe */
  --warning-color: #FBBF24; /* Warnfarbe */
  --error-color: #F87171; /* Fehlerfarbe */
}

html {
  height: 100%;
  overflow: hidden; /* Verhindert Scrollen auf HTML-Ebene */
}
body {
  font-family: 'Nunito', sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  height: 100%; /* Body füllt die Höhe des HTML-Elements */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Verhindert Scrollen auf Body-Ebene */
  line-height: 1.6;
}


/* Basic Dark Mode Styles */
body.dark-mode {
  --primary-color: #7B8DFF; /* Lighter violet for dark mode */
  --secondary-color: #7EDDD4; /* Lighter turquoise for dark mode */
  --background-color: #121212; /* Dark background */
  --thirdary-color: #3e3c3c;
  --text-color: #E0E0E0;       /* Light text */
  --card-bg: #1E1E1E;         /* Darker card background */
  --card-secondary-bg: #2A2A2A; /* Slightly lighter dark card background */
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.2); /* Darker shadow */
}



/* Adjustments for setting items */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0; /* Increased padding */
    border-bottom: 1px solid var(--background-color); /* Subtle separator for items within a section */
}
.form-section .setting-item:last-child {
    border-bottom: none;
}

/* Modernized Form Element Styling within .setting-item */
.setting-item select,
.setting-item input[type="Deutsch"],
.setting-item input[type="English"] /* Add other input types if needed */ {
    -webkit-appearance: none; /* Remove default iOS styling */
    -moz-appearance: none; /* Remove default Firefox styling */
    appearance: none; /* Remove default styling */    
    display: block; /* Or inline-block depending on layout needs */
    width: 40%; /* Make it full width of its container, or set a specific min-width */
    min-width: 200px; /* As you had before, adjust as needed */
    padding: 7px 15px; /* Comfortable padding */
    font-family: 'Nunito', sans-serif; /* Consistent font */
    font-size: 1rem;
    color: var(--text-color);
    background-color: var(--background-color);
    border: 1px solid var(--card-secondary-bg); /* Use a subtle border color from your theme */
    border-radius: 8px; /* A slightly more modern border-radius */
    box-sizing: border-box;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer; /* Indicate it's interactive */
}

.form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem; /* Make space for the arrow */
}


.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

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

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

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

input:checked + .slider {
  background-color: var(--primary-color); /* Blue when on */
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
  -webkit-transform: translateX(22px);
  -ms-transform: translateX(22px);
  transform: translateX(22px);
}

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

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

.form-slider {
  width: 100%; /* Slider takes full width of its container part */
  margin-top: 5px;
  accent-color: var(--primary-color); /* Modern way to color sliders */
}

.action-buttons button {
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 0.5rem;
  box-shadow: 0 4px 12px rgba(80, 101, 229, 0.2);
}
.action-buttons button:last-child {
    margin-right: 0;
}
.action-buttons button:hover {
  background: #3F51E0;
  box-shadow: 0 6px 16px rgba(80, 101, 229, 0.3);
  transform: translateY(-2px);
}

.secondary-btn {
    background: var(--card-secondary-bg);
    color: var(--text-color);
    box-shadow: none;
}

.secondary-btn:hover {
    background: #e9e9e9;
    transform: translateY(-1px);
}

.setting-item label:first-child { /* The main label for the setting */
    flex-basis: 60%; /* Give more space to the label text */
    font-weight: 600; /* Make labels a bit bolder */
    color: var(--text-color);
    font-size: 1rem;
}

.setting-item .switch { /* Ensure switch stays to the right */
    flex-shrink: 0;
}

/* For items where label is above, like checkboxes */
.setting-item-column {
    padding: 12px 0;
    border-bottom: 1px solid var(--background-color);
}
.form-section .setting-item-column:last-child {
    border-bottom: none;
}

.setting-item-column > label { /* Label for checkbox/radio group */
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 10px; /* Space between label and group */
}

/*Checkboxes*/
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px; /* Row gap and column gap */
  margin-top: 8px;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  font-weight: normal;
  font-size: 0.95rem; /* Slightly smaller for checkbox text */
  color: var(--text-color);
}
.checkbox-group input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--primary-color); /* Modern way to color checkboxes */
  width: 18px; /* Custom size */
  height: 18px; /* Custom size */
}

/*Labels and textareas */
label {
  font-size: 1.1rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  display: block;
  font-weight: bold;
}
textarea {
  width: 100%;
  min-height: 120px;
  font-size: 1.1rem;
  padding: 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--card-secondary-bg);
  background: var(--card-bg);
  margin-bottom: 1rem;
  font-family: 'Nunito', sans-serif;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(80, 101, 229, 0.15);
}

/* Slider specific container for better alignment if needed */
.slider-container-form {
    flex-basis: 40%; /* Adjust as needed, to align with toggles */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Pushes slider to the right if label takes more space */
}

/* START TABS*/
.tab-navigation {
    display: flex;
    justify-content: space-between; /* This pushes the button group and icon to opposite ends */
    align-items: center; /* This vertically centers them */
    border-bottom: 1px solid var(--card-secondary-bg);
    padding: 0 10px; /* Optional: adds some horizontal spacing */
    margin-bottom: 15px;
    position: sticky;
    top: 0;
    background-color: var(--card-bg);
    z-index: 10;    
}

.tab-button {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.7;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent; /* For active state indicator */
    margin-bottom: -2px; /* Align with the border-bottom of .tab-navigation */
}

.tab-button:hover {
    opacity: 1;
    color: var(--primary-color);
}

.tab-button.active {
    opacity: 1;
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

.tab-content {
    display: none; /* Hide all tab content by default */
    padding-top: 20px; /* Space between tabs and content */
    /* The rest of the styling for content (like audiobook entries) remains the same */
    flex-grow: 1; /* Allow content to take available space */
    overflow-y: auto; /* Enable scrolling for this tab's content */
    padding: 20px; /* Add padding back to the content area */    
}
.tab-content.active {
    display: block; /* Show only the active tab content */
}

.tab-content-wrapper {
    flex-grow: 1;
    overflow-y: auto; /* Add scroll for content if it overflows */
    padding-right: 10px; /* Add some padding to avoid scrollbar overlapping content */
    margin-right: -10px; /* Counteract the padding to maintain alignment */
}
/* END TABS */

/* === FLASH MESSAGE STYLES === */
.flash-messages {
    padding: 0;
    margin: 0 0 0.5rem 0;
    list-style: none;
}
.flash {
    padding: 0.3rem;
    width: min(1090px, 95vw);
    border-radius: 8px;
    font-size: 0.75rem;
    text-align: center;
    font-weight: 600;
}
.flash.error {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red */
    border: 1px solid #f5c6cb;
}

.flash.warning {
    background-color: #a1c5f0a4; /* Light purple */
    color: #303030; /* Dark purple */
    border: 1px solid #a1c5f0a4;
}

/* Add this new rule for success messages */
.flash.success {
    background-color: #d4edda; /* Light green */
    color: #155724; /* Dark green */
    border: 1px solid #c3e6cb;
}

/* Example: Style a container in dark mode */
body.dark-mode .container { /* Adjust '.container' to your actual main content container class */
  background-color: #1e1e1e;
  border-color: #1e1e1e;
  background-color: var(--background-color);
  color: var(--text-color);
}






body.dark-mode .settings-section {
    border-color: #444;
    background-color: #2a2a2a;
}





#appContent, #audiobookView, #settingsView, #settingsContent, #customizeStoryView, #creditsView,#creditsViewLoggedIn, #customStoriesView {
  flex: 1; /* Nimmt den verbleibenden Platz ein */
  width: 100%;
  margin: 0 auto; /* Zentriert, falls eine max-width gesetzt ist */
  background: var(--background-color);
  overflow: hidden; /* Verhindert Scrollen dieser Container */
  display: flex; /* Ermöglicht Zentrierung des Inhalts oder spezifisches Layout */
  flex-direction: column; /* Stellt sicher, dass Inhalte untereinander angeordnet werden */
  align-items: center; /* Zentriert den inneren Container */
}

#appContent, #settingsContent {
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 600px;
}

#audiobookView, #settingsView {
    padding: 1rem 0;
}




.audio-player {
  margin-top: 2rem;
  text-align: center;
}
#responseOutput {
    background-color: var(--card-secondary-bg);
    border: 1px solid rgba(0, 0, 0, 0.03);
    padding: 15px;
    border-radius: var(--border-radius);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-top: 1rem;
    font-family: 'Nunito', sans-serif;
    color: var(--text-color);
}

.generic-view-h1 {
    text-align: center;
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-top: 5px;
    margin-bottom: 3px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.generic-view-h2 {
    text-align: center;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-top: 1px;
    margin-bottom: 3px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}






.scrollable-audiobook-container {
    height: calc(100vh - 130px); 
    overflow-y: auto;
    border: 1px solid var(--card-secondary-bg);
    /* padding: 20px; -- Padding will be on tab-content or inner elements */
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    width: 80%;
    max-width: 1100px;
    box-sizing: border-box;
    margin-top: 10px;
    box-shadow: var(--shadow);
    display: flex; /* Added to manage tab navigation and content flow */
    flex-direction: column; /* Stack tab nav and content vertically */
    /* Hide scrollbar for IE, Edge and Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.scrollable-audiobook-container::-webkit-scrollbar {
    display: none;
}


.scrollable-settings-container {
    max-height: calc(100vh - 150px); 
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.03);
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    width: 80%;
    max-width: 1100px;
    box-sizing: border-box;
    margin-top: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}






/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 20px;
    border-radius: var(--border-radius);
    width: 80%;
    max-width: 600px;
    box-shadow: var(--shadow);
    border: none;
    position: relative;
}

/* NEW: Adjust the main story modal to open higher on the page */
#story-modal .modal-content {
    margin-top: 5vh;
}
/* === NEW: Slideshow Styles === */
.modal-image-container {
    position: relative; /* Required for positioning the buttons */
    margin-bottom: 1rem;
    border-radius: 12px;
    overflow: hidden; /* Ensures image corners are rounded */
}

#modalImage {
    width: 100%;
    height: auto;
    display: block;
}

.prev-slide, .next-slide {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: background-color 0.3s ease;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.3);
    display: none; /* Hidden by default */
}

.prev-slide {
    left: 0;
    border-radius: 0 3px 3px 0;
}

.next-slide {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.prev-slide:hover, .next-slide:hover {
    background-color: rgba(0, 0, 0, 0.6);
}
/* === End of Slideshow Styles === */


.close-modal {
    color: #64748B;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--primary-color);
    text-decoration: none;
}

.modal-body {
    margin-top: 20px;
}

.modal-footer {
    margin-top: 20px;
    text-align: right;
    display: flex;
    justify-content: space-between; /* Aligns items to the left and right */
    align-items: center;    
}

/* NEW: A wrapper for buttons you want grouped on the right */
.modal-footer-right {
    display: flex;
    gap: 10px; /* Creates space between buttons in this group */
}

.modal-footer button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(80, 101, 229, 0.2);
}

.modal-footer button:hover {
    background-color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(80, 101, 229, 0.3);
    transform: translateY(-2px);
}

.modal-footer .btn-secondary {
    background: var(--card-secondary-bg);
    color: var(--text-color);
    box-shadow: none;
}

.modal-footer .btn-secondary:hover {
    background: var(--card-secondary-bg);
    border-color: var(--primary-color);
    transform: translateY(-1px); /* Add a subtle hover effect */
    box-shadow: none;
}


/* === NEW: Favorite Icon Styles === */
.modal-title-container {
    display: flex;
    /*justify-content: space-between;*/
    align-items: center;
    justify-content: flex-start; /* Aligns items to the start of the container */
    gap: 5px;
}
.modal-title-container h2 {
    margin: 0; /* Removes default margin from the h2 element */
}

#modal-title {
    color: var(--primary-color);
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    margin: 0; /* Remove default margin to align with icon */
}

.favorite-icon {
    font-size: 2.2rem;
    color: #d1d5db; /* Default empty star color */
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    margin-left: 10px; /* Adds space between title and star */
}

.favorite-icon::before {
    content: '☆'; /* Default empty star character */
}

.favorite-icon:hover {
    transform: scale(1.1);
}

.favorite-icon.favorited {
    color: #FBBF24; /* Gold color for a favorited star */
}

.favorite-icon.favorited::before {
    content: '★'; /* Filled star character */
}
/* === End of Favorite Icon Styles === */


/* === Bottom Navigation Bar (Mobile Only) === */
.bottom-nav {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px; /* Adjust height as needed */
    background-color: var(--card-bg);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    justify-content: space-around;
    align-items: flex-start; /* Align items to the top */
    padding-top: 8px; /* Space for text */
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af; /* A neutral gray color */
    text-decoration: none;
    font-size: 0.7rem;
    flex-grow: 1;
    text-align: center;
}

.bottom-nav-item svg {
    transition: transform 0.2s ease-in-out;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active svg {
    transform: scale(1.1);
}

.bottom-nav-item-create {
    position: relative;
    top: -25px; /* Elevate the button */
}

.bottom-nav-item-create .create-icon-wrapper {
    background-color: var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(80, 101, 229, 0.4);
    margin-bottom: 4px;
}

.create-icon-img {
    width: 35px;
    height: 24px;
    filter: brightness(0) invert(1);
}

.bottom-nav-item-create .create-text {
    position: absolute;
    bottom: -13px;
}

body.is-mobile .bottom-nav {
    display: flex;
}

body.is-mobile header {
    display: none;
}

body.is-mobile {
    /* Add padding to the bottom of the body to prevent content from being hidden by the nav bar */
    padding-bottom: 65px; /* Should match .bottom-nav height */
}

/* === End Bottom Navigation Bar === */


#modal-image {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

#modal-details {
    margin-top: 15px;
    color: #64748B;
    display: flex; /* Use Flexbox to arrange children horizontally */
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    gap: 20px; /* Add space between the detail items */
    align-items: baseline; /* Changed from 'center' to 'baseline' for better text alignment */

}

#modal-details p {
    margin: 0; /* Remove default paragraph margins for better alignment */
}


#modal-details strong {
    color: var(--primary-color);
}

/* NEW: Style for the voice selection container in the modal */
.modal-detail-item {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between label and select dropdown */
    margin-top:0px;
}

/* NEW: Override the global 'display: block' for the label inside this specific container */
.modal-detail-item > label {
    display: inline; /* or 'flex' or 'inline-block' */
    margin-bottom: 0; /* Remove bottom margin that was part of the global style */
    margin-top:0;
    font-size: inherit; /* Match the font size of the surrounding <p> elements */
    font-weight: normal; /* Let the <strong> tag inside handle bolding for consistency */
    color: var(--text-color); /* Match the color of the surrounding <p> elements */
}

/* NEW: Style for the voice select dropdown in the modal */
#modal-voice-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 2px 30px 2px 12px; /* Add padding for custom arrow */
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    color: var(--text-color);
    background-color: var(--card-secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    min-width: 120px; /* Give it some base width */
    /* Custom dropdown arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

#modal-voice-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(80, 101, 229, 0.15);
}

#modal-voice-select:disabled {
    background-color: #e9ecef;
    opacity: 0.7;
    cursor: not-allowed;
}



/* Audio-Player Container */
#audio-player-container {
    /*background: linear-gradient(145deg, #EDF2F7, #FFFFFF);*/
    background: transparent;
    /*border-radius: var(--border-radius);*/
    padding: 15px;
    margin-top: 20px;
    /*box-shadow: 0 5px 15px rgba(37, 45, 90, 0.08);*/
}

/* Audio-Player stylen */
audio {
    width: 100%;
    max-width: 600px;
    height: 40px;
    border-radius: 10px;
}

/* Hilfsklassen */
.text-center {
  text-align: center;
}

.mt-auto {
  margin-top: auto;
}


/* Badges für Kategorien oder Status */
.badge {
  display: inline-block;
  background-color: var(--card-secondary-bg);
  color: var(--text-color);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 5px;
}

.badge-primary {
  background-color: rgba(80, 101, 229, 0.1);
  color: var(--primary-color);
}

.badge-secondary {
  background-color: rgba(107, 206, 187, 0.1);
  color: var(--secondary-color);
}

/* Verbesserte Darstellung der Audio-Steuerelemente */
audio::-webkit-media-controls-panel {
    background-color: var(--card-secondary-bg);
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-volume-slider,
audio::-webkit-media-controls-mute-button,
audio::-webkit-media-controls-timeline {
    cursor: pointer;
}

@media (max-width: 768px) {

  :root {
    --border-radius: 10px;
  }

  #appContent, #settingsContent {
    padding: 1rem;
    margin: 1rem auto;
    width: 95%;
  }
  .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .action-buttons button {
    width: 100%;
    margin-right: 0;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  .form-navigation {
    /* This will place the two buttons at opposite ends of the container */
    justify-content: space-between;
    gap: 0; /* Remove the gap to rely on space-between for spacing */
  }
  .form-navigation .next-btn,
  .form-navigation .back-btn {
    /* Make buttons narrower, taking up slightly less than half the width */
    width: 48%; 
    margin: 0;
    /* Adjust padding if text is too long */
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }


  .scrollable-audiobook-container,
  .scrollable-settings-container,
  .scrollable-create-story-container,
  .auth-container .auth-box {
    width: 100%;
    padding: 5px;
    height: auto; /* Allow content to determine height */
    max-height: none;
    /* Remove margin-top for mobile to use full screen */
    margin-top: 0;
  }

  .scrollable-audiobook-container {
        margin-top: 1rem;
        padding:0px;
  }
  .tab-navigation {    
    padding: 0;
}
  .tab-audiobook-content {
    grid-template-columns: 1fr; /* Stack audiobook entries on mobile */
  }

  .tab-audiobook-content.active {
    display: block; /* Change from grid to block for a simple vertical stack */
  }

  .audiobook-entry {
    flex-direction: column;
  }
  
  .audiobook-thumbnail {
    float: none;
    width: 100%;
    margin-right: 0;
    margin-bottom: 15px;
  }

 .tab-navigation {
    padding: 0 5px;
    /* On mobile, the inner div will handle scrolling, so the parent can hide overflow */
  }

  /* This new rule targets the div holding the buttons inside the tab navigation */
  .tab-navigation > div:first-child {
      display: flex;
      flex-wrap: nowrap; /* Prevent buttons from wrapping */
      overflow-x: auto;  /* Enable horizontal scrolling */
      -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
      scrollbar-width: none; /* Hide scrollbar for Firefox */
  }

  /* Hide scrollbar for Chrome, Safari, and Opera */
  .tab-navigation > div:first-child::-webkit-scrollbar {
      display: none;
  }

  .tab-button {
    padding: 8px 12px; /* Adjusted padding slightly */
    font-size: 0.9rem;
    flex-shrink: 0; /* Prevent buttons from shrinking to fit */
  }

  .modal-content {
    width: 90%;
    margin: 10vh auto;
  }

  /* === NEW: Full-screen Story Modal on Mobile === */
  #story-modal .modal-content {
    height: 100vh; /* Full viewport height */
    width: 100vw;  /* Full viewport width */
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-sizing: border-box; /* Ensures padding is included in width/height */
    overflow: hidden;
    overflow-y: auto; /* Allow scrolling if content overflows */
  }

  /* NEW: Make the modal body grow to fill available space */
  #story-modal .modal-body {
    flex: 1; /* Takes up all available space between header and footer */
    overflow-y: auto; /* Allow scrolling within the body if content overflows */
    padding-bottom: 20px; /* Add some padding at the bottom */
  }


  #story-modal .close-modal {
    display: none;
  }
  
  .tiers-container {
    flex-direction: column;
    align-items: center;
  }

  .tier-card {
    width: 100%;
    max-width: 320px;
  }
  


/* Hide footer on mobile devices */
  footer {
      display: none !important;
  }  
}





