/* --- MODAL BASE STRUCTURE (from base.css) --- */
.modal {
  display: none;
  position: fixed;
  z-index: 40000; /* Increased above slideshow (30000) to ensure preview shows over slideshow */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
  background-color: rgba(20, 20, 20, 0.7);
  backdrop-filter: blur(10px);
  margin: 3% auto;
  padding: 2vh;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  width: 72.5%;
  max-width: 1200px;
  color: #ffffff !important;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  padding-bottom: 20px;
  position: relative; 
}

.modal-content * {
  color: #ffffff !important;
}

[data-theme^="light"] .modal-content,
[data-theme^="light"] .modal-content * {
  color: #fff !important;
}

/* Fix: Increase specificity to ensure titles and field headers are colored using --primary-color */
[data-theme] .modal-content h2,
[data-theme] .modal-content p strong,
[data-theme] .modal-content .media-details h2,
[data-theme] .modal-content .media-details p strong {
  color: var(--primary-color) !important;
}

/* Apply lighter primary color override for secondary title parts in H2 titles */
[data-theme] .modal-content h2 .title-part-secondary {
    color: var(--lighter-primary-color) !important;
}

.modal-content::-webkit-scrollbar {
  display: none;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

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

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin-bottom: 2vh;
  width: 100%;
}

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

.media-details {
  padding: 2vh;
  border-radius: 8px;
  margin-top: 2vh;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  
  display: flex;
  flex-direction: column;
  align-items: center;
}

.media-actions {
  display: flex;
  gap: 20px;
  margin-top: 2vh;
  justify-content: center;
  width: 100%; 
  margin-bottom: 2vh; 
}

.media-details .overview {
  color: var(--text-color);
  line-height: 1.6;
  margin: 1vh 0;
  width: 100%;
  max-width: 100%;
}

/* --- MODAL MEDIA ELEMENTS (from base.css / layout.css) --- */

/* Click-to-close overlay (from layout.css/styles.css) */
.click-to-close-overlay {
    position: absolute;
    top: 0; 
    left: 50%;
    transform: translateX(-50%);
    
    background: var(--secondary-color); 
    color: var(--text-color) !important; 
    padding: 5px 10px;
    border-radius: 25px; 
    font-size: 1.15rem; 
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    white-space: nowrap;
    
    border: 2px solid var(--primary-color); 

    opacity: 0;
    pointer-events: none;
    
    z-index: 10;
}

/* Override: Font color for click-to-close button on light themes must be black */
[data-theme^="light"] .modal-content .click-to-close-overlay {
    color: #000000 !important;
}

.click-to-close-overlay.animated {
    animation: fadeIn 0.5s ease 2s forwards, floatVertical 1.5s ease-in-out infinite 2.5s;
    pointer-events: auto;
}

.media-poster {
  float: right;
  width: 200px;
  margin: 35px 0 20px 20px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.3s ease, opacity 0.3s ease;
  box-shadow: none; 
  opacity: 1; 
  position: relative;
  border: 1px solid var(--primary-color);
}

.media-poster:hover {
  box-shadow: 0 0 15px var(--primary-color); 
  opacity: 0.85; 
}

.media-poster img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.trailer-controls-wrapper {
    position: absolute;
    bottom: -20px; 
    left: 0;
    width: 100%; 
    display: flex;
    flex-direction: column;
    align-items: center; 
    z-index: 15;
    pointer-events: auto;
}

.trailer-controls-wrapper #previewButton {
    margin-top: 0; 
}

.trailer-length-display {
    text-align: center;
    margin-top: 5px; 
    font-size: 0.8rem; 
    font-weight: 500;
    color: var(--text-color) !important;
}

.trailer-duration-text {
    color: var(--primary-color) !important; 
    font-weight: 600;
}

