:root {
  --bg-primary: #424658;
  --bg-panel: #E0CDB2;
  --font-color: #E0CDB2;
  --accent-primary: #81a3c6;
  --accent-secondary: #2c6aa8;
  --white: #ffffff;
  --font-sans: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--font-color);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  min-height: 100vh;
}

#app {
  width: 100%;
  max-width: 980px;
  background: var(--bg-panel);
  border-radius: 9px;
  box-shadow: 0 7.2px 21.6px rgba(12, 20, 40, 0.12);
  padding: 12.6px;
}

.app-title {
  font-family: sans-serif;
  text-align: center;
  color: var(--bg-primary);
  font-size: 1.8em;
  font-weight: bold;
  margin: 0 0 12.6px 0;
}

.app-title a {
  margin-left: 0.5rem;
  font-family: sans-serif;
  font-size: 0.5em;
  font-style: italic;
  text-decoration: underline;
  color: var(--bg-primary);
  transition: color 0.3s ease;
}

.app-title a:hover {
  color: rgb(0, 51, 255);
}

.converter-container {
  background: var(--bg-primary);
  border-radius: 9px;
  padding: 18px;
}

/* Category Buttons */
.category-buttons {
  display: flex;
  gap: 9px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.category-btn {
  flex: 1 1 126px;
  padding: 10px 14.4px 16px 14.4px;
  border: none;
  border-radius: 7.2px;
  background: var(--accent-primary);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 80px;
}

.category-btn:hover {
  background: var(--accent-secondary);
  transform: translateY(-1.8px);
  box-shadow: 0 3.6px 7.2px rgba(0, 0, 0, 0.2);
}

.category-btn.active {
  background: var(--accent-secondary);
  box-shadow: 0 0 0 2.7px rgba(44, 106, 168, 0.3);
}

/* Button Icon Row */
.btn-icon-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 52px;
}

.btn-text {
  font-size: 0.85rem;
  text-align: center;
}

/* Icon Sizes - 60% bigger */
.icon {
  flex-shrink: 0;
}

.icon-sun {
  width: 51px;
  height: 51px;
}

.icon-jupiter {
  width: 42px;
  height: 42px;
}

.icon-earth {
  width: 35px;
  height: 35px;
}

.icon-moon {
  width: 26px;
  height: 26px;
}

.icon-arrow {
  width: 29px;
  height: 29px;
}

.icon-tower,
.icon-pyramid,
.icon-burj {
  width: 45px;
  height: 45px;
}

/* SVG Icon Color Control - Inactive State (default white, background transparent) */
.tower-primary,
.tower-dark,
.pyramid-primary,
.burj-primary {
  fill: white;
}

.tower-accent,
.earth-accent,
.earth-primary,
.burj-accent {
  fill: none; /* No fill when inactive - outline only */
  stroke: white;
  stroke-miterlimit: 10;
}

.tower-bg,
.earth-bg,
.pyramid-accent,
.burj-bg {
  fill: none; /* Transparent background when inactive */
  stroke: none;
}

/* SVG Icon Color Control - Active State (blue accent colors) */
.category-btn.active .tower-primary,
.category-btn.active .earth-primary,
.category-btn.active .pyramid-primary,
.category-btn.active .burj-primary {
  fill: #f3f3f5; /* Light color for primary elements when active */
}

.category-btn.active .tower-dark {
  fill: #212122; /* Dark color for shadow elements when active */
}

.category-btn.active .tower-accent,
.category-btn.active .earth-accent,
.category-btn.active .burj-accent {
  fill: none; /* No fill - outline only when active */
  stroke: #f3f3f5; /* Light stroke for outline when active */
  stroke-miterlimit: 10;
}

.category-btn.active .tower-bg,
.category-btn.active .earth-bg,
.category-btn.active .pyramid-accent,
.category-btn.active .burj-bg {
  fill: #2c6aa8; /* Blue accent color when active */
}

/* Conversion Fields */
.conversion-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14.4px;
  margin-bottom: 18px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 7.2px;
}

.field-group label {
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--font-color);
}

.field-group input {
  padding: 10.8px;
  border: 1px solid #c8d6e5;
  border-radius: 5.4px;
  font-size: 0.99rem;
  background: var(--white);
  color: var(--bg-primary);
  font-weight: 500;
}

.field-group input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2.7px rgba(44, 106, 168, 0.1);
}

.field-group input[readonly] {
  background: #f5f5f5;
  cursor: default;
}

/* Unit Selectors */
.unit-selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14.4px;
}

