/* === Container und Grundstruktur === */
.searchbar {
  position: relative;
  top: -35px;
  margin: auto;
  width: 60%;
  padding: 15px 30px;
  background-color: var(--bg-light);
  color: #222;
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  z-index: 5;
  box-sizing: border-box;
  transition: all 0.5s ease;
}

body.dark-mode .searchbar {
  background-color: var(--bg-dark);
  transition: all 0.5s ease;
}

/* === Eingabe & Bedienelemente === */
input,
select,
button,
.search-section-top .toggle-group label {
  border-radius: 25px;
  padding: 10px 15px;
  border: 1px solid #ccc;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.5s ease;
}

/* === Textinputs === */
.location-input {
  background-color: var(--bg-light);
  color: var(--text-light);
  transition: all 0.5s ease;
}

body.dark-mode .location-input {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

.location-input::placeholder {
  color: var(--text-light);
  transition: all 0.5s ease;
}

body.dark-mode .location-input::placeholder {
  color: var(--text-dark);
}

.location-input:focus {
  border: 1px solid #6200ea; /* Lila Ton */
  box-shadow: 0 0 5px rgba(98, 0, 234, 0.8);
  outline: none;
}

/* === Benutzerdefiniertes Dropdown === */
.radius-select {
  position: relative;
  width: 150px;
  border-radius: 25px;
  padding: 10px 15px;
  border: 1px solid #ccc;
  font-size: 16px;
  background-color: var(--bg-light);
  color: var(--text-light);
  box-sizing: border-box;
  cursor: pointer;
  transition: all 0.5s ease;
  user-select: none;
}

.radius-select:focus {
  border: 1px solid #6200ea; /* Lila Ton */
  box-shadow: 0 0 5px rgba(98, 0, 234, 0.8);
  outline: none;
}

body.dark-mode .radius-select {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

/* Ausgewählter Wert */
.radius-select .selected-option {
  display: block;
}

/* Dropdown-Pfeil */
.radius-select::after {
  content: "▼";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  pointer-events: none;
  color: gray;
}

/* Optionen verstecken */
.radius-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  width: 100%;
  background-color: var(--bg-light);
  border: 1px solid #ccc;
  border-radius: 15px;
  overflow-y: auto;
  margin-top: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  max-height: 120px; 
  scrollbar-color: #d0d0d0 transparent; 
}

body.dark-mode .radius-options {
  background-color: var(--bg-dark);
  color: var(--text-dark);
  scrollbar-color: rgb(208, 208, 208) transparent;
}

/* einzelne Option */
.radius-options div {
  padding: 10px 15px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.radius-options div:hover {
  background-color: rgba(98, 0, 234, 0.1);
}

/* Sichtbar beim Öffnen */
.radius-select.open .radius-options {
  display: block;
}

/* 🔹 WebKit Scrollbar (Chrome, Safari, Edge) */
.radius-options::-webkit-scrollbar {
  width: 6px;
}
.radius-options::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 6px;
}
.radius-options::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Dark-Mode WebKit */
body.dark-mode .radius-options::-webkit-scrollbar-thumb {
  background: rgb(208, 208, 208);
}
body.dark-mode .radius-options::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* === Buttons: Filter & Suchen === */
button {
  cursor: pointer;
  border: none;
}

/* Filter-Button [ Rosa ] */
.filter-btn {
  background-color: var(--button-filter-light);
  color: var(--text-dark);
  font-weight: bold;
  box-shadow: 0 7px 20px rgba(240, 98, 145, 0.5);
}

body.dark-mode .filter-btn {
  background-color: var(--button-filter-dark);
  color: var(--text-dark);
  font-weight: bold;
  box-shadow: 0 7px 20px rgba(216, 92, 135, 0.5);
}

.filter-btn:hover {
  background-color: var(--button-filter-hover-light);
  box-shadow: 0 9px 26px rgba(236, 64, 122, 0.7);
}

body.dark-mode .filter-btn:hover {
  background-color: var(--button-filter-hover-dark);
  box-shadow: 0 9px 26px rgba(255, 114, 161, 0.7);
}

/* Such-Button [ Lila ] */
.search-btn {
  background-color: var(--button-search-light);
  color: var(--text-dark);
  font-weight: bold;
  box-shadow: 0 5px 15px rgba(137, 100, 239, 0.45);
}

body.dark-mode .search-btn {
  background-color: var(--button-search-dark);
  color: var(--text-dark);
  font-weight: bold;
  box-shadow: 0 5px 15px rgba(145, 112, 255, 0.45);
}

.search-btn:hover {
  background-color: var(--button-search-hover-light);
  box-shadow: 0 7px 20px rgba(122, 79, 224, 0.7);
}

body.dark-mode .search-btn:hover {
  background-color: var(--button-search-hover-dark);
  box-shadow: 0 7px 20px rgba(168, 140, 255, 0.7);
}

/* --- Toggle (Mieten/Kaufen) Styling --- */
.toggle-group {
  display: flex;
  gap: 10px;
  font-weight: bold;
}

.toggle-group input[type="radio"] {
  display: none;
  font-size: 21px;
}

.toggle-group label {
  background-color: var(--bg-light);
  color: #333;
  cursor: pointer;
  padding: 12px 20px;
  text-align: center;
  border: 1px solid #ccc;
}

body.dark-mode .toggle-group label {
  background-color: #1F133A;
  color: var(--text-dark);
}

.toggle-group input[type="radio"]:checked+label {
  background-color: #7986CB;
  color: #fff;
  border-color: #7986CB;
  transition: all 0.15s ease;
}

body.dark-mode .toggle-group input[type="radio"]:checked+label {
  background-color: #5C6BC0;
  color: #fff;
  border-color: #5C6BC0;
  transition: all 0.15s ease;
}

.toggle-group label:hover {
  background-color: rgb(240, 240, 240);
  box-shadow: 0 0 5px rgba(17, 43, 189, 0.899);
}

body.dark-mode .toggle-group label:hover {
  border-color: #6200ea;
  box-shadow: 0 0 5px rgba(98, 0, 234, 0.9);
}

body.dark-mode .toggle-group label:hover {
  background-color: #3a256e;
}

/* === Ab 1350px für große Bildschirme === */
@media (min-width: 1350px) {
  .searchbar {
    width: 40%;
    padding: 20px 40px;
  }

  .row-searchbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
  }

  .search-section-top {
    display: flex;
    gap: 20px;
  }

  .search-section-middle {
    display: flex;
    gap: 20px;
    width: 70%;
  }

  .location-input {
    flex: 3;
  }

  .radius-select {
    flex: 1;
  }

  .search-section-bottom {
    display: flex;
    justify-content: center;
    gap: 20px;
  }

  .filter-btn,
  .search-btn {
    flex-shrink: 0;
  }
}

