/* ==========================================================================
   AEROCHRON DESIGN SYSTEM & STYLESHEET
   A sleek, high-fidelity dark luxury chronograph interface
   ========================================================================== */

/* 1. Global Reset & Variables */
:root {
  /* Color Palette */
  --bg-main: #070913;
  --bg-card: rgba(22, 28, 45, 0.45);
  --bg-card-hover: rgba(26, 33, 54, 0.6);
  --bg-input: rgba(12, 16, 29, 0.8);
  --bg-modal: rgba(10, 13, 26, 0.85);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.15);
  
  --text-primary: #ffffff;
  --text-secondary: #8c99bf;
  --text-muted: #53608c;
  
  /* Theme Accents (Default: Teal) */
  --accent-color: #00f2fe;
  --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --accent-glow: rgba(0, 242, 254, 0.2);
  
  /* Fonts */
  --font-display: 'Outfit', sans-serif;
  --font-brand: 'Syne', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --header-height: 80px;
  --footer-height: 120px;
  --max-width: 1440px;

  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme Colors definitions for dynamic assignment */
.theme-teal {
  --accent-color: #00f2fe;
  --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --accent-glow: rgba(0, 242, 254, 0.25);
}
.theme-violet {
  --accent-color: #e100ff;
  --accent-gradient: linear-gradient(135deg, #e100ff 0%, #7f00ff 100%);
  --accent-glow: rgba(225, 0, 255, 0.25);
}
.theme-amber {
  --accent-color: #ff9900;
  --accent-gradient: linear-gradient(135deg, #ff9900 0%, #ff5b00 100%);
  --accent-glow: rgba(255, 153, 0, 0.25);
}
.theme-emerald {
  --accent-color: #00ff87;
  --accent-gradient: linear-gradient(135deg, #00ff87 0%, #60efff 100%);
  --accent-glow: rgba(0, 255, 135, 0.25);
}
.theme-coral {
  --accent-color: #ff5858;
  --accent-gradient: linear-gradient(135deg, #ff5858 0%, #f09819 100%);
  --accent-glow: rgba(255, 88, 88, 0.25);
}
.theme-rose {
  --accent-color: #ff007f;
  --accent-gradient: linear-gradient(135deg, #ff007f 0%, #7f00ff 100%);
  --accent-glow: rgba(255, 0, 127, 0.25);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-display);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 2. Ambient Floating Glow Orbs */
.ambient-glow-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.15;
  animation: floatOrb 25s infinite alternate ease-in-out;
}

.orb-teal {
  width: 50vw;
  height: 50vw;
  background-color: #00f2fe;
  top: -10%;
  left: -10%;
  animation-duration: 30s;
}

.orb-violet {
  width: 60vw;
  height: 60vw;
  background-color: #7f00ff;
  bottom: -20%;
  right: -10%;
  animation-duration: 35s;
}

.orb-amber {
  width: 40vw;
  height: 40vw;
  background-color: #ff9900;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 25s;
  opacity: 0.08;
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(5vw, -5vh) scale(1.05);
  }
  100% {
    transform: translate(-3vw, 8vh) scale(0.95);
  }
}

/* 3. Base Layout Elements */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 2rem;
}

/* Header */
.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.logo-area {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-brand);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--text-primary);
}

.logo-title .text-accent-primary {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.25em;
  margin-top: 0.2rem;
}

/* Core Buttons */
.btn-primary-glow {
  background: var(--accent-gradient);
  border: none;
  color: #000000;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px var(--accent-glow);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.btn-primary-glow::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  transition: 0.75s;
  pointer-events: none;
}

.btn-primary-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary-glow:hover::after {
  left: 120%;
}

.btn-primary-glow:active {
  transform: translateY(1px);
}

.icon-svg {
  display: inline-block;
  vertical-align: middle;
}

/* Main Area */
.app-main {
  flex: 1;
  padding: 2.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-bottom: calc(var(--footer-height) + 2rem);
}

/* 4. Time Travel Active Banner */
.time-travel-banner {
  background: rgba(255, 153, 0, 0.1);
  border: 1px solid rgba(255, 153, 0, 0.25);
  box-shadow: 0 8px 32px rgba(255, 153, 0, 0.05);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: slideInDown 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  z-index: 10;
}

.time-travel-banner.hidden {
  display: none !important;
}

.banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 800px;
  gap: 1.5rem;
}

.banner-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #ff9900;
  font-size: 0.95rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ff9900;
  box-shadow: 0 0 10px #ff9900;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.4; }
}

.btn-reset {
  background: rgba(255, 153, 0, 0.15);
  border: 1px solid rgba(255, 153, 0, 0.3);
  color: #ffb84d;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.btn-reset:hover {
  background: rgba(255, 153, 0, 0.25);
  border-color: rgba(255, 153, 0, 0.5);
  color: #ffffff;
  transform: translateY(-1px);
}

