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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 1.5rem;
}

h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.controls {
  max-width: 640px;
  margin: 0 auto 2rem;
}

.controls label {
  display: block;
  margin-bottom: .4rem;
  font-weight: 600;
  font-size: .95rem;
}

.controls-row {
  display: flex;
  gap: .5rem;
}

.search-wrapper {
  flex: 1;
  position: relative;
}

.search-wrapper input {
  width: 100%;
  padding: .6rem .75rem;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}

.search-wrapper input:focus {
  border-color: #3b82f6;
}

.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}

.dropdown.open {
  display: block;
}

.dropdown-count {
  padding: .45rem .75rem;
  font-size: .78rem;
  color: #94a3b8;
  border-bottom: 1px solid #334155;
}

.dropdown-list {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #475569 #1e293b;
}

.dropdown-list::-webkit-scrollbar { width: 6px; }
.dropdown-list::-webkit-scrollbar-track { background: #1e293b; }
.dropdown-list::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }

.dropdown-list .region-header {
  padding: .4rem .75rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #3b82f6;
  background: #0f172a;
  position: sticky;
  top: 0;
}

.dropdown-list .tz-item {
  padding: .45rem .75rem .45rem 1.25rem;
  font-size: .88rem;
  cursor: pointer;
  transition: background .1s;
}

.dropdown-list .tz-item:hover,
.dropdown-list .tz-item.active {
  background: #334155;
}

.dropdown-list .tz-item .match {
  color: #facc15;
  font-weight: 600;
}

.dropdown-list .no-results {
  padding: .8rem .75rem;
  font-size: .88rem;
  color: #94a3b8;
  text-align: center;
}

.controls-row button {
  padding: .6rem 1.3rem;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
}

.controls-row button:hover { background: #1d4ed8; }

.clock-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.clock-card {
  position: relative;
  width: 220px;
  background: #1e293b;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 1.2rem 1rem 1rem;
  text-align: center;
  cursor: grab;
  user-select: none;
  transition: transform .15s, opacity .15s, border-color .15s, box-shadow .15s;
}

.clock-card:active { cursor: grabbing; }

.clock-card.dragging {
  opacity: .45;
  transform: scale(.95);
}

.clock-card.drag-over {
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59,130,246,.45);
}

.clock-card .tz-name {
  font-size: .8rem;
  opacity: .7;
  margin-bottom: .35rem;
  word-break: break-word;
}

.clock-card .card-time {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.clock-card .card-date {
  font-size: .82rem;
  margin-top: .3rem;
  opacity: .85;
}

.clock-card .remove-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
  transition: color .15s, background .15s;
}

.clock-card .remove-btn:hover {
  color: #f87171;
  background: rgba(248,113,113,.12);
}

@media (max-width: 500px) {
  .clock-card { width: 100%; }
  .container { padding: 1rem; }
  .controls-row { flex-direction: column; }
  .controls-row button { width: 100%; }
}

/* ── Time format toggle ────────────────────────── */
.time-format-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  margin-bottom: 1.5rem;
}

.toggle-label {
  font-size: .9rem;
  font-weight: 600;
  color: #94a3b8;
  transition: color .2s;
}

.toggle-label.active {
  color: #e2e8f0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #334155;
  border-radius: 26px;
  transition: background .2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #e2e8f0;
  border-radius: 50%;
  transition: transform .2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #2563eb;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}
