/* ==========================================================================
   Chronos - Design System & Custom Themes (Vanilla CSS)
   ========================================================================== */

/* 1. Global Reset & Variables */
:root {
  /* Default: Glassmorphism Theme */
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);
  --app-bg: rgba(255, 255, 255, 0.03);
  --glass-blur: 24px;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --card-bg: rgba(15, 23, 42, 0.65);
  --card-text: #ffffff;
  --accent: #a855f7; /* Purple */
  --accent-hover: #c084fc;
  --accent-rgb: 168, 85, 247;
  --border-color: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --glow: 0 0 20px rgba(168, 85, 247, 0.3);
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-clock: 'Share Tech Mono', monospace;
  --card-width: 84px;
  --card-height: 130px;
  --card-radius: 16px;
}

/* Theme: Modern Dark */
html[data-theme="dark"] {
  --bg-gradient: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
  --app-bg: #1e293b;
  --glass-blur: 0px;
  --text-primary: #f1f5f9;
  --text-secondary: #64748b;
  --card-bg: #0f172a;
  --card-text: #f8fafc;
  --accent: #3b82f6; /* Blue */
  --accent-hover: #60a5fa;
  --accent-rgb: 59, 130, 246;
  --border-color: #334155;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --glow: none;
}

/* Theme: Minimal Light */
html[data-theme="light"] {
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  --app-bg: #ffffff;
  --glass-blur: 0px;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --card-bg: #f1f5f9;
  --card-text: #0f172a;
  --accent: #0f172a; /* Slate Dark */
  --accent-hover: #334155;
  --accent-rgb: 15, 23, 42;
  --border-color: #cbd5e1;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --glow: none;
}

/* Theme: Neon Retro (Cyberpunk) */
html[data-theme="retro"] {
  --bg-gradient: linear-gradient(180deg, #050508 0%, #0d0c1d 100%);
  --app-bg: rgba(13, 12, 29, 0.85);
  --glass-blur: 10px;
  --text-primary: #39ff14; /* Neon Green */
  --text-secondary: #00ffff; /* Neon Cyan */
  --card-bg: #000000;
  --card-text: #ff007f; /* Neon Pink */
  --accent: #ff007f;
  --accent-hover: #ff3399;
  --accent-rgb: 255, 0, 127;
  --border-color: #00ffff;
  --shadow: 0 0 20px rgba(0, 255, 255, 0.2);
  --glow: 0 0 15px rgba(255, 0, 127, 0.6);
}

/* Theme: Forest Green */
html[data-theme="forest"] {
  --bg-gradient: linear-gradient(135deg, #0f2a1d 0%, #061c12 100%);
  --app-bg: #0d2c1f;
  --glass-blur: 0px;
  --text-primary: #e6f4ea;
  --text-secondary: #82a893;
  --card-bg: #071f15;
  --card-text: #4ade80; /* Soft Green */
  --accent: #10b981; /* Emerald */
  --accent-hover: #34d399;
  --accent-rgb: 16, 185, 129;
  --border-color: #1b4d36;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --glow: 0 0 15px rgba(16, 185, 129, 0.2);
}

/* 2. Global Elements Styling */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px;
}

/* Responsive Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* 3. Background Glow Decoration */
.bg-glow-shapes {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.bg-glow-shapes .shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  mix-blend-mode: screen;
  animation: float-shapes 20s infinite alternate ease-in-out;
  transition: opacity 1s;
}

/* Theme dependency on background decor */
html[data-theme="light"] .bg-glow-shapes .shape {
  opacity: 0.05;
  mix-blend-mode: multiply;
}
html[data-theme="dark"] .bg-glow-shapes .shape {
  opacity: 0.1;
}
html[data-theme="retro"] .bg-glow-shapes .shape {
  opacity: 0.3;
}

.shape-1 {
  width: 500px;
  height: 500px;
  background: #a855f7;
  top: -10%;
  left: -10%;
}
.shape-2 {
  width: 600px;
  height: 600px;
  background: #3b82f6;
  bottom: -15%;
  right: -10%;
  animation-delay: -5s !important;
}
.shape-3 {
  width: 400px;
  height: 400px;
  background: #ec4899;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -10s !important;
}

@keyframes float-shapes {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(50px, 30px) scale(1.1) rotate(180deg); }
  100% { transform: translate(-30px, -50px) scale(0.9) rotate(360deg); }
}

