:root {
  --bg: #0b1220;
  --card: #0f1724;
  --muted: #9aa4b2;
  --accent: #4fd1c5;
  --accent2: #7dd3fc;
  --glass: rgba(255,255,255,0.03);
  --text: #e6eef6;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(2,6,23,0.6);
  --glass-border: rgba(255,255,255,0.04);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}
[data-theme="light"] {
  --bg: #f6f9fb;
  --card: #ffffff;
  --muted: #6b7280;
  --accent: #0ea5a4;
  --accent2: #0284c7;
  --glass: rgba(0,0,0,0.03);
  --text: #0b1220;
  --shadow: 0 8px 28px rgba(11,18,32,0.06);
  --glass-border: rgba(0,0,0,0.06);
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.app {
  max-width: 1200px;
  margin: 20px auto;
  padding: 18px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #042b26;
  box-shadow: var(--shadow);
}
h1 {
  margin: 0;
  font-size: 18px;
}
.subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.top-controls {
  /* align top-right */
}

.btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}
.toggle {
  display: flex;
  align-items: center;
}

.favs {
  margin: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.fav-pill {
  background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  padding: 8px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--glass-border);
  cursor: pointer;
}
.fav-empty {
  color: var(--muted);
  font-size: 14px;
}

.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.tool-card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.tool-card h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
}
.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
select, input[type="datetime-local"], input[type="time"], input[type="text"] {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text);
  outline: none;
}

.search-bar-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  padding: 1em;
}
.search-bar-container input {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
}
.card-left {
  flex: 1;
  min-width: 0;
}
.city-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.city-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.city-country {
  color: var(--muted);
  font-size: 13px;
}
.small {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0;
}
.time-big {
  font-weight: 700;
  font-size: 18px;
}
.date-small {
  font-size: 12px;
  color: var(--muted);
}
.analog-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.008));
  border: 1px solid rgba(255,255,255,0.02);
  flex-shrink: 0;
  position: relative;
}
canvas.analog {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: block;
}

.card-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}
.small-btn {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
}
.dn-badge {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.01), transparent);
  border: 1px solid rgba(255,255,255,0.02);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-card {
  position: absolute;
  top: 4rem;
  right: 12px;
  transform: translateY(-8px);
  z-index: 20;
  min-width: 200px;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 30px rgba(2,6,23,0.5);
  display: none;
  color: var(--text);
}
.card:hover .info-card {
  display: block;
}
.info-row {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.fav-highlight {
  box-shadow: 0 0 0 3px rgba(79,209,197,0.08);
  border: 1px solid rgba(79,209,197,0.12);
}

.conv-list {
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 6px;
}
.conv-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.02);
  font-size: 14px;
}
.countdown-display {
  font-weight: 700;
  font-size: 18px;
  margin-top: 8px;
}

@media (max-width:900px) {
  .tools {
    grid-template-columns: 1fr;
  }
}
@media (max-width:520px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
  .logo {
    width: 44px;
    height: 44px;
    font-size: 14px;
  }
}

/* === EXPANDING CITY CARD ON HOVER === */
.city-card {
  position: relative;
  background: var(--card-bg);
  color: var(--text);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  overflow: hidden;
  height: 180px; /* default collapsed height */
  cursor: pointer;
}

/* Slightly enlarge the card and show info when hovered */
.city-card:hover {
  height: 280px !important; /* expanded height */
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  transform: translateY(-4px);
}

/* Favorite button always visible */
.fav-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.fav-toggle:hover {
  transform: scale(1.2);
}

/* City name & main time area */
.city-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.city-time {
  font-size: 1.8rem;
  font-weight: bold;
  margin-top: 10px;
}

.city-date {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Hidden info area inside card */
.city-info-hover {
  margin-top: 10px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  font-size: 0.85rem;
  color: var(--muted);
}

/* When hovered, show info section */
.city-card:hover .city-info-hover {
  opacity: 1;
  transform: translateY(0);
}