/* === Ab 1350px für größere Tablets und Desktops === */
@media (min-width: 1350px) {
  .searchbar {
    width: 60%;
    padding: 15px 30px;
    margin: 0 auto;
  }

  .row-searchbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
  }

  .search-section-top {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
  }

  /* Mieten / Kaufen bleibt fix */
  .search-section-top .toggle-group {
    flex-shrink: 0;
  }

  /* Ort Input nimmt den größeren Teil des Containers ein */
  .location-input {
    flex-grow: 2;
    flex-shrink: 1;
    margin-right: 0px;
    min-width: 0;
    padding-right: 40px;
  }

  /* KM Input bleibt fix wie ein Button */
  .radius-select {
    flex-shrink: 0;
    width: 80px;
    min-width: 0;
    margin-left: 0;
  }

  /* Filter Button bleibt fixiert mit Margin-Left */
  .filter-btn {
    flex-shrink: 0;
    min-width: 80px;
    margin-left: 25px;
  }

  /* Suchen Button bleibt fixiert */
  .search-btn {
    flex-shrink: 0;
    min-width: 80px;
  }

  /* Container für Ort, KM, Filter, Suchen */
  .search-section-middle {
    display: flex;
    align-items: center;
    /* Vertikal ausrichten */
    gap: 10px;
    width: 100%;
    flex-grow: 1;
  }

  /* Die Container für die rechten Buttons (KM, Filter, Suchen) */
  .search-section-bottom {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-left: 20px;
    width: 0 auto;
  }
}

