/* ==========================================================================
   time.fajr.work — World Time Availability Planner
   Matches pixel-perfect modern minimalist SaaS aesthetic
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  
  --bg-page: #fbfbfb;
  --bg-card: #ffffff;
  --bg-card-subtle: #fafafa;
  --bg-hover: #f4f4f5;
  
  --border-subtle: #e4e4e7;
  --border-card: #e5e7eb;
  --border-focus: #18181b;
  
  --text-main: #09090b;
  --text-muted: #71717a;
  --text-subtle: #a1a1aa;
  
  /* Status Colors */
  --green-solid: #059669;
  --green-light: #ecfdf5;
  --green-border: #a7f3d0;
  --green-text: #065f46;
  
  --yellow-bg: #eab308;
  --yellow-dot: #713f12;
  --yellow-light: #fefce8;
  --yellow-border: #fef08a;
  --yellow-text: #854d0e;
  
  --red-stripe-1: #ef4444;
  --red-stripe-2: #f87171;
  --red-light: #fef2f2;
  --red-border: #fecaca;
  --red-text: #991b1b;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-scrubber: 0 4px 14px rgba(0, 0, 0, 0.18), 0 0 0 2px #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.app-container {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ==========================================================================
   Header Navbar
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid #f1f1f4;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-main);
  user-select: none;
}

.brand-icon {
  width: 22px;
  height: 22px;
  color: var(--text-main);
}

.brand-text {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Exploring Time Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--text-muted);
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  user-select: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-pill:hover {
  background: var(--bg-hover);
}

.status-dot {
  width: 7.5px;
  height: 7.5px;
  border-radius: 50%;
  background-color: #eab308;
  transition: background-color 0.2s ease;
}

.status-dot.live {
  background-color: #10b981;
}

/* Add Location Button */
.btn-add-location {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-add-location:hover {
  background: var(--bg-hover);
  border-color: #d4d4d8;
}

.btn-add-location svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   Page Heading Row (Your Day + Date + Count)
   ========================================================================== */
.day-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 4px;
}

.day-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.day-subheading {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 400;
}

.day-main-heading {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.locations-counter {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ==========================================================================
   Location Cards Grid
   ========================================================================== */
.location-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.location-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.location-card:hover {
  border-color: #d1d5db;
}

.location-card.is-reference {
  border-color: #d4d4d8;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2px;
}

.location-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.btn-remove-location {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-subtle);
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-remove-location:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.btn-remove-location svg {
  width: 15px;
  height: 15px;
}

.location-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reference-tag {
  color: var(--text-muted);
  cursor: pointer;
}

.reference-tag.clickable:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.location-time {
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}

.location-date {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-offset-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  background: #f4f4f5;
  border-radius: 4px;
  color: var(--text-muted);
}

.location-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  margin-top: auto;
}

.location-status.within {
  color: var(--green-text);
}

.location-status.near {
  color: var(--yellow-text);
}

.location-status.outside {
  color: var(--red-text);
}

.location-status svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   Overlap Availability Section
   ========================================================================== */
.overlap-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.overlap-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.overlap-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
}

.overlap-title.perfect svg {
  color: var(--green-solid);
}

.overlap-title.near svg {
  color: #ca8a04;
}

.overlap-title.outside svg {
  color: #dc2626;
}

.overlap-description {
  font-size: 13.5px;
  color: var(--text-muted);
}

.btn-current-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-current-time:hover {
  background: var(--bg-hover);
  border-color: #d4d4d8;
}

.btn-current-time svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   Timeline 48-slot Bar & Scrubber Handle
   ========================================================================== */
.timeline-container {
  position: relative;
  user-select: none;
  touch-action: pan-y;
  padding: 8px 0 4px;
}

.timeline-slots-track {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 40px;
  width: 100%;
  position: relative;
  cursor: pointer;
}

.timeline-slot {
  flex: 1;
  height: 100%;
  border-radius: 4px;
  position: relative;
  transition: transform 0.1s ease, filter 0.1s ease;
  overflow: hidden;
}

.timeline-slot:hover {
  filter: brightness(0.94);
  transform: scaleY(1.04);
}

/* Red Pattern: 45deg stripes */
.timeline-slot.outside {
  background: repeating-linear-gradient(
    -45deg,
    #dc2626,
    #dc2626 4px,
    #f87171 4px,
    #f87171 8px
  );
}

