:root {
  --bg: #0a0e1a;
  --bg-elevated: #111827;
  --bg-input: #1a2234;
  --accent: #4fd1c5;
  --accent-soft: rgba(79, 209, 197, 0.12);
  --accent-strong: rgba(79, 209, 197, 0.4);
  --border: #374151;
  --border-light: rgba(255, 255, 255, 0.35);
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --danger: #f97373;
  --green: #166534;
  --green-hover: #15803d;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  min-height: 100vh;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.app-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.app-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.app-subtitle {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.logo {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 2.5rem;
  width: auto;
  display: block;
  object-fit: contain;
}

h1, h2, .result-heading, .specialties-heading {
  font-weight: 700;
}

.app-footer {
  padding-top: 0.75rem;
  text-align: right;
}

.version-info {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.search-card,
.mode-card,
.result-card,
.specialties-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 1rem 1.1rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
}

.search-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 7rem;
}

.address-district-info {
  margin: 0;
  min-height: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.mode-card {
  display: flex;
  align-items: center;
}

.address-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.address-input-wrapper input[type='text'] {
  padding-right: 2.5rem;
}

input[type='text'] {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 2px solid var(--border-light);
  background: var(--bg-input);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.clear-search-btn {
  position: absolute;
  right: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}

.address-input-wrapper.has-text .clear-search-btn {
  display: flex;
}

.clear-search-btn:hover {
  background: var(--text-muted);
  color: var(--bg);
}

.clear-search-btn::after {
  content: '\00d7';
  font-weight: 700;
}

input[type='text']::placeholder {
  color: var(--text-muted);
}

input[type='text']:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

input[type='text']:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 0 1px #fff;
}

.suggestions {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #020617;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.95);
  max-height: min(70vh, 480px);
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
}

.suggestions.visible {
  display: block;
}

.suggestion-item {
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
}

.suggestion-item-main {
  color: var(--text);
}

.suggestion-item-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: var(--accent-soft);
}

.toggle-group {
  display: inline-flex;
  gap: 0.5rem;
}

.toggle-button {
  border: 2px solid var(--border);
  padding: 0.6rem 1.25rem;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-input);
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.toggle-button:hover {
  background: #243049;
  color: var(--text);
  border-color: var(--border-light);
}

.toggle-button.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.toggle-button.active:hover {
  background: var(--green-hover);
  border-color: var(--green-hover);
}

.result-heading,
.result-card h2 {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.result-content {
  min-height: 4rem;
}

.placeholder {
  color: var(--text-muted);
  font-size: 1rem;
}

.hospital-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.error-text {
  color: var(--danger);
  font-size: 1rem;
  font-weight: 500;
}

.deviation-message {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted, #555);
}
.deviation-message a {
  color: var(--link-color, #0066cc);
}

.data-unavailable-message {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--text-muted, #555);
}
.data-unavailable-link {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 1rem;
  color: var(--link-color, #0066cc);
}

/* Specialer (8 boxes) */
.specialties-heading {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.specialty-boxes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.specialty-box {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 2px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.specialty-box:hover {
  background: #243049;
  border-color: var(--border-light);
}

.specialty-box.selected {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.specialty-box.selected:hover {
  background: var(--green-hover);
  border-color: var(--green-hover);
}

.specialties-card.disabled .specialty-boxes {
  opacity: 0.5;
  pointer-events: none;
}

.specialties-card.disabled .specialty-box {
  cursor: default;
  background: var(--bg-input);
  color: var(--text-muted);
  border-color: var(--border);
}

.specialties-card.disabled .specialty-box:hover {
  background: var(--bg-input);
  border-color: var(--border);
}

/* Mobile-first: smaller screens */
@media (max-width: 600px) {
  .app {
    padding: 1rem 0.75rem;
    gap: 1rem;
  }

  .app-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
  }

  .app-title-block {
    min-width: 0;
  }

  .app-title {
    font-size: 1.35rem;
    line-height: 1.25;
  }

  .logo {
    flex-shrink: 0;
  }

  .logo-img {
    height: 2rem;
  }

  .search-card,
  .mode-card,
  .result-card,
  .specialties-card {
    padding: 0.85rem 0.9rem;
  }

  input[type='text'] {
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
  }

  .address-input-wrapper input[type='text'] {
    padding-right: 2.5rem;
  }

  .toggle-group {
    width: 100%;
    justify-content: flex-start;
  }

  .toggle-button {
    padding: 0.5rem 1rem;
    min-height: 2.5rem;
    font-size: 0.95rem;
  }

  .result-content {
    min-height: 3rem;
  }

  .hospital-name {
    font-size: 1.15rem;
  }

  .specialty-boxes {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .specialty-box {
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    min-height: 2.75rem;
  }
}

@media (min-width: 601px) and (max-width: 767px) {
  .specialty-boxes {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .app {
    padding: 1.75rem 1.5rem 2rem;
  }

  .app-title {
    font-size: 2rem;
  }
}