/* === Bis 797px: Flagge mittig über Input === */
@media (min-width: 798px) {
  .location-wrapper {
    flex-direction: column;       /* Input unter Flagge */
    align-items: center;          /* horizontal zentrieren */
    gap: 10px;                    /* Abstand Flagge <-> Input */
  }

  .country-selector-btn {
    margin: 0 auto 0px;          /* Flagge zentrieren und Abstand unten */
  }

  .location-input {
    width: 100%;                  /* Input volle Breite */
    flex: none;                   /* keine Flex-Werte mehr */
  }
}



/* === Ab 1024px für große Tablets und kleinere Desktops === */
@media (min-width: 1024px) and (max-width: 1339px) {
  .searchbar {
    width: 55%;
    padding: 20px 30px;
  }

  .row-searchbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
  }

  /* Die gesamte Suchsektion wird flexbox */
  .search-section-top {
    display: flex;
    justify-content: space-between;
    gap: 20px;
  }

  /* Hier die Sektion mittig anpassen */
  .search-section-middle {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
  }

  .location-input {
    flex: 3;
  }

  .radius-select {
    flex: 1;
  }

  .search-section-bottom {
    display: flex;
    justify-content: center;
    gap: 20px;
  }

  .filter-btn,
  .search-btn {
    flex-shrink: 0;
  }
}

/* === 798px bis 1449px für mittlere Bildschirme === */
@media (min-width: 798px) and (max-width: 1449px) {
  .searchbar {
    width: 60%;
    margin: 0 auto;
    padding: 20px 30px;
  }

  .row-searchbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .search-section-top {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
  }

  .search-section-middle {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: space-between;
  }

  .location-input {
    flex: 3;
  }

  .radius-select {
    flex: 1;
  }

  .search-section-bottom {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    flex-grow: 1;
  }

  /* Filter und Suchen Buttons */
  .filter-btn,
  .search-btn {
    flex-grow: 1;
    width: auto;
    padding: 15px;
    margin: 0 10px;
    min-width: 0;
    box-sizing: border-box;
  }
}

/* === Bis 797px für sehr kleine Bildschirme === */
@media (max-width: 797px) {
  .searchbar {
    width: calc(100% - 50px);
    padding: 20px 20px 20px 20px;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .search-section-top,
  .search-section-middle,
  .search-section-bottom {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .search-section-top {
    margin-bottom: 20px;
  }

  .location-input,
  .radius-select {
    width: 100%;
    margin-bottom: 10px;
  }

  .filter-btn,
  .search-btn {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
  }

  .country-selector-btn {
    margin-bottom: 10px; 
  }
}

/* Container für Input + Flagge */
.location-wrapper {
  display: flex;
  align-items: center;
  gap: 10px; /* Abstand Flagge <-> Input */
  width: 100%;
}

/* Flaggen Button */
.country-selector-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border-light);
  border-radius: 50%;       
  width: 40px;
  height: 40px;
  box-shadow: 0 0 3px rgba(0,0,0,0.3);
  flex-shrink: 0;
  overflow: hidden;
  background: #fff;
}

body.dark-mode .country-selector-btn {
  border: 1px solid var(--bg-light); 
}

.selected-flag {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Input Feld */
.location-input {
  flex: 2 1; 
  padding: 10px 12px;
  font-size: 16px;
  border-radius: 25px;
  border: 1px solid #ccc;
  outline: none;
  box-sizing: border-box;
  background-color: var(--bg-light);
  color: var(--text-light);
}

body.dark-mode .location-input {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

.location-input::placeholder {
  color: var(--text-light);
}

body.dark-mode .location-input::placeholder {
  color: var(--text-dark);
}

/* ------------------------------------------
   COUNTRY OVERLAY – DESIGN 1.2 (responsive inkl. iPhone 4)
------------------------------------------ */
.country-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(50, 50, 50, 0.4);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.5s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  overflow-y: auto;
  pointer-events: auto;
}

/* Mobile: nach oben schieben, wenn wenig Platz */
@media (max-width: 360px) and (max-height: 640px) {
  .country-overlay {
    align-items: flex-start;
    padding-bottom: 80px;
  }
}

/* iPhone 4/4S und ähnliche (320x480px) */
@media (max-width: 330px) and (max-height: 500px) {
  .country-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: 5vh 0;
  }

  .country-modal {
    width: 92vw;
    max-height: 82vh;
    padding: 0 25px 25px;
    border-radius: 16px;
  }

  .country-header {
    height: 60px;
    padding: 15px 25px 15px 25px;
    margin-left: -25px;
    margin-right: -25px;
    border-radius: 16px 16px 0 0;
  }

  .country-title {
    font-size: 1rem;
    margin-top: 10px;
    margin-bottom: 10px;
    gap: 6px;
  }

  .country-title-icon {
    width: 17px;
    height: 17px;
  }

  .country-close-btn {
    top: 10px;
    right: 15px;
    font-size: 26px;
  }

  .country-item {
    padding: 8px 12px;
    font-size: 14px;
    gap: 10px;
  }

  .country-item img {
    width: 28px;
    height: 28px;
  }
}