/* Yellow Pattern: Dotted grid */
.timeline-slot.near {
  background-color: #eab308;
  background-image: radial-gradient(#854d0e 24%, transparent 24%);
  background-size: 5px 5px;
}

/* Green: Solid Emerald */
.timeline-slot.perfect {
  background-color: var(--green-solid);
}

/* Scrubber Slider Handle */
.scrubber-handle {
  position: absolute;
  top: 3px;
  bottom: 0px;
  width: 22px;
  height: 50px;
  background: #18181b;
  border: 2.5px solid #ffffff;
  border-radius: 7px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  cursor: grab;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  pointer-events: all;
  transition: transform 0.05s ease-out;
}

.scrubber-handle:active {
  cursor: grabbing;
  transform: translateX(-50%) scale(1.03);
}

.scrubber-notch {
  width: 2px;
  height: 18px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 1px;
}

/* Timeline Labels */
.timeline-time-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}

/* Timeline Legend & Reference row */
.timeline-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid #f4f4f5;
  margin-top: 4px;
}

.timeline-legend {
  display: flex;
  align-items: center;
  gap: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
}

.legend-swatch {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

.legend-swatch.outside {
  background: repeating-linear-gradient(
    -45deg,
    #dc2626,
    #dc2626 3px,
    #f87171 3px,
    #f87171 6px
  );
}

.legend-swatch.near {
  background-color: #eab308;
  background-image: radial-gradient(#854d0e 24%, transparent 24%);
  background-size: 4px 4px;
}

.legend-swatch.perfect {
  background-color: var(--green-solid);
}

/* ==========================================================================
   Advanced Settings Collapsible Section
   ========================================================================== */
.advanced-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

.advanced-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  transition: background 0.15s ease;
}

.advanced-toggle-header:hover {
  background: #fafafa;
}

.advanced-title-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.advanced-title-left svg {
  width: 18px;
  height: 18px;
  color: var(--text-main);
}

.advanced-title-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.chevron-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.advanced-section.is-open .chevron-icon {
  transform: rotate(180deg);
}

.advanced-content {
  padding: 0 24px 24px;
  display: none;
  flex-direction: column;
  gap: 20px;
  border-top: 1px solid #f4f4f5;
  background: #ffffff;
}

.advanced-section.is-open .advanced-content {
  display: flex;
  padding-top: 20px;
}

.advanced-help-text {
  font-size: 13.5px;
  color: var(--text-muted);
}

.working-hours-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.working-hours-card {
  background: #fafafa;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.working-hours-city {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
}

.time-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-input-wrap {
  position: relative;
  flex: 1;
}

.time-input-select {
  width: 100%;
  padding: 8px 30px 8px 12px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-main);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  font-variant-numeric: tabular-nums;
}

.time-input-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.time-input-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.time-range-separator {
  font-size: 12.5px;
  color: var(--text-muted);
}

.preferences-row {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 6px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  accent-color: #18181b;
}

.advanced-legend-footnote {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  padding-top: 4px;
}

/* ==========================================================================
   Add Location Modal / Dialog
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-backdrop.is-open {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.97);
  transition: transform 0.2s ease;
}

.modal-backdrop.is-open .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.modal-search-wrap {
  padding: 14px 20px;
  border-bottom: 1px solid #f4f4f5;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fafafa;
}

.modal-search-wrap svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.modal-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}

.popular-chips {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: #fafafa;
  border-bottom: 1px solid #f4f4f5;
}

.popular-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}

.popular-chip {
  font-size: 12px;
  padding: 3px 9px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.popular-chip:hover {
  background: var(--bg-hover);
  border-color: #d4d4d8;
}

.modal-results-list {
  padding: 8px 12px;
  overflow-y: auto;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s ease;
}

.result-item:hover {
  background: #f4f4f5;
}

.result-city-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-city-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.result-city-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.result-time-info {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-local-time {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.result-offset {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #18181b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

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

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 900px) {
  .app-container {
    padding: 16px 18px 48px;
    gap: 24px;
  }
  
  .day-main-heading {
    font-size: 26px;
  }
  
  .location-cards-grid {
    grid-template-columns: 1fr;
  }
  
  .location-time {
    font-size: 40px;
  }
  
  .timeline-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .timeline-legend {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .day-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .overlap-header {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }
  
  .btn-current-time {
    width: 100%;
    justify-content: center;
  }
}
