:root {
  --bs-primary: #6c757d;
  /* gray instead of blue */
  --bs-primary-rgb: 108, 117, 125;
}

.theme-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  background-color: var(--bs-tertiary-bg);
}

.theme-icon {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--bs-secondary-color);
}

.theme-toggle-input {
  cursor: pointer;
  width: 3rem;
  height: 1.5rem;
}


.country-hover-card {
  position: absolute;
  z-index: 1000;
  min-width: 220px;
  max-width: 280px;
  padding: 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

/* Customization for Login/Register Link */

.login-link {
  font-size: 0.9rem;
  transition: opacity 0.2s ease;
}

.login-link:hover {
  opacity: 0.7;
}

[data-bs-theme="dark"] .login-link {
  color: #f8f9fa;
}

[data-bs-theme="light"] .login-link {
  color: #212529;
}

.flag-wrapper {
  width: 100%;
  height: 180px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.flag-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  border-radius: 0.375rem;
}

.travel-counter {
  font-size: 0.95rem;
  color: var(--bs-body-color);
  line-height: 1.4;
  max-width: 420px;
}

#searchField::placeholder {
  color: #6c757d;
  /* Bootstrap's muted gray */
  opacity: 1;
  /* ensures consistent rendering across browsers */
}

[data-bs-theme="light"] #searchField::placeholder {
  color: #6c757d;
  /* darker gray for light mode */
}

[data-bs-theme="dark"] #searchField::placeholder {
  color: #adb5bd;
  /* lighter gray for dark mode */
}

#searchField::placeholder {
  font-style: italic;
  color: #6c757d;
  opacity: 1;
}

.header-controls {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
}

.auth-links {
  margin-bottom: 2px;
}

.country-hover-card {
  min-width: 240px;
  max-width: 240px;
}

.country-hover-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

button {
  cursor: pointer;
}

.photo-upload-toggle {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  padding: 0.2rem 0.45rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.country-photo-preview {
  margin-top: 0.75rem;
  width: 100%;
  height: 90px;
  overflow: hidden;
  border-radius: 0.375rem;
}

.country-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.country-photo-preview {
  width: 100%;
  height: 90px;
  margin-top: 0.75rem;
  overflow: hidden;
  border-radius: 0.375rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.country-photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.country-photo-large {
  width: 100%;
  height: 180px;
  margin-top: 0.5rem;
  overflow: hidden;
  border-radius: 0.5rem;
}


.country-card {
  overflow: hidden;
}

.journal-toggle {
  position: absolute;
  top: 0.5rem;
  left: 2.75rem;
  z-index: 2;
  background: transparent;
  border: none;
  color: var(--bs-body-color);
}

.photo-upload-toggle {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  background: transparent;
  border: none;
  color: var(--bs-body-color);
}

.visited-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
}

.memory-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.form-control:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.country-card,
.border-country-btn,
.visited-toggle,
.photo-upload-toggle,
.journal-toggle,
.back-btn {
  transition: transform 0.2s ease, box-shadow 0.2s ease, outline-color 0.2s ease;
}

.country-card:hover,
.country-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.border-country-btn:hover,
.border-country-btn:focus-visible,
.visited-toggle:hover,
.visited-toggle:focus-visible,
.photo-upload-toggle:hover,
.photo-upload-toggle:focus-visible,
.journal-toggle:hover,
.journal-toggle:focus-visible,
.back-btn:hover,
.back-btn:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.country-card:focus {
  outline: none;
}

.header-layout {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
}

.logo img {
  display: block;
  width: min(200px, 45vw);
  height: auto;
}

.travel-counter {
  position: absolute;
  left: 50%;
  top: 4rem;
  transform: translateX(-50%);
  text-align: center;
}

@media (max-width: 767.98px) {
  header .container {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  .header-layout {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
  }

  .logo img {
    width: min(180px, 70vw);
    max-height: 120px;
    object-fit: contain;
  }

  .travel-counter {
    position: static;
    transform: none;
    max-width: 100%;
    font-size: 0.9rem;
  }

  .header-controls {
    align-items: center;
    width: 100%;
    gap: 0.75rem;
  }

  .header-controls > .d-flex {
    justify-content: center !important;
  }
}