/* ------------------------------------------
   MODAL
------------------------------------------ */
.country-modal {
  background-color: var(--bg-light);
  padding: 0 40px 40px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.5s ease-in-out;
  width: 450px;
  max-width: 90%;
  max-height: 60vh;
  white-space: pre-wrap;
  font-family: Arial, sans-serif;
  color: #222;
  position: relative;
  display: flex;
  flex-direction: column;
}

body.dark-mode .country-modal {
  background-color: var(--bg-dark, #333);
  color: var(--icon-dark, #eee);
  scrollbar-color: #555 transparent;
}

/* Iphone 4*/
@media (max-width: 360px) {
  .country-modal {
    max-height: 90vh;   /* höher, fast gesamter Bildschirm */
  }
}


/* ------------------------------------------
   SCROLLBAR
------------------------------------------ */
.country-scroll-container {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 20px;
  margin-right: -20px;
  scrollbar-width: thin;
  scrollbar-color: #d0d0d0 transparent;
}

.country-scroll-container::-webkit-scrollbar {
  width: 8px;
}

.country-scroll-container::-webkit-scrollbar-thumb {
  background-color: #d0d0d0;
  border-radius: 4px;
}

.country-scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: #a0a0a0;
}

/* ------------------------------------------
   HEADER (Sticky Top Bar)
------------------------------------------ */
.country-header {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-left: -40px;
  margin-right: -40px;
  padding: 20px 60px 20px 40px;
  background: var(--bg-light, #fefefe);
  border-radius: 25px 25px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 70px;
  white-space: nowrap;
}

body.dark-mode .country-header {
  background: var(--bg-dark, #333);
  color: var(--icon-dark, #eee);
}

/* ------------------------------------------
   TITEL im Header
------------------------------------------ */
.country-title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-weight: 600;
  color: var(--text-light);
  font-size: 1.5rem;
  flex-grow: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 15px;
}

body.dark-mode .country-title {
  color: var(--text-dark);
}

/* ------------------------------------------
   ICON im Titel
------------------------------------------ */
.country-title-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke-width: 2;
  vertical-align: middle;
}

body.dark-mode .country-title-icon {
  color: var(--text-dark);
}

/* Responsive Titelgrößen */
@media (max-width: 388px) {
  .country-title { font-size: 1.2rem; }
}

/* ------------------------------------------
   CLOSE BUTTON (X oben rechts)
------------------------------------------ */
.country-close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
  padding: 0;
  transition: color 0.2s ease;
  user-select: none;
  border-radius: 6px;
}

.country-close-btn:hover {
  color: var(--button-filter-hover-light);
  outline: none;
}

body.dark-mode .country-close-btn {
  color: var(--text-dark);
}

body.dark-mode .country-close-btn:hover {
  color: var(--button-filter-hover-dark);
}

/* ------------------------------------------
   FLAGGEN & BUTTONS
------------------------------------------ */
.country-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.country-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  border-radius: 15px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-light);
  color: var(--text-light);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

body.dark-mode .country-item {
  border: 1px solid var(--border-dark);
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

.country-item:hover {
  background-color: var(--language-hover-light);
}

body.dark-mode .country-item:hover {
  background-color: var(--language-hover-dark);
}

/* Runde Flaggen */
.country-item img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  object-fit: cover;
  box-shadow: 0 0 2px rgba(0,0,0,0.1);
}

body.dark-mode .country-item img {
  border: 1px solid var(--border-dark);
}