.selector-group {
  display: flex;
  flex-direction: column;
  gap: 7.2px;
}

.selector-group label {
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--font-color);
}

.selector-group select {
  padding: 7.2px;
  border: 1px solid #c8d6e5;
  border-radius: 5.4px;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--bg-primary);
  cursor: pointer;
  overflow-y: auto;
}

.selector-group select:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2.7px rgba(44, 106, 168, 0.1);
}

.selector-group select option {
  padding: 7.2px;
}

.selector-group select option:hover {
  background: var(--accent-primary);
}

/* Search Container (for cities mode) */
.search-container {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 10.8px;
  border: 1px solid #c8d6e5;
  border-radius: 5.4px;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--bg-primary);
  font-weight: 500;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2.7px rgba(44, 106, 168, 0.1);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid #c8d6e5;
  border-top: none;
  border-radius: 0 0 5.4px 5.4px;
  z-index: 1000;
  display: none;
}

.search-results.show {
  display: block;
}

.search-result-item {
  padding: 10.8px;
  cursor: pointer;
  color: var(--bg-primary);
  font-size: 0.9rem;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s ease;
}

.search-result-item:hover {
  background: var(--accent-primary);
  color: var(--white);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-status {
  padding: 10.8px;
  text-align: center;
  color: var(--font-color);
  font-size: 0.85rem;
  font-style: italic;
}

.search-status.loading {
  color: var(--accent-secondary);
}

.search-status.error {
  color: #e74c3c;
}

.search-status.no-results {
  color: #95a5a6;
}

/* Travel Time Container */
.travel-time-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14.4px;
  margin-bottom: 18px;
}

.travel-time-container.hidden {
  display: none;
}

/* Currency Status Message */
.currency-status {
  margin-top: 14.4px;
  padding: 10.8px;
  border-radius: 5.4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--font-color);
  font-size: 0.765rem;
  text-align: center;
}

.currency-status.hidden {
  display: none;
}

.currency-status.loading {
  background: rgba(129, 163, 198, 0.2);
}

.currency-status.error {
  background: rgba(255, 100, 100, 0.2);
  color: #ffcccc;
}

/* Responsive Design */
@media (max-width: 768px) {
  .category-buttons {
    gap: 7.2px;
  }

  .category-btn {
    flex: 1 1 108px;
    padding: 8px 10.8px 12px 10.8px;
    font-size: 0.81rem;
    min-height: 70px;
  }

  .btn-icon-row {
    height: 45px;
  }

  .icon-sun {
    width: 45px;
    height: 45px;
  }

  .icon-jupiter {
    width: 35px;
    height: 35px;
  }

  .icon-earth {
    width: 29px;
    height: 29px;
  }

  .icon-moon {
    width: 22px;
    height: 22px;
  }

  .icon-arrow {
    width: 26px;
    height: 26px;
  }

  .icon-tower,
  .icon-pyramid,
  .icon-burj {
    width: 38px;
    height: 38px;
  }

  .conversion-fields {
    gap: 10.8px;
  }

  .unit-selectors {
    gap: 10.8px;
  }
}

@media (max-width: 520px) {
  body {
    padding: 9px;
  }

  #app {
    padding: 9px;
  }

  .app-title {
    font-size: 1.35em;
  }

  .converter-container {
    padding: 13.5px;
  }

  .category-buttons {
    gap: 5.4px;
    flex-direction: column;
  }

  .category-btn {
    flex: 1 1 100%;
    min-width: auto;
    font-size: 0.765rem;
    padding: 8px 10px 12px 10px;
    min-height: 65px;
  }

  .btn-icon-row {
    height: 38px;
    gap: 4px;
  }

  .btn-text {
    font-size: 0.75rem;
  }

  .icon-sun {
    width: 38px;
    height: 38px;
  }

  .icon-jupiter {
    width: 32px;
    height: 32px;
  }

  .icon-earth {
    width: 26px;
    height: 26px;
  }

  .icon-moon {
    width: 19px;
    height: 19px;
  }

  .icon-arrow {
    width: 22px;
    height: 22px;
  }

  .icon-tower,
  .icon-pyramid,
  .icon-burj {
    width: 32px;
    height: 32px;
  }

  .conversion-fields {
    grid-template-columns: 1fr;
    gap: 10.8px;
  }

  .unit-selectors {
    grid-template-columns: 1fr;
    gap: 10.8px;
  }

  .field-group input {
    font-size: 0.9rem;
  }

  .selector-group select {
    font-size: 0.81rem;
  }
}