/* --- PERSON/LINK STYLES (from base.css) --- */
.modal-content .person-link,
.modal-content .cast-link {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 7px; 
  background: transparent;
  color: var(--text-color) !important;
  border: 1px solid var(--text-color);
  text-decoration: none !important;
  margin: 3px 6px 3px 0;
  line-height: 1.2;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.modal-content .person-link:hover,
.modal-content .cast-link:hover {
  background: var(--hover-color);
  border-color: var(--text-color);
}

/* Light Theme Modal Link Customization */
[data-theme^="light"] .modal-content .person-link,
[data-theme^="light"] .modal-content .cast-link,
[data-theme^="light"] .modal-content .person-link:visited,
[data-theme^="light"] .modal-content .cast-link:visited {
  color: #ffffff !important;
  border-color: #ffffff !important;
}

[data-theme^="light"] .modal-content .person-link:hover,
[data-theme^="light"] .modal-content .cast-link:hover,
[data-theme^="light"] .modal-content .person-link:active,
[data-theme^="light"] .modal-content .cast-link:active {
  color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

/* Dark Theme Modal Link Customization */
[data-theme]:not([data-theme^="light"]) .modal-content .person-link:hover,
[data-theme]:not([data-theme^="light"]) .modal-content .cast-link:hover {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important; 
}

/* Style for the floating person image preview */
.person-image-preview {
    position: absolute;
    display: none; 
    z-index: 20002; /* Increased Z-index to ensure it sits on top of everything inside the modal content */
    
    height: 150px; 
    width: auto; 
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    pointer-events: none; 
    
    transform: translate(10px, -50%); 
    
    opacity: 0; 
    transition: opacity 0.2s ease;
    border: 1px solid var(--primary-color);
}

.person-image-preview img {
    height: 100%;
    width: auto;
    object-fit: cover;
    transition: transform 0.3s ease; 
}

.person-image-preview:hover img {
    animation: floatSlow 3s ease-in-out infinite;
}

/* --- BIO POPUPS/OVERLAY (from base.css, components.css) --- */
.bio-popup { 
    position:absolute; 
    z-index:20003; 
    background: rgba(0,0,0,0.95); 
    color:#fff; 
    border:1px solid var(--primary-color); 
    border-radius:8px; 
    padding:10px; 
    max-width:280px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: auto; /* Required for hover transition */
}
.bio-popup .bio-name { font-weight:700; margin-bottom:6px; color: var(--primary-color); }
.bio-popup .bio-line { font-size:0.9rem; margin:2px 0; }
.bio-popup .bio-full-btn { margin-top:8px; padding:6px 10px; border-radius:16px; background: var(--primary-color); color: var(--text-color); border:none; cursor:pointer; }

/* Slideshow specific bio popup positioning */
.slideshow-bio-popup {
    /* Must be relative to the slideshow overlay container (fixed position 30000) */
    position: absolute; 
    z-index: 30005; 
    transform: translateX(0); /* Resetting transform for JS positioning */
    pointer-events: auto;
}

.bio-overlay { 
  position: fixed; 
  inset: 0; 
  z-index: 35000; 
  /* Make outer background transparent using theme primary color */
  background-color: rgba(var(--primary-color-rgb), 0.2);
  display: flex;               /* Center inner window */
  align-items: center;
  justify-content: center;
}

/* Window container: make it look like slideshow window */
.bio-content { 
  /* Previously: max-width:1100px; margin:40px auto; padding:20px; */
  max-width: 1200px;
  width: 90%;
  margin: 4vh auto;
  padding: 30px;
  border-radius: 12px;
  /* Semi-transparent inner background with blur to match slideshow */
  background-color: rgba(20, 20, 20, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--primary-color);
  color: #fff !important;
  max-height: 90vh; /* Set maximum height to enable internal scrolling */
  overflow-y: auto; /* Enable internal scrolling */
  position: relative; /* Needs relative positioning for inner scroll context */
}

/* Ensure inner scroll doesn't show scrollbars on webkit */
.bio-content::-webkit-scrollbar {
    display: none;
}

/* Keep close buttons, but they'll sit above the centered window */
.bio-close { 
  position: fixed; 
  right: 20px; 
  width: 100px; height: 100px; 
  border-radius: 50%; 
  background: var(--primary-color); 
  color: #000 !important; 
  font-size: 2rem; 
  border: none; /* Removed border */
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 30010;
}
.bio-close.top { top: 20px; }
.bio-close.bottom { bottom: 20px; }

/* Header and inner elements remain, but benefit from the window styling */
.bio-header { display:flex; gap:20px; align-items:flex-start; }
.bio-photo { width:260px; height:auto; border-radius:12px; border:1px solid var(--primary-color); }
.bio-title { flex-grow: 1; } /* Allow bio-title to take remaining space */
.bio-title h1 { 
    font-size:2.2rem; 
    margin:0 0 6px 0; 
    color: var(--primary-color); 
    text-transform: uppercase;
}
.bio-title .bio-name-field {
    text-transform: uppercase;
}
.bio-title .bio-info { 
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--lighter-primary-color) !important;
}

/* NEW: Clamp Known For titles to 2 lines with ellipsis */
.bio-card-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    /* NEW: add extra space below the Known For titles */
    padding-bottom: 10px;
}

