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

body {
  font-family: "Inter", system-ui, sans-serif;
  background: #0f0f11;
  color: #f0f0f5;
  min-height: 100vh;
  padding: 24px 16px;
}

.container {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- Header ---- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-size: 17px;
  font-weight: 700;
  color: #f0f0f5;
}

/* ---- Header controls ---- */

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-share {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  color: #58585f;
  transition: background 0.15s, color 0.15s;
}

.btn-share:hover { background: #27272c; color: #f0f0f5; }

/* ---- Toggle ---- */

.toggle {
  position: relative;
  display: flex;
  align-items: center;
  background: #27272c;
  border-radius: 99px;
  padding: 3px;
  cursor: pointer;
  user-select: none;
  outline-offset: 3px;
}

.toggle-label {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 600;
  color: #58585f;
  padding: 3px 10px;
  transition: color 0.2s;
  line-height: 1;
}

.toggle-pill {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: #3a3a42;
  border-radius: 99px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s ease;
}

.toggle[data-active="12h"] .toggle-pill               { transform: translateX(0); }
.toggle[data-active="12h"] .toggle-label[data-value="12h"] { color: #f0f0f5; }
.toggle[data-active="24h"] .toggle-pill               { transform: translateX(100%); }
.toggle[data-active="24h"] .toggle-label[data-value="24h"] { color: #f0f0f5; }

/* ---- Card ---- */

.card {
  background: #1c1c1f;
  border: 1px solid #818cf866;
  border-radius: 14px;
  padding: 14px 16px;
}

.card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-info {
  min-width: 0;
}

.card-name {
  font-size: 15px;
  font-weight: 600;
  color: #f0f0f5;
  line-height: 1.3;
}

.card-location {
  font-size: 12px;
  color: #58585f;
  margin-top: 2px;
}

/* ---- Time box ---- */

.card-time-box {
  flex-shrink: 0;
  background: #131315;
  border: 1px solid #2a2a30;
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.18);
  cursor: text;
  transition: border-color 0.15s;
}

.card-time-box:hover { border-color: #6366f1; }

.card-time {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #f0f0f5;
  line-height: 1;
  user-select: none;
}

body.is-pinned .card-time { color: #fbbf24; }

.card-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

/* ---- Card kebab menu ---- */

.card-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.card-menu {
  background: none;
  border: none;
  cursor: pointer;
  color: #58585f;
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.35;
  transition: opacity 0.15s;
}

.card:hover .card-menu { opacity: 1; }

.card-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #1c1c1f;
  border: 1px solid #2a2a30;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  min-width: 120px;
  z-index: 50;
  overflow: hidden;
}

.card-dropdown.open { display: block; }

/* ---- Dropdown items (shared) ---- */

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
  color: #f0f0f5;
  cursor: pointer;
}

.dropdown-item:hover { background: #27272c; }

.dropdown-item--danger { color: #ef4444; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* Hide live dot while pinned */
body.is-pinned .card-live-dot { display: none; }

/* ---- Shared view banner ---- */

.shared-banner-slot {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.shared-banner-slot.visible {
  grid-template-rows: 1fr;
}

.shared-banner {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(129,140,248,0.12);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: #818cf8;
  transition: padding 0.25s ease;
}

.shared-banner-slot.visible .shared-banner {
  padding: 10px 14px;
}

.shared-banner-text {
  font-weight: 600;
}

.shared-banner-actions {
  display: flex;
  gap: 6px;
}

/* Hide add/presets in shared view */
body.is-shared-view #btnAddTimezone { display: none; }
body.is-shared-view #presetsSection  { display: none; }

/* ---- Pinned banner ---- */

.pinned-banner-slot {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.pinned-banner-slot.visible {
  grid-template-rows: 1fr;
}

.pinned-banner {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(251,191,36,0.1);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: #fbbf24;
  transition: padding 0.25s ease;
}

.pinned-banner-slot.visible .pinned-banner {
  padding: 10px 14px;
}

.pinned-banner-btn {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: #fbbf24;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.pinned-banner-btn:hover { opacity: 0.8; }

/* ---- Pin input (replaces time display inline) ---- */

.pin-input {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #818cf8;
  line-height: 1;
  font-family: inherit;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  width: 7ch;
}

/* ---- Card list layout ---- */

#cardList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- Drop indicator ---- */

.drop-indicator {
  height: 2px;
  border-radius: 1px;
  background: #818cf8;
  flex-shrink: 0;
}

/* ---- Empty state ---- */

.empty-state {
  text-align: center;
  color: #58585f;
  font-size: 14px;
  padding: 32px 0 16px;
}

/* ---- Add button ---- */

.btn-add {
  width: 100%;
  padding: 12px;
  background: none;
  border: 1.5px dashed #2a2a30;
  border-radius: 12px;
  color: #58585f;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-add:hover {
  border-color: #818cf8;
  color: #818cf8;
}

/* ---- Modal ---- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #1c1c1f;
  border: 1px solid #2a2a30;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #f0f0f5;
}

.modal-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #f0f0f5;
  cursor: pointer;
  user-select: none;
}

.modal-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #818cf8;
}

.modal-checkbox-label input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.modal-checkbox-label:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-field {
  position: relative;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #2a2a30;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #f0f0f5;
  background: #27272c;
  outline: none;
  transition: border-color 0.15s;
}

.modal-input:focus { border-color: #818cf8; }

/* City typeahead dropdown */

.modal-city-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1c1c1f;
  border: 1px solid #2a2a30;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 10;
  overflow: hidden;
}

.modal-city-dropdown.open { display: block; }

.modal-city-dropdown .dropdown-item { font-size: 13px; }

.dropdown-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: #58585f;
}

.dropdown-offline {
  padding: 6px 12px;
  font-size: 11px;
  color: #58585f;
  border-top: 1px solid #2a2a30;
}

/* Modal action buttons */

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
}

.btn {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
}

.btn--primary   { background: #818cf8; color: #ffffff; }
.btn--primary:hover  { background: #6366f1; }
.btn--secondary { background: #27272c; color: #f0f0f5; }
.btn--secondary:hover { background: #32323a; }
.btn--ghost     { background: none; color: #58585f; }
.btn--ghost:hover { background: #27272c; color: #f0f0f5; }

/* ---- Presets section ---- */

.presets-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.presets-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.presets-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #58585f;
  white-space: nowrap;
  flex-shrink: 0;
}

.presets-header-line {
  flex: 1;
  height: 1px;
  background: #2a2a30;
}

.presets-save-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.presets-save-btn {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: #58585f;
  cursor: pointer;
  padding: 0;
}

.presets-save-btn:hover { color: #f0f0f5; }

.presets-name-input {
  padding: 5px 10px;
  border: 1px solid #2a2a30;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #f0f0f5;
  background: #27272c;
  outline: none;
  width: 160px;
  transition: border-color 0.15s;
}

.presets-name-input:focus { border-color: #818cf8; }

.btn--sm {
  padding: 5px 12px;
  font-size: 13px;
}

/* Chips */

.presets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-chip {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #27272c;
  border: 1px solid #2a2a30;
  border-radius: 99px;
  padding: 5px 6px 5px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.preset-chip:hover { background: #32323a; border-color: #3a3a42; }

.preset-chip-name {
  font-weight: 500;
  color: #f0f0f5;
}

.preset-chip-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  color: #58585f;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.preset-chip-delete:hover { background: #32323a; color: #ef4444; }

/* ---- Info toast (link copied, etc.) ---- */

.toast-info {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #f0f0f5;
  color: #0f0f11;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
  z-index: 201;
  white-space: nowrap;
}

.toast-info.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---- Toast ---- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #f0f0f5;
  color: #0f0f11;
  padding: 12px 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
  z-index: 200;
  white-space: nowrap;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-undo {
  background: none;
  border: none;
  color: #34d399;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
