/* ==========================================================================
   WhatTime • Simplified Dual Timezone Clock
   Aesthetics: Clean minimal modern design
   ========================================================================== */

:root {
  --ink-primary: #18181b;
  --ink-secondary: #52525b;
  --ink-muted: #71717a;
  --bg-page: #f4f4f5;
  --card-bg: #ffffff;
  --border-card: #27272a;
  --border-line: #3f3f46;
  --border-subtle: #e4e4e7;
  --accent-soft: #f4f4f5;
  --accent-hover: #e4e4e7;
  --badge-bg: #f4f4f5;
  --badge-border: #d4d4d8;
  --highlight-glow: rgba(0, 0, 0, 0.05);

  /* Modern Font Only */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-digits: 'Space Grotesk', 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  background-image: 
    radial-gradient(circle at 50% 10%, #ffffff 0%, #eaeaea 100%);
  color: var(--ink-primary);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

/* ==========================================================================
   MAIN CARD FRAME (MATCHING WIREFRAME MOCKUP)
   ========================================================================== */
.viewport-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.sketch-card-frame {
  width: 100%;
  max-width: 416px;
  height: 100%;
  max-height: 100%;
  background: var(--card-bg);
  border: 2.8px solid var(--border-card);
  border-radius: 36px;
  box-shadow: 
    0 20px 48px -10px rgba(0, 0, 0, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

@media (min-width: 600px) and (min-height: 850px) {
  .sketch-card-frame {
    height: 780px;
    max-height: calc(100dvh - 24px);
  }
}

/* ==========================================================================
   SECTIONS: TOP & BOTTOM (EQUAL PROPORTION AROUND LIGHT GREY MIDDLE LINE)
   ========================================================================== */
.card-section {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  box-sizing: border-box;
}

.top-section {
  flex: 1 1 0;
  min-height: 0;
  justify-content: space-evenly;
  padding-top: 16px;
  padding-bottom: 12px;
}

.bottom-section {
  flex: 1 1 0;
  min-height: 0;
  justify-content: space-evenly;
  padding-top: 12px;
  padding-bottom: 14px;
}

/* ==========================================================================
   TIMEZONE SEARCH INPUT (TOP)
   ========================================================================== */
.tz-search-wrapper {
  width: 100%;
  max-width: 320px;
  position: relative;
  z-index: 100;
  margin-bottom: 0;
}

.tz-search-box {
  width: 100%;
  height: 48px;
  background: #ffffff;
  border: 2.2px solid var(--border-card);
  border-radius: 14px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.tz-search-box:focus-within {
  border-color: #000000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.tz-search-icon {
  font-size: 1rem;
  opacity: 0.65;
  pointer-events: none;
}

.tz-search-input {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-primary);
  outline: none;
}

.tz-search-input::placeholder {
  color: var(--ink-muted);
  font-weight: 500;
}

.tz-clear-btn {
  background: transparent;
  border: none;
  font-size: 0.95rem;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 4px;
  display: none;
  line-height: 1;
}

.tz-clear-btn.visible {
  display: block;
}

.tz-clear-btn:hover {
  color: var(--ink-primary);
}

/* ==========================================================================
   TIMEZONE DROPDOWN LIST (VERY SIMPLE - ONE LINE ONLY)
   ========================================================================== */
.tz-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 2.2px solid var(--border-card);
  border-radius: 16px;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.25);
  max-height: 260px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
  overscroll-behavior: contain;
}

.tz-dropdown.open {
  display: block;
  animation: dropdownSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tz-dropdown-list {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Simple 1-line dropdown items */
.tz-drop-item {
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  transition: background 0.15s ease, transform 0.1s ease;
  border: 1px solid transparent;
}

.tz-drop-item:hover {
  background: var(--accent-soft);
  border-color: var(--border-subtle);
  transform: translateX(2px);
}

.tz-drop-item.selected {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
  font-weight: 700;
}

.tz-no-matches {
  padding: 14px 12px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

/* Selected Zone Indicator Pill */
.selected-zone-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--badge-bg);
  border: 1.5px solid var(--badge-border);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.selected-zone-tag:hover {
  background: var(--accent-hover);
  border-color: #a1a1aa;
}

.zone-badge {
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--ink-primary);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.zone-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.diff-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: #2563eb;
  background: #eff6ff;
  padding: 1px 6px;
  border-radius: 6px;
}

/* ==========================================================================
   TIME & DATE DISPLAY BLOCKS
   ========================================================================== */
.time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

/* ==========================================================================
   TIME READOUT ROW: DIGITS (NUMBERS ONLY) + TAPPABLE AM/PM
   ========================================================================== */
.time-readout-row {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  position: relative;
  border-radius: 20px;
  padding: 4px 8px;
  transition: all 0.15s ease;
}

.time-readout-row:hover {
  background: rgba(0, 0, 0, 0.035);
}

.time-digits-input {
  width: auto;
  min-width: 175px;
  max-width: 240px;
  field-sizing: content;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-digits);
  font-size: clamp(3.2rem, 7.5vh, 4.4rem);
  font-weight: 700;
  line-height: 1.15;
  text-align: right;
  color: var(--ink-primary);
  letter-spacing: -0.02em;
  padding: 2px 4px;
  cursor: pointer;
  overflow: visible;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.time-digits-input:hover {
  text-decoration: underline dashed rgba(0, 0, 0, 0.2);
  text-underline-offset: 6px;
}

.time-digits-input:focus {
  cursor: text;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  outline: 2px solid var(--border-card);
  text-decoration: none;
}

.period-toggle-btn {
  font-family: var(--font-digits);
  font-size: clamp(1.8rem, 3.8vh, 2.2rem);
  font-weight: 600;
  line-height: 1;
  color: var(--ink-primary);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 2px 6px;
  margin-left: 4px;
  cursor: pointer;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  transition: all 0.15s cubic-bezier(0.2, 0.8, 0.4, 1);
}

.period-toggle-btn:hover {
  background: var(--accent-hover);
  border-color: var(--border-subtle);
  transform: translateY(-1px) scale(1.08);
}

.period-toggle-btn:active {
  transform: translateY(1px) scale(0.95);
}

/* Tappable Date Component */
.tappable-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 12px;
  transition: all 0.15s ease;
  margin-top: 2px;
}

.tappable-date:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.tappable-date:active {
  transform: translateY(1px);
}

.date-text {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 2.3vh, 1.35rem);
  font-weight: 600;
  color: var(--ink-primary);
  letter-spacing: -0.01em;
}

/* ==========================================================================
   CENTER HORIZONTAL DIVIDER (LIGHT GREY & EQUAL PROPORTION)
   ========================================================================== */
.sketch-divider {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

.divider-line {
  width: 100%;
  height: 1.5px;
  background: #e4e4e7; /* Light grey */
  border-radius: 1px;
}

/* ==========================================================================
   BOTTOM SECTION: INDIAN TIME
   ========================================================================== */
.indian-label-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 0;
}

.indian-time-title {
  font-family: var(--font-heading);
  font-size: clamp(1.3rem, 2.7vh, 1.55rem);
  font-weight: 700;
  color: var(--ink-primary);
  letter-spacing: -0.01em;
}

.ist-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #c2410c;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 1px 7px;
  border-radius: 10px;
}