/* NEW: Birth info field styling */
.bio-title .bio-info.bio-birth-info {
    color: #fff !important;
}

/* NEW: Separate birth date and birthplace lines */
.bio-title .bio-info.bio-birth-date,
.bio-title .bio-info.bio-birth-place {
    color: #fff !important;
}
/* NEW: tighten spacing between birthdate and birthplace lines */
.bio-title .bio-info.bio-birth-date {
    margin-bottom: 2px;
}
.bio-title .bio-info.bio-birth-place {
    margin-top: 0;
}

.bio-text { font-size:1.1rem; line-height:1.6; margin:15px 0; }

/* NEW: Frequent Co-Actors list styling to integrate with horizontal bio-title */
.bio-content .bio-section-title {
    margin-top: 15px; /* Add space below AKA/info fields */
    margin-bottom: 5px;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 700;
}

.bio-coactors {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping of co-actors */
    gap: 8px; /* Space between cards */
    margin-top: 5px;
}

.co-card {
    position: relative;
    width: var(--bio-coactor-w, 150px);
    height: var(--bio-coactor-h, 225px); /* Co-actor cards use the specified size */
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transition: transform 0.2s;
    cursor: pointer;
}

.co-card:hover {
    transform: scale(1.05);
}

.co-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.co-card .co-count {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--primary-color);
    color: #fff !important;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 10;
}

.co-card .co-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px;
    background: rgba(0,0,0,0.7);
    color: #fff !important;
    font-size: 0.8rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.bio-grid { 
  display:grid; 
  grid-template-columns: repeat(auto-fit, var(--bio-knownfor-w, 150px)); 
  gap: 18px; /* was 8px, +10px spacing between Known For items */
  /* Increase vertical spacing between rows by 7px and add extra padding at the bottom */
  row-gap: 25px;       /* original 18px + 7px = 25px vertical gap */
  column-gap: 18px;    /* keep horizontal spacing at 18px */
  padding-bottom: 10px; /* extra space after the last Known For row */
}

/* NEW Accordion / Bio Text Styling */
.bio-text .bio-truncated {
    margin: 0;
}

.bio-text .bio-full-content {
    /* Set transition properties here, although controlled inline for dynamic max-height */
    transition: max-height 0.7s ease-in-out; 
}

.bio-text .bio-full-content p {
    margin: 15px 0 0 0; /* Add top margin for paragraph separation within full content */
}
.bio-text .bio-full-content p:first-child {
    margin-top: 0; /* No top margin on the first paragraph inside full content */
}

.bio-showmore-link {
    display: block; /* Make it a block element below the truncated text */
    margin-top: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color) !important;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
    text-align: left;
}

.bio-showmore-link:hover {
    color: var(--lighter-primary-color) !important;
}

/* NEW: Media Details View within Bio Modal */
.bio-media-details-container {
    /* display: none; -> Controlled inline by JS */
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bio-media-details .media-backdrop-container {
    width: 50%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--primary-color);
}

.bio-media-details .media-backdrop-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bio-media-details .media-info-block {
    padding: 0 10px;
}

.bio-media-details .media-info-title {
    color: var(--primary-color) !important;
    font-size: 2rem;
    margin-bottom: 10px;
}

.bio-media-details .media-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 1rem;
    color: var(--lighter-primary-color) !important;
}

.bio-media-details .media-stats p {
    margin: 0;
}