/* 4. Application Container & Layout */
.app-container {
  width: 100%;
  max-width: 900px;
  min-height: 680px;
  height: 85vh;
  max-height: 850px;
  background: var(--app-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

/* Header */
.app-header {
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
  filter: drop-shadow(var(--glow));
}
.header-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-shadow: var(--glow);
}

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

/* Buttons Styling */
.control-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
}
.control-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  transform: translateY(-2px);
  color: var(--accent);
  box-shadow: var(--glow);
}
.control-btn:active {
  transform: translateY(0);
}

/* NTP Badge */
.ntp-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ntp-badge:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}
.ntp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}
.ntp-dot.online {
  background-color: #10b981; /* green */
  box-shadow: 0 0 10px #10b981;
}
.ntp-dot.syncing {
  background-color: #f59e0b; /* amber */
  box-shadow: 0 0 10px #f59e0b;
  animation: pulse-sync 1s infinite alternate;
}
.ntp-dot.offline {
  background-color: #ef4444; /* red */
  box-shadow: 0 0 10px #ef4444;
}

@keyframes pulse-sync {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.2); opacity: 1; }
}

/* Theme Dropdown */
.theme-selector-wrapper {
  position: relative;
}
.theme-dropdown {
  position: absolute;
  top: 52px;
  right: 0;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 8px;
  width: 190px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
  animation: slide-down 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.theme-dropdown.show {
  display: flex;
}

@keyframes slide-down {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.theme-option {
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}
.theme-option:hover {
  background: rgba(255, 255, 255, 0.08);
}
.theme-preview {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.theme-preview.glass { background: linear-gradient(135deg, #a855f7, #3b82f6); }
.theme-preview.dark { background: #0f172a; }
.theme-preview.light { background: #f8fafc; border-color: #cbd5e1; }
.theme-preview.retro { background: #ff007f; }
.theme-preview.forest { background: #10b981; }

/* Main Content Area */
.app-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  position: relative;
}

/* Tab Panels */
.tab-panel {
  display: none;
  height: 100%;
  animation: fade-in 0.4s ease;
}
.tab-panel.active {
  display: flex;
  flex-direction: column;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 5. Main Clock Screen styling */
.clock-display-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  margin: auto;
  gap: 32px;
}

/* Calendar Date */
.date-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.cal-date {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}
.cal-day {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-shadow: var(--glow);
}

/* FLIP CLOCK COMPONENT */
.flip-clock-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
}

.flip-unit {
  position: relative;
  width: var(--card-width);
  height: var(--card-height);
  border-radius: var(--card-radius);
  perspective: 350px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.card-half {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  backface-visibility: hidden;
  background: var(--card-bg);
  color: var(--card-text);
  font-family: var(--font-clock);
  font-size: calc(var(--card-height) * 0.85);
  font-weight: 700;
  border: 1px solid var(--border-color);
  box-sizing: border-box;
}

.card-half span {
  display: block;
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--card-height);
  line-height: var(--card-height);
  text-align: center;
}

.top-half, .top-flip {
  top: 0;
  border-top-left-radius: var(--card-radius);
  border-top-right-radius: var(--card-radius);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}
.top-half span, .top-flip span {
  top: 0;
}

.bottom-half, .bottom-flip {
  bottom: 0;
  border-bottom-left-radius: var(--card-radius);
  border-bottom-right-radius: var(--card-radius);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.bottom-half span, .bottom-flip span {
  bottom: 0;
}

/* Flip animations */
.flip-half {
  z-index: 3;
}
.top-flip {
  transform-origin: bottom;
  transform: rotateX(0deg);
}
.bottom-flip {
  transform-origin: top;
  transform: rotateX(90deg);
  z-index: 2;
}

/* Animated classes added by JS */
.flip-unit.animate-flip .top-flip {
  animation: flip-top-key 0.15s ease-in forwards;
}
.flip-unit.animate-flip .bottom-flip {
  animation: flip-bottom-key 0.15s ease-out 0.15s forwards;
}

@keyframes flip-top-key {
  0% { transform: perspective(300px) rotateX(0deg); }
  100% { transform: perspective(300px) rotateX(-90deg); }
}
@keyframes flip-bottom-key {
  0% { transform: perspective(300px) rotateX(90deg); }
  100% { transform: perspective(300px) rotateX(0deg); }
}

/* Colons */
.flip-colon {
  font-family: var(--font-clock);
  font-size: 5rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 10px;
  padding-bottom: 14px;
  animation: colon-blink 1s steps(1) infinite;
  text-shadow: var(--glow);
}

@keyframes colon-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.clock-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.timezone-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.text-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  text-shadow: var(--glow);
}
.text-btn:hover {
  color: var(--accent-hover);
  background: rgba(255, 255, 255, 0.05);
}

/* Hidden Seconds State styling */
.flip-clock-container.hide-seconds #s-tens,
.flip-clock-container.hide-seconds #s-ones,
.flip-clock-container.hide-seconds .flip-colon-seconds {
  display: none !important;
}

/* 6. World Clock Panel */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-shrink: 0;
}
.panel-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.primary-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: var(--glow);
}
.primary-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.primary-btn:active {
  transform: translateY(0);
}
.primary-btn.wide {
  width: 100%;
  justify-content: center;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.secondary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
}
.secondary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* World Cities Grid */
.cities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  overflow-y: auto;
  padding-bottom: 20px;
}

.city-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}
.city-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: var(--glow);
}

.city-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.city-info {
  display: flex;
  flex-direction: column;
}
.city-name {
  font-size: 1.2rem;
  font-weight: 700;
}
.city-country {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.city-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.city-delete-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.city-time-display {
  display: flex;
  align-items: flex-baseline;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}
.city-time {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: var(--glow);
}
.city-ampm {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 4px;
}

.city-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.city-diff {
  font-weight: 600;
}
.city-diff.ahead { color: #10b981; }
.city-diff.behind { color: #ef4444; }
.city-diff.same { color: var(--text-secondary); }

/* 7. Stopwatch Pane */
.stopwatch-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  height: 100%;
}

.stopwatch-visualizer {
  position: relative;
  width: 280px;
  height: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.progress-ring-svg {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: transparent;
  stroke: rgba(255, 255, 255, 0.03);
  stroke-width: 6;
}

.ring-fg {
  fill: transparent;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-dasharray: 816.8; /* 2 * pi * r (130) */
  stroke-dashoffset: 816.8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.05s linear;
  filter: drop-shadow(var(--glow));
}

.stopwatch-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-mono);
  z-index: 5;
}
.stopwatch-display .time-main {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-shadow: var(--glow);
}
.stopwatch-display .time-ms {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 600;
}

.controls-row {
  display: flex;
  gap: 16px;
  align-items: center;
}

.action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}
.action-btn.play {
  background: #10b981;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}
.action-btn.play:hover {
  background: #059669;
  transform: scale(1.08);
}
.action-btn.pause {
  background: #f59e0b;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}
.action-btn.pause:hover {
  background: #d97706;
  transform: scale(1.08);
}
.action-btn:active {
  transform: scale(0.96);
}

.laps-container {
  width: 100%;
  max-width: 480px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.01);
}

.laps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.laps-table th {
  position: sticky;
  top: 0;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}
.laps-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
}
.laps-table tr:last-child td {
  border-bottom: none;
}
.laps-table tr.lap-fastest {
  color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}
.laps-table tr.lap-slowest {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

/* 8. Timer Pane */
.timer-setup-view {
  max-width: 420px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}
.timer-setup-view h2 {
  font-size: 1.5rem;
}

.timer-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: 20px;
}
.picker-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.picker-col label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.picker-col input {
  width: 70px;
  height: 60px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.picker-col input:focus {
  border-color: var(--accent);
}
/* Disable spinner controls on inputs */
.picker-col input::-webkit-outer-spin-button,
.picker-col input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.picker-sep {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--text-secondary);
  padding-bottom: 8px;
}

.timer-label-input {
  width: 100%;
}
.timer-label-input input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  font-size: 0.95rem;
}
.timer-label-input input:focus {
  border-color: var(--accent);
}

.timer-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.preset-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.preset-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

/* Active Timers List */
.active-timers-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.timers-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-bottom: 20px;
}

