/* ============================================================
   Global Holiday Calendar — style.css
   Design: Teal/Orange, Plus Jakarta Sans, Micro-interactions
   ============================================================ */

:root {
  --bg: #f0fdfa;
  --surface: #ffffff;
  --surface2: #f8fffe;
  --border: #ccfbf1;
  --border-mid: #99f6e4;
  --text: #134e4a;
  --muted: #5eead4;
  --muted-text: #0f766e;
  --primary: #0d9488;
  --primary-dk: #0f766e;
  --primary-lt: #ccfbf1;
  --accent: #f97316;
  --accent-lt: #fff7ed;
  --accent-dk: #ea6c0a;
  --danger: #ef4444;
  --danger-lt: #fef2f2;
  --shadow-sm: 0 1px 3px rgba(13, 148, 136, 0.08);
  --shadow-md: 0 4px 16px rgba(13, 148, 136, 0.12);
  --shadow-lg: 0 8px 32px rgba(13, 148, 136, 0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --header-h: 60px;

  /* Country color palette — assigned per country */
  --c0: #0d9488;
  --c0-lt: #ccfbf1;
  --c1: #f97316;
  --c1-lt: #fff7ed;
  --c2: #8b5cf6;
  --c2-lt: #ede9fe;
  --c3: #ec4899;
  --c3-lt: #fdf2f8;
  --c4: #f59e0b;
  --c4-lt: #fffbeb;
  --c5: #10b981;
  --c5-lt: #d1fae5;
  --c6: #3b82f6;
  --c6-lt: #eff6ff;
  --c7: #ef4444;
  --c7-lt: #fef2f2;
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(240, 253, 250, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: opacity 150ms ease;
}

.logo:hover {
  opacity: 0.8;
}

.logo svg {
  flex-shrink: 0;
}

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

.lang-switch {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-text);
  cursor: pointer;
  transition: all 150ms ease;
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
}

.lang-btn:not(.active):hover {
  background: var(--primary-lt);
  color: var(--primary);
}

.header-year {
  display: flex;
  align-items: center;
  gap: 4px;
}

.year-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-mid);
  background: var(--surface);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--primary);
  transition: background 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.year-btn:hover {
  background: var(--primary-lt);
  border-color: var(--primary);
}

.year-btn:active {
  transform: scale(0.94);
}

.year-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.year-display {
  font-weight: 700;
  font-size: 17px;
  min-width: 52px;
  text-align: center;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── Main layout ─────────────────────────────────────── */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 20px) 20px 40px;
}

/* ── Country Selector ────────────────────────────────── */
.selector-section {
  margin-bottom: 20px;
}

.selector-inner {
  position: relative;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--primary);
  pointer-events: none;
  flex-shrink: 0;
}

.country-input {
  width: 100%;
  height: 48px;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 44px 0 44px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  box-shadow: var(--shadow-sm);
}

.country-input::placeholder {
  color: var(--muted-text);
  opacity: 0.7;
}

.country-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12), var(--shadow-sm);
}

.clear-btn {
  position: absolute;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted-text);
  transition: background 150ms ease, color 150ms ease;
}

.clear-btn:hover {
  background: var(--primary-lt);
  color: var(--primary);
}

/* Dropdown */
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
  z-index: 100;
  list-style: none;
  padding: 6px;
  animation: dropIn 120ms ease;
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: background 100ms ease;
}

.dropdown-item:hover,
.dropdown-item[aria-selected="true"] {
  background: var(--primary-lt);
  color: var(--primary-dk);
}

.dropdown-item.already-added {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.dropdown-flag {
  font-size: 18px;
  line-height: 1;
}

.dropdown-name {
  flex: 1;
}

.dropdown-check {
  width: 16px;
  height: 16px;
  color: var(--primary);
  flex-shrink: 0;
}

.dropdown-empty {
  padding: 14px 12px;
  font-size: 14px;
  color: var(--muted-text);
  text-align: center;
}

/* Selected tags */
.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1.5px solid;
  font-size: 13px;
  font-weight: 600;
  cursor: default;
  animation: tagIn 160ms cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: box-shadow 150ms ease;
}

.tag:hover {
  box-shadow: var(--shadow-sm);
}

@keyframes tagIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.tag-flag {
  font-size: 15px;
  line-height: 1;
}

.tag-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-remove {
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  opacity: 0.6;
  transition: opacity 150ms ease, background 150ms ease, transform 100ms ease;
  color: inherit;
}

.tag-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.tag-remove:active {
  transform: scale(0.88);
}

.tag-remove:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

/* ── Month navigation ────────────────────────────────── */
.month-nav {
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.month-nav::-webkit-scrollbar {
  display: none;
}

.month-nav-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: max-content;
}

.month-btn {
  height: 34px;
  padding: 0 14px;
  border: 1.5px solid var(--border-mid);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease;
}

.month-btn:hover {
  background: var(--primary-lt);
  border-color: var(--primary);
  color: var(--primary-dk);
}

.month-btn:active {
  transform: scale(0.96);
}

.month-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.month-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Calendar ────────────────────────────────────────── */
.calendar-section {
  min-height: 400px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 12px;
  color: var(--muted-text);
}

.empty-icon {
  opacity: 0.35;
  margin-bottom: 8px;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.6;
}

.empty-sub {
  font-size: 14px;
  max-width: 320px;
}

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

/* Month Card */
.month-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 150ms ease;
  animation: cardIn 200ms ease;
}

.month-card:hover {
  box-shadow: var(--shadow-md);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.month-card-header {
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.month-card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.month-holiday-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-text);
  background: var(--primary-lt);
  padding: 2px 8px;
  border-radius: 999px;
}

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

.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-text);
  padding: 4px 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 4px;
  border-radius: var(--radius-xs);
  transition: background 100ms ease;
  cursor: default;
  min-height: 36px;
}

.cal-day:not(.empty).has-holiday {
  cursor: pointer;
  background: var(--danger-lt);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.16);
}

.cal-day:not(.empty).has-holiday:hover {
  background: #fee2e2;
}

.cal-day.today .day-num {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day.sunday .day-num {
  color: #ef4444;
}

.cal-day.saturday .day-num {
  color: #3b82f6;
}

.cal-day.today.has-holiday .day-num {
  background: var(--danger);
  color: #fff;
}

.day-num {
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  flex-shrink: 0;
}

.day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  margin-top: 3px;
  max-width: 100%;
}

.day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Holiday list under calendar */
.month-holidays {
  padding: 0 12px 12px;
}

.holiday-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.holiday-row:first-child {
  border-top: none;
}

.h-date {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--muted-text);
  min-width: 36px;
  font-size: 12px;
  padding-top: 1px;
}

.h-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
}

.h-flag-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.h-names {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.h-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}

/* ── Loading overlay ─────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(240, 253, 250, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-weight: 600;
  color: var(--primary-dk);
}

.loading-overlay[hidden] {
  display: none !important;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--primary-lt);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Tooltip ─────────────────────────────────────────── */
.tooltip {
  position: fixed;
  z-index: 300;
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  pointer-events: none;
  white-space: pre-line;
  max-width: 240px;
  line-height: 1.5;
  box-shadow: var(--shadow-md);
  animation: tooltipIn 120ms ease;
}

@keyframes tooltipIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Footer ──────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 24px 20px;
  color: var(--muted-text);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
  .logo span {
    display: none;
  }

  .months-grid {
    grid-template-columns: 1fr;
  }

  .cal-day {
    min-height: 32px;
  }

  .day-num {
    font-size: 11px;
  }
}

/* ── Reduced motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