.bio-media-details .media-overview {
    font-size: 1rem;
    line-height: 1.5;
    margin-top: 15px;
}

/* NEW: Inline clamp for bio description and link styling */
.bio-text .bio-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--bio-clamp, 4);
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.bio-text .bio-readmore,
.bio-text .bio-readless {
  color: var(--primary-color) !important;
  font-weight: 700;
  cursor: pointer;
  margin-left: 6px;
  display: inline;
}

/* Mobile adjustments for Bio content */
@media (max-width: 768px) {
  .bio-close { width: 50px; height: 50px; font-size: 1.25rem; } /* NEW: mobile size */
  .bio-close.top { top: 10px; right: 10px; }
  .bio-close.bottom { bottom: 10px; right: 10px; }

  .bio-header { 
    flex-direction: column; 
    align-items: center; 
    gap: 15px;
  }
  
  .bio-photo { 
    width: 150px;
    height: 225px;
  }
  
  .bio-title {
      text-align: center;
      width: 100%;
  }

  /* UPDATED: Actor name on mobile -> 20pt and uppercase */
  .bio-title h1 {
    font-size: 20pt;
    text-transform: uppercase;
  }
  .bio-title .bio-name-field {
    text-transform: uppercase;
  }
  
  /* UPDATED: Generic bio info (e.g., extra lines) -> 10pt and tighter line spacing */
  .bio-title .bio-info {
      font-size: 10pt;
      line-height: 1.3;
  }
  
  .bio-title .bio-aka {
      font-size: 10pt;
      line-height: 1.3;
  }

  /* UPDATED: Birthdate / birthplace lines -> 10pt */
  .bio-title .bio-info.bio-birth-info,
  .bio-title .bio-info.bio-birth-date,
  .bio-title .bio-info.bio-birth-place {
      font-size: 10pt;
      line-height: 1.3;
  }
  
  /* UPDATED: Frequent Collaborators / section titles -> 12pt */
  .bio-content .bio-section-title {
      font-size: 12pt;
  }

  /* UPDATED: Known For title on mobile -> 14pt */
  .bio-title h2 {
      font-size: 14pt;
  }

  /* NEW: Bio paragraph text smaller with tighter line spacing on mobile */
  .bio-text {
      font-size: 10pt;
      line-height: 1.35;
  }

  .bio-coactors {
      justify-content: center; /* Center co-actors horizontally on mobile */
  }
  
  .co-card {
      width: var(--bio-coactor-w-m, 75px);
      height: var(--bio-coactor-h-m, 113px);
  }

  /* Force mobile Known For cards to 75x113px by default */
  .bio-card {
      width: 75px !important;
      height: 113px !important;
  }
  .bio-card img {
      width: 75px !important;
      height: 113px !important;
      object-fit: cover !important;
  }

  .co-card .co-count,
  .co-card .co-name,
  .bio-card-title {
      font-size: calc(0.65rem - 2pt); /* reduce mobile by 2pt */
  }
  
  /* Media Details in Bio Mobile Adjustments */
  .bio-media-details .media-info-block {
      padding: 0;
  }
  .bio-media-details .media-info-title {
      font-size: 1.5rem;
  }
  .bio-media-details .media-stats {
      font-size: 0.85rem;
      gap: 10px;
  }
  .bio-media-details .media-overview {
      font-size: 0.8rem;
  }
}

/* NEW: Expanded full-width bio photo state on mobile */
@media (max-width: 768px) {
  .bio-photo.bio-photo-expanded {
      width: 100% !important;
      height: auto !important;
      max-height: 80vh;
      display: block;
      margin: 0 auto 10px;
      object-fit: contain;
  }
}

/* --- BUTTONS (Trailer & Play) (from layout.css) --- */
#playMovieButton {
  border-radius: 25px; 
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: #000000 !important; 
  border: none;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 2vh;
  transition: opacity 0.3s ease;
  
  opacity: 0 !important;
  pointer-events: none !important;
  display: none !important; 
}

#playMovieButton:hover {
  opacity: 0 !important;
  pointer-events: none !important;
}

#playEpisodeButton {
  opacity: 0 !important;
  pointer-events: none !important;
  display: none !important; 
}