.timer-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.timer-card.completed {
  border-color: #ef4444;
  animation: pulse-completed-timer 1.5s infinite alternate;
}

@keyframes pulse-completed-timer {
  0% { box-shadow: 0 0 5px rgba(239, 68, 68, 0.1); }
  100% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }
}

.timer-info-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.timer-card-label {
  font-weight: 700;
  font-size: 1.1rem;
}
.timer-card-duration {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.timer-visual-col {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer-card-time {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: var(--glow);
  width: 140px;
  text-align: right;
}

.timer-mini-ring {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timer-mini-ring svg {
  transform: rotate(-90deg);
}
.timer-mini-ring .ring-bg {
  stroke-width: 4;
}
.timer-mini-ring .ring-fg {
  stroke-width: 4;
  stroke-dasharray: 125.6; /* 2 * pi * 20 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.5s linear;
}

.timer-actions {
  display: flex;
  gap: 8px;
}

.timer-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: all 0.2s;
}
.timer-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}
.timer-btn.delete:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}
.timer-btn.resume {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.timer-btn.resume:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
}

/* 9. Floating Navigation Bar */
.app-nav {
  padding: 12px 24px;
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}
.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}
.nav-item.active {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  font-weight: 700;
  text-shadow: var(--glow);
}
.nav-icon {
  width: 22px;
  height: 22px;
  transition: transform 0.3s ease;
}
.nav-item.active .nav-icon {
  transform: translateY(-2px);
  filter: drop-shadow(var(--glow));
}

/* 10. Dialog & Autocomplete list */
.glass-dialog {
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 0;
  margin: auto;
  max-width: 450px;
  width: 90%;
  color: var(--text-primary);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  outline: none;
}
/* Backdrop styling */
.glass-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in-backdrop 0.3s ease;
}

@keyframes fade-in-backdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dialog-content {
  display: flex;
  flex-direction: column;
}
.dialog-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}
.dialog-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}
.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.dialog-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}
.search-input-wrapper input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  outline: none;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.search-input-wrapper input:focus {
  border-color: var(--accent);
}