/* ==========================================================================
   NOW BUTTON (MOVED UP, NO BOTTOM LINE)
   ========================================================================== */
.now-btn-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.now-pill-btn {
  background: #ffffff;
  border: 1.8px solid var(--border-card);
  border-radius: 12px;
  padding: 7px 18px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
  transition: all 0.15s ease;
}

.now-pill-btn:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
}

.now-pill-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* ==========================================================================
   MODAL STYLING (TIME PICKER & DATE PICKER)
   ========================================================================== */
.sketch-modal {
  margin: auto;
  border: none;
  background: transparent;
  padding: 0;
  outline: none;
  max-width: 90vw;
}

.sketch-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  background: #ffffff;
  border: 2.8px solid var(--border-card);
  border-radius: 28px;
  padding: 24px;
  width: 360px;
  max-width: 92vw;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.modal-close-x {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 4px;
  line-height: 1;
  border-radius: 8px;
}

.modal-close-x:hover {
  color: var(--ink-primary);
  background: var(--accent-soft);
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-top: -8px;
}


/* Modal Actions */
.modal-footer-btns {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.m-btn {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.m-btn-secondary {
  background: #ffffff;
  border: 1.8px solid var(--border-card);
  color: var(--ink-secondary);
}

.m-btn-secondary:hover {
  background: var(--accent-soft);
}

.m-btn-primary {
  background: var(--ink-primary);
  border: 1.8px solid var(--ink-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.m-btn-primary:hover {
  background: #000000;
  transform: translateY(-1px);
}

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

/* ==========================================================================
   DATE PICKER CALENDAR MODAL
   ========================================================================== */
.calendar-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.cal-nav-arrow {
  background: #ffffff;
  border: 1.8px solid var(--border-card);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-primary);
}

.cal-nav-arrow:hover {
  background: var(--accent-soft);
}

.cal-nav-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink-primary);
}

/* Quick presets */
.cal-quick-presets {
  display: flex;
  gap: 6px;
}

.preset-chip {
  flex: 1;
  height: 32px;
  background: var(--accent-soft);
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.preset-chip:hover {
  background: #ffffff;
  border-color: var(--border-card);
  color: var(--ink-primary);
}

/* Calendar Weekdays */
.cal-weekday-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-muted);
}

/* Calendar Grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  aspect-ratio: 1;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-family: var(--font-digits);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.cal-cell:hover {
  background: var(--accent-soft);
  border-color: var(--border-card);
}

.cal-cell.outside {
  opacity: 0.28;
}

.cal-cell.today {
  border-color: #3b82f6;
  color: #1d4ed8;
  font-weight: 800;
}

.cal-cell.selected {
  background: var(--ink-primary) !important;
  color: #ffffff !important;
  border-color: var(--ink-primary) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Responsive adjustment for small mobile viewports */
@media (max-width: 440px) {
  body {
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .sketch-card-frame {
    border-radius: 30px;
  }
}