/* 5. World Clocks Grid */
.clocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

/* Optimize exactly for 6 clocks layout on larger viewports */
@media (min-width: 1024px) {
  .clocks-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 6. World Clock Card Styling */
.clock-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
  animation: fadeInUp 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.clock-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 25px var(--accent-glow);
}

/* Local Time Special Ring Indicator */
.clock-card.is-local {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Card Header Controls */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 75%;
}

/* Chevron Ordering Controls */
.order-controls {
  display: flex;
  gap: 0.2rem;
  opacity: 0.4;
  transition: var(--transition-fast);
}

.clock-card:hover .order-controls {
  opacity: 0.9;
}

.btn-order {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.25rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-order:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Nickname / Title Editable Header */
.nickname-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
  max-width: 100%;
}

.nickname-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  border-bottom: 1px solid transparent;
  padding: 0.1rem 0.2rem;
  border-radius: 4px;
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  max-width: 150px;
  transition: var(--transition-fast);
}

.nickname-title:focus {
  background: var(--bg-input);
  border-bottom-color: var(--accent-color);
  max-width: 180px;
}

.btn-edit-indicator {
  opacity: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.nickname-container:hover .btn-edit-indicator {
  opacity: 1;
}

/* Delete Card Button */
.btn-delete {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-delete:hover {
  background: rgba(255, 79, 79, 0.15);
  border-color: rgba(255, 79, 79, 0.4);
  color: #ff4f4f;
  box-shadow: 0 0 10px rgba(255, 79, 79, 0.15);
}

/* Card Visual Body - Dual Layout */
.card-body {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Analog Clock Component */
.analog-clock-container {
  flex-shrink: 0;
}

.analog-clock {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.25);
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 0, 0, 0.2);
  transition: border-color 0.3s;
}

.clock-card:hover .analog-clock {
  border-color: var(--accent-color);
}

.clock-face-marker {
  position: absolute;
  width: 2px;
  height: 6px;
  background-color: var(--text-muted);
  left: calc(50% - 1px);
  transform-origin: 50% 48px;
}

.marker-12 { transform: rotate(0deg); height: 8px; background-color: var(--text-secondary); }
.marker-3  { transform: rotate(90deg); height: 8px; background-color: var(--text-secondary); }
.marker-6  { transform: rotate(180deg); height: 8px; background-color: var(--text-secondary); }
.marker-9  { transform: rotate(270deg); height: 8px; background-color: var(--text-secondary); }

.clock-hand {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: 50% 100%;
  border-radius: 4px;
}

.hand-hour {
  width: 4px;
  height: 26px;
  background-color: var(--text-primary);
  margin-left: -2px;
  z-index: 2;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.hand-minute {
  width: 2.5px;
  height: 38px;
  background-color: rgba(255, 255, 255, 0.8);
  margin-left: -1.25px;
  z-index: 3;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.hand-second {
  width: 1.25px;
  height: 42px;
  background-color: var(--accent-color);
  margin-left: -0.625px;
  z-index: 4;
  /* Rounded pointer tip style */
  border-radius: 0;
}

.clock-pin {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-primary);
  border: 1.5px solid var(--accent-color);
  position: absolute;
  top: calc(50% - 4px);
  left: calc(50% - 4px);
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Digital Time Readout */
.digital-display {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.digital-time {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
}

.digital-time-seconds {
  font-size: 1.1rem;
  color: var(--accent-color);
  margin-left: 0.15rem;
  font-weight: 400;
}

.digital-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 0.3rem;
  white-space: nowrap;
}

.timezone-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.badge-relative {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

/* Relative day / hour colors */
.relative-ahead {
  background: rgba(0, 242, 254, 0.08);
  color: var(--accent-color);
  border: 1px solid rgba(0, 242, 254, 0.2);
}

.relative-behind {
  background: rgba(255, 88, 88, 0.08);
  color: #ff5858;
  border: 1px solid rgba(255, 88, 88, 0.2);
}

.relative-same {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.relative-travel {
  background: rgba(255, 153, 0, 0.08);
  color: #ff9900;
  border: 1px solid rgba(255, 153, 0, 0.2);
}

/* Card Footer Controls - Customize Theme & Order details */
.card-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Color Theme Palette Dot Picker */
.theme-picker {
  display: flex;
  gap: 0.4rem;
}

.theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.2s;
  background-color: var(--dot-color);
}

.theme-dot:hover {
  transform: scale(1.3);
}

.theme-dot.is-active {
  border-color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 0 6px var(--dot-color);
}

/* Custom Colors for theme picker dots */
.theme-dot[data-theme="teal"] { --dot-color: #00f2fe; }
.theme-dot[data-theme="violet"] { --dot-color: #e100ff; }
.theme-dot[data-theme="amber"] { --dot-color: #ff9900; }
.theme-dot[data-theme="emerald"] { --dot-color: #00ff87; }
.theme-dot[data-theme="coral"] { --dot-color: #ff5858; }
.theme-dot[data-theme="rose"] { --dot-color: #ff007f; }

.location-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 7. Footer / Time Scrubber Panel */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  background: linear-gradient(to top, #070913 70%, rgba(7, 9, 19, 0));
  z-index: 50;
  display: flex;
  align-items: flex-end;
  padding: 0 2rem 1.5rem 2rem;
  pointer-events: none; /* Let clicks pass through outside container */
}

.scrubber-card {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  background: rgba(15, 20, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 1rem 1.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  pointer-events: auto; /* Enable clicks on card */
}

.scrubber-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.scrubber-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scrubber-time-display {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-color);
  background: rgba(0, 242, 254, 0.05);
  border: 1px solid rgba(0, 242, 254, 0.15);
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
}

.scrubber-slider-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Range Scrubber Styles */
.scrubber-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.scrubber-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
}

.scrubber-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow: 0 0 10px var(--accent-color);
  margin-top: -6px; /* Offset for track positioning */
  transition: transform 0.1s;
}

.scrubber-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.scrubber-range::-webkit-slider-thumb:active {
  transform: scale(1.3);
}

.scrubber-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  box-shadow: 0 0 10px var(--accent-color);
  cursor: pointer;
  transition: transform 0.1s;
}

.scrubber-range::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.scrubber-range::-moz-range-thumb:active {
  transform: scale(1.3);
}

.scrubber-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.scrubber-labels span {
  cursor: pointer;
  transition: var(--transition-fast);
}

.scrubber-labels span:hover {
  color: var(--text-primary);
}

.scrubber-labels .label-center {
  color: var(--text-secondary);
  font-weight: 600;
}

/* 8. Search Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: rgba(4, 6, 12, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  transition: var(--transition-smooth);
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transform: translateY(20px);
  transition: var(--transition-smooth);
}

.modal-overlay:not(.hidden) .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 1.5rem 1.75rem 1rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.modal-headline {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow: hidden;
}

/* Search bar styling */
.search-input-container {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 0 1rem;
  gap: 0.75rem;
  transition: var(--transition-smooth);
}

.search-input-container:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

#timezoneSearchInput {
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1rem;
  padding: 0.9rem 0;
  width: 100%;
  outline: none;
}

#timezoneSearchInput::placeholder {
  color: var(--text-muted);
}

.btn-clear-search {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.btn-clear-search:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-clear-search.hidden {
  display: none !important;
}

/* Quick add tag chips */
.quick-adds {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quick-add-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.quick-add-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Search results display list */
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  max-height: 300px;
  padding-right: 0.25rem;
}

/* Custom modal scrollbar styling */
.search-results-list::-webkit-scrollbar {
  width: 5px;
}

.search-results-list::-webkit-scrollbar-track {
  background: transparent;
}

.search-results-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

.search-results-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.search-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.search-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(4px);
}

.search-item-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.search-item-city {
  font-weight: 600;
  font-size: 0.95rem;
}

.search-item-country {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.search-item-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-item-offset {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-item-add-icon {
  color: var(--accent-color);
  opacity: 0.7;
  transition: var(--transition-fast);
}

.search-item:hover .search-item-add-icon {
  opacity: 1;
  transform: scale(1.1);
}

/* No results state */
.search-no-results {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 9. Keyframes Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 10. Responsive Adjustments */
@media (max-width: 768px) {
  :root {
    --header-height: 70px;
    --footer-height: 110px;
  }

  .app-container {
    padding: 0 1.25rem;
  }

  .logo-title {
    font-size: 1.5rem;
  }

  .app-main {
    padding: 1.5rem 0;
    gap: 1.5rem;
  }

  .clocks-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .clock-card {
    padding: 1.25rem;
  }

  .card-body {
    gap: 1.25rem;
  }

  .analog-clock {
    width: 80px;
    height: 80px;
  }

  .clock-face-marker {
    transform-origin: 50% 40px;
  }
  
  .hand-hour { height: 22px; }
  .hand-minute { height: 32px; }
  .hand-second { height: 36px; }

  .digital-time {
    font-size: 1.6rem;
  }

  .digital-time-seconds {
    font-size: 0.95rem;
  }

  .scrubber-card {
    padding: 0.75rem 1rem;
    border-radius: 16px;
  }

  .desktop-only {
    display: none !important;
  }

  .modal-card {
    border-radius: 20px;
    max-height: 85vh;
  }
  
  .modal-body {
    padding: 1rem 1.25rem;
  }
}

/* Accessibility / Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .ambient-glow,
  .clock-card,
  .btn-primary-glow,
  .modal-card,
  .time-travel-banner,
  .btn-primary-glow::after,
  .pulse-dot {
    animation: none !important;
    transition: none !important;
  }
  .clock-card:hover {
    transform: none !important;
  }
}

/* 11. Glass round action buttons in Header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.btn-icon-glass:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
  transform: translateY(-1.5px);
}

.btn-icon-glass:active {
  transform: translateY(0.5px);
}

/* Helper to hide SVGs inside toggle buttons */
.hidden {
  display: none !important;
}

/* 12. Drag & Drop Visual Styles */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  opacity: 0.3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 4px;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.drag-handle:hover {
  color: var(--text-primary);
  opacity: 0.8;
}

.drag-handle:active {
  cursor: grabbing;
}

.clock-card[draggable="true"] {
  user-select: none;
}

.clock-card.is-dragging {
  opacity: 0.35 !important;
  transform: scale(0.96) !important;
  border: 2.5px dashed var(--accent-color) !important;
  box-shadow: none !important;
  pointer-events: none; /* helps avoid drop zone interference */
}

.clock-card.drag-over {
  border-color: var(--accent-color) !important;
  transform: scale(1.02) translateY(-2px) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 30px var(--accent-glow) !important;
}

/* 13. Locked Layout Modifiers */
.layout-locked .order-controls,
.layout-locked .btn-delete,
.layout-locked .theme-picker,
.layout-locked .btn-edit-indicator,
.layout-locked .drag-handle,
.layout-locked #sortClocksBtn {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

.layout-locked .nickname-title {
  cursor: default !important;
  border-bottom: none !important;
}

.layout-locked .nickname-title:focus {
  background: none !important;
  border-bottom: none !important;
}

.layout-locked .location-meta {
  max-width: 100% !important;
}

/* Apply transitions to make lock/unlock smooth */
.order-controls,
.btn-delete,
.theme-picker,
.btn-edit-indicator,
.drag-handle,
#sortClocksBtn,
.location-meta {
  transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
              visibility 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
              width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
              margin 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
              padding 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 14. Light Mode Theme Definitions Override */
body.light-theme {
  --bg-main: #f0f3fa;
  --bg-card: rgba(255, 255, 255, 0.65);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --bg-input: rgba(255, 255, 255, 0.95);
  --bg-modal: rgba(243, 245, 250, 0.95);
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 0, 0, 0.16);
  
  --text-primary: #101828;
  --text-secondary: #475467;
  --text-muted: #8e9bb3;

  --accent-glow: rgba(0, 242, 254, 0.12);
}

/* Soft glass adjustments for light theme */
body.light-theme .ambient-glow {
  opacity: 0.09;
  filter: blur(140px);
}

body.light-theme .orb-teal { background-color: #00c6ff; }
body.light-theme .orb-violet { background-color: #8a2be2; }
body.light-theme .orb-amber { background-color: #ff8c00; }

body.light-theme .btn-icon-glass {
  background: rgba(0, 0, 0, 0.03);
}

body.light-theme .btn-icon-glass:hover {
  background: rgba(0, 0, 0, 0.06);
}

body.light-theme .clock-card {
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.light-theme .clock-card:hover {
  box-shadow: 0 16px 40px rgba(31, 38, 135, 0.1), 0 0 25px var(--accent-glow);
}

body.light-theme .analog-clock {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.05);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.02);
}

body.light-theme .hand-hour {
  background-color: #101828;
}

body.light-theme .hand-minute {
  background-color: rgba(16, 24, 40, 0.7);
}

body.light-theme .clock-pin {
  background-color: #101828;
}

body.light-theme .clock-face-marker {
  background-color: #cbd5e1;
}

body.light-theme .marker-12,
body.light-theme .marker-3,
body.light-theme .marker-6,
body.light-theme .marker-9 {
  background-color: #64748b;
}

body.light-theme .app-footer {
  background: linear-gradient(to top, #f0f3fa 70%, rgba(240, 243, 250, 0)) !important;
}

body.light-theme .scrubber-card {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.light-theme .scrubber-range {
  background: rgba(0, 0, 0, 0.08);
}

body.light-theme .modal-overlay {
  background: rgba(240, 243, 250, 0.75);
}

body.light-theme .modal-card {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

body.light-theme .search-item {
  background: rgba(0, 0, 0, 0.01);
}

body.light-theme .search-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

body.light-theme .chip-btn {
  background: rgba(0, 0, 0, 0.02);
}

body.light-theme .chip-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.light-theme .btn-delete {
  background: rgba(0, 0, 0, 0.02);
}

body.light-theme .btn-delete:hover {
  background: rgba(255, 79, 79, 0.12);
}

body.light-theme .theme-dot.is-active {
  border-color: #000000;
}