.search-results-list {
  list-style: none;
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.search-results-list li {
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}
.search-results-list li:hover {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent-hover);
}
.search-result-city {
  font-weight: 600;
  font-size: 0.95rem;
}
.search-result-details {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* 11. Fullscreen Custom Modes */
.app-container.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: none !important;
  z-index: 9999;
}
.app-container.fullscreen-mode .app-nav {
  display: none !important; /* Hide nav bar in fullscreen clock mode */
}
.app-container.fullscreen-mode .app-header {
  border-bottom: none;
  background: transparent;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
}
/* Show header in fullscreen when hovering near the top */
.app-container.fullscreen-mode .app-header:hover {
  opacity: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.app-container.fullscreen-mode .app-main {
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.app-container.fullscreen-mode .tab-panel:not(.active) {
  display: none !important;
}
.app-container.fullscreen-mode .tab-panel.active {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Adjust scale in fullscreen mode */
.app-container.fullscreen-mode .clock-display-wrapper {
  transform: scale(1.4);
  transition: transform 0.5s ease;
}

.hidden {
  display: none !important;
}

/* 12. Responsive Design Adjustments */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  .app-container {
    height: 92vh;
    border-radius: 20px;
  }
  .app-header {
    padding: 16px 20px;
  }
  .app-header h1 {
    font-size: 1.25rem;
  }
  .app-main {
    padding: 20px;
  }
  .flip-clock-container {
    gap: 4px;
    padding: 8px 0;
  }
  :root {
    --card-width: 48px;
    --card-height: 76px;
    --card-radius: 8px;
  }
  .flip-colon {
    font-size: 3rem;
    margin: 0 4px;
    padding-bottom: 8px;
  }
  .cal-date {
    font-size: 1.1rem;
  }
  .cal-day {
    font-size: 1.4rem;
  }
  .app-container.fullscreen-mode .clock-display-wrapper {
    transform: scale(1);
  }
  .stopwatch-visualizer {
    width: 220px;
    height: 220px;
  }
  .progress-ring-svg {
    width: 220px;
    height: 220px;
  }
  .progress-ring-svg circle {
    cx: 110;
    cy: 110;
    r: 100;
  }
  .ring-fg {
    stroke-dasharray: 628.3; /* 2 * pi * 100 */
    stroke-dashoffset: 628.3;
  }
  .stopwatch-display .time-main {
    font-size: 2.2rem;
  }
  .timer-card {
    padding: 12px 16px;
  }
  .timer-card-time {
    font-size: 1.5rem;
    width: 100px;
  }
}

@media (max-width: 480px) {
  :root {
    --card-width: 36px;
    --card-height: 56px;
    --card-radius: 6px;
  }
  .flip-colon {
    font-size: 2rem;
    margin: 0 2px;
  }
  .cities-grid {
    grid-template-columns: 1fr;
  }
  .timer-picker {
    padding: 10px;
  }
  .picker-col input {
    width: 52px;
    height: 48px;
    font-size: 1.5rem;
  }
  .picker-sep {
    font-size: 1.5rem;
  }
}