#playEpisodeButton:hover {
  opacity: 0 !important;
  pointer-events: none !important;
}

#closeTrailerButton,
#homeButton,
#playPauseTrailerButton {
  border-radius: 25px; 
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: #000000 !important; 
  border: none;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 0; 
  transition: opacity 0.3s ease;
}

#closeTrailerButton:hover,
#homeButton:hover,
#playPauseTrailerButton:hover {
  opacity: 0.8;
}

#previewButton {
  border-radius: 25px;
  padding: 10px 20px;
  background-color: var(--secondary-color); 
  color: var(--text-color) !important;
  border: 1px solid var(--primary-color);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 2vh; 
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

#previewButton:hover {
  opacity: 0.8;
  background-color: var(--primary-color);
  color: #000000 !important;
}

/* --- RESPONSIVE OVERRIDES (from responsive.css) --- */
@media (max-width: 768px) {
    .modal-content {
        margin: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        padding: 10px 10px 30px 10px;
        overflow-y: auto;
        font-size: 70%; 
    }
    .video-container {
        margin-top: 2vh;
        width: 100%;
    }

    .modal-content .click-to-close-overlay {
        font-size: 0.65rem;
    }
    
    .modal-content #playMovieButton,
    .modal-content #previewButton,
    .modal-content #closeTrailerButton,
    .modal-content #homeButton, 
    .modal-content .nav-button,
    .modal-content .episode-info,
    .modal-content .media-runtime {
        font-size: 0.77rem; 
    }

    .modal-content .person-link,
    .modal-content .cast-link {
        font-size: 0.63rem; 
        padding: 3px 7px; 
        margin: 3px 4px 3px 0; 
        border-radius: 7px; 
    }
    
    /* Ensure movie poster in modal is fixed to 150x225 on mobile and aligned right so text wraps */
    .modal-content .media-poster {
        width: 150px;
        height: 225px;
        float: right; 
        margin: 8px 0 12px 12px; 
    }
    .modal-content .media-poster img {
        width: 150px;
        height: 225px;
        object-fit: cover;
        display: block;
    }
}

@media (max-width: 768px) {
  .bio-close { width: 50px; height: 50px; font-size: 1.25rem; } /* NEW: mobile size */
}

@media (max-width: 800px) {
    .modal-content .trailer-info-display { font-size: calc(0.95rem - 0.25rem); }
    .modal-content .trailer-info-display p,
    .modal-content .trailer-info-display p strong { font-size: inherit; }
}

@media (min-width: 769px) {
    /* Desktop border radius for person links */
    .modal-content .person-link,
    .modal-content .cast-link {
        border-radius: 5px; 
    }
    .person-image-preview {
        height: 300px;
    }
    .modal-content .media-poster {
        width: 400px;
    }
    
    .bio-title h1 {
        font-size: 28pt; /* Set desktop bio name to 28pt */
        text-transform: uppercase;
    }
    /* NEW: Desktop bio main image size from settings */
    .bio-photo {
        width: var(--bio-main-w-d, 300px);
        height: var(--bio-main-h-d, 450px);
    }
}

@media (min-width: 769px) {
  :root { 
    --bio-knownfor-w: var(--bio-knownfor-w-d, 150px);
    --bio-knownfor-h: var(--bio-knownfor-h-d, 225px);
    --bio-coactor-w: var(--bio-coactor-w-d, 150px);
    --bio-coactor-h: var(--bio-coactor-h-d, 225px);
  }
}

@media (max-width: 768px) {
  :root { 
    --bio-knownfor-w: var(--bio-knownfor-w-m, 75px);
    --bio-knownfor-h: var(--bio-knownfor-h-m, 113px);
    --bio-coactor-w: var(--bio-coactor-w-m, 75px);
    --bio-coactor-h: var(--bio-coactor-h-m, 113px);
  }
}

/* Apply strong text shadows to bio modal text when transparency mode is on */
:root[data-ss-transparency="true"] .bio-content,
:root[data-ss-transparency="true"] .bio-content * {
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

/* Enforce Known For image size at 75x113px on desktop */
@media (min-width: 769px) {
    .bio-grid {
        grid-template-columns: repeat(auto-fit, 100px) !important;
    }
    .bio-card {
        width: 100px !important;
        height: 150px !important;
    }
    .bio-card img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
}

.search-modal-overlay {
  position: fixed; inset: 0; z-index: 50001;
  background-color: rgba(0,0,0,0.6);
  display: none; align-items: center; justify-content: center;
}
.search-modal-content {
  background-color: rgba(20,20,20,0.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--primary-color);
  border-radius: 12px; padding: 20px; /* required 20px */
  padding-top: 40px; /* +50px top padding - 30px = 40px */
  width: 90%; max-width: 500px; box-sizing: border-box;
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
}
.search-modal-content #searchModalInput { padding: 10px; font-size: 1rem; }
.search-modal-content #searchModalButton {
  padding: 10px 16px; font-size: 1rem;
  background: var(--primary-color); color: #000 !important; border: none; border-radius: 8px; cursor: pointer;
}

/* Themed logo above search input */
.search-modal-logo {
  grid-column: 1 / -1;
  justify-self: center;
  /* Make it a flex container to align SEARCH text and logo visual */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px; /* Space between SEARCH and the logo */
  
  /* Reset previous styles that treated it as the logo visual */
  width: auto;
  height: auto;
  background-color: transparent;
  -webkit-mask-image: none;
  mask-image: none;
}

/* Style for the 'SEARCH' text */
.search-modal-logo::before {
  content: 'SEARCH';
  color: var(--primary-color);
  font-size: 2.2rem; /* Large font size */
  font-weight: 700;
  white-space: nowrap;
}

/* Style for the actual masked logo part */
.search-modal-logo::after {
  content: '';
  /* Dimensions for the logo visual */
  width: min(60vw, 200px);
  height: 57px; /* approximate aspect for the 200-wide asset */
  
  /* Masking styles */
  background-color: var(--primary-color);
  -webkit-mask-image: url('/6d-200.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url('/6d-200.png');
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  display: block;
}

/* Slightly smaller on very small screens */
@media (max-width: 480px) {
  .search-modal-logo::after {
    width: 150px;
    height: 43px;
  }
  .search-modal-logo::before {
    font-size: 1.5rem;
  }
}

/* NEW: Info modal overlay and content */
.info-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50002;
  background-color: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
}

.info-modal-content {
  position: relative;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  background-color: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 14px;
  border: 1px solid var(--primary-color);
  box-shadow: 0 8px 28px rgba(0,0,0,0.7);
  padding: 26px 26px 22px 26px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Hide scrollbar for info modal content */
.info-modal-content::-webkit-scrollbar {
  display: none;
}
.info-modal-content {
  scrollbar-width: none;
}

/* Close icon (upper-right) */
.info-close-button {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--primary-color);
  color: #000000;
  font-size: 1.6rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.info-close-button:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
  opacity: 0.9;
}

/* Logo at top, centered */
.info-logo-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  margin-top: 6px;
}

.info-logo-img {
  width: 200px;
  height: 57px;
  background-color: var(--primary-color);
  -webkit-mask-image: url('/6d-200.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url('/6d-200.png');
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

/* Title & feature list */
.info-title {
  margin: 6px 0 12px 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--lighter-primary-color) !important;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

.info-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.06),
    rgba(0,0,0,0.4)
  );
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border: 1px solid rgba(var(--primary-color-rgb), 0.4);
}

.info-bullet {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #000000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 0 10px rgba(var(--primary-color-rgb), 0.7);
}

.info-text {
  font-size: 0.95rem;
  line-height: 1.4;
  color: #ffffff !important;
}

/* Light theme adjustments */
[data-theme^="light"] .info-modal-content {
  background-color: rgba(255,255,255,0.97);
}
[data-theme^="light"] .info-title {
  color: var(--primary-color) !important;
}
[data-theme^="light"] .info-feature-list li {
  background: linear-gradient(
    135deg,
    rgba(0,0,0,0.03),
    rgba(0,0,0,0.08)
  );
}

/* Mobile full-screen behavior for info modal */
@media (max-width: 768px) {
  .info-modal-content {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 20px 18px 24px 18px;
  }
}