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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8f9fa;
  color: #333;
  line-height: 1.6;
  padding: 2rem 1rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 { font-size: 2rem; margin-bottom: 0.25rem; }
header p { color: #666; }

/* Form */
form {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.form-row { display: flex; flex-direction: column; gap: 0.25rem; }
.form-row label { font-weight: 600; font-size: 0.85rem; color: #555; }
.form-row select, .form-row input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

button[type="submit"] {
  background: #2563eb;
  color: white;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}
button[type="submit"]:hover { background: #1d4ed8; }

/* Mode toggle */
.mode-toggle { display: flex; gap: 0; border-radius: 4px; overflow: hidden; border: 1px solid #ddd; }
.mode-btn {
  padding: 0.4rem 0.75rem;
  border: none;
  background: #f3f4f6;
  color: #555;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.mode-btn.active { background: #2563eb; color: white; font-weight: 600; }
.mode-btn:hover:not(.active) { background: #e5e7eb; }
.mode-description { font-size: 0.75rem; color: #888; margin: 0.25rem 0 0 0; padding: 0; border: none; background: none; }

/* Legend */
.legend {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: #555; }
.swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
}
.swatch.today { background: white; border: 2px solid #dc2626; }
.swatch.holiday { background: #fbbf24; border: 1px solid #d97706; }
.swatch.regional { background: #fef3c7; border: 1px solid #d97706; }
.swatch.weekend { background: #e5e7eb; border: 1px solid #d1d5db; }
.swatch.pto { background: #34d399; border: 1px solid #059669; }
.swatch.past { background: #f3f4f6; border: 1px solid #e5e7eb; color: #9ca3af; }

/* Calendar grid — 4 columns x 3 rows */
#calendar-section {
  margin-bottom: 1.5rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.month-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.month-card h3 {
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 0.5rem;
  color: #374151;
  font-weight: 700;
}

.month-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 0.75rem;
  text-align: center;
}

.month-days .day-header {
  font-weight: 700;
  color: #6b7280;
  padding: 2px 0;
  font-size: 0.65rem;
}

.month-days .day {
  padding: 3px 1px;
  border-radius: 3px;
  cursor: default;
  line-height: 1.4;
  font-weight: 500;
  position: relative;
}
.month-days .day.empty { visibility: hidden; }

/* Tooltip on hover — shows holiday name */
.month-days .day[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 400;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}
.month-days .day[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  border: 4px solid transparent;
  border-top-color: #1f2937;
  z-index: 10;
  pointer-events: none;
}

/* Hover highlight on holiday/pto cells */
.month-days .day.holiday:hover {
  outline: 2px solid #d97706;
  cursor: help;
}
.month-days .day.regional:hover {
  outline: 2px solid #d97706;
  cursor: help;
}
.month-days .day.pto:hover {
  outline: 2px solid #059669;
  cursor: help;
}

/* Today — bold red box */
.month-days .day.today {
  background: white;
  color: #dc2626;
  font-weight: 700;
  border: 2px solid #dc2626;
  border-radius: 3px;
}

/* Holidays — warm yellow/amber (national) */
.month-days .day.holiday {
  background: #fbbf24;
  color: #78350f;
  font-weight: 700;
}

/* Regional holidays — light yellow */
.month-days .day.regional {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

/* Weekends — subtle grey */
.month-days .day.weekend {
  background: #e5e7eb;
  color: #6b7280;
}

/* PTO recommendations — bright green */
.month-days .day.pto {
  background: #34d399;
  color: #064e3b;
  font-weight: 700;
}

/* Past days — faded */
.month-days .day.past {
  color: #d1d5db;
}

/* Holidays list table */
#holidays-list-section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}
#holidays-list-section h2 { margin-bottom: 1rem; font-size: 1.25rem; }

.holidays-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.holidays-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #e5e7eb;
  color: #555;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.holidays-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #f3f4f6; }
.holidays-table .holiday-row.past td { color: #9ca3af; }
.holidays-table .h-date { font-weight: 600; white-space: nowrap; }
.holidays-table .h-day { color: #666; white-space: nowrap; }
.holidays-table .h-name { font-weight: 500; }
.no-holidays { color: #666; font-style: italic; }

.hidden { display: none; }

/* Results sections */
#results section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}

#results h2 { margin-bottom: 1rem; font-size: 1.25rem; }
#summary-text { font-size: 1.1rem; font-weight: 600; color: #2563eb; }

/* Recommendations list */
#recommendations-list { list-style: none; }
#recommendations-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
#recommendations-list li:last-child { border-bottom: none; }
.rec-date { font-weight: 600; white-space: nowrap; }
.rec-reason { color: #666; font-size: 0.9rem; text-align: right; }

/* Deals grid */
.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.deal-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.deal-card .destination { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.25rem; }
.deal-card .dates { color: #666; font-size: 0.85rem; margin-bottom: 0.5rem; }
.deal-card .partner { color: #666; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.deal-card .discount { color: #059669; font-weight: 700; font-size: 1.2rem; margin: 0.5rem 0; }
.deal-card .coupon-code {
  background: #f3f4f6;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  display: inline-block;
  margin: 0.5rem 0;
}
.deal-card .actions { display: flex; gap: 0.5rem; justify-content: center; margin-top: 0.75rem; }
.deal-card .btn-copy, .deal-card .btn-book {
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  font-weight: 600;
}
.deal-card .btn-copy { background: #e5e7eb; color: #333; }
.deal-card .btn-book { background: #059669; color: white; text-decoration: none; }
.deal-card .btn-book:hover { background: #047857; }

/* Share button */
.share-row { text-align: center; margin-top: 1rem; }
#share-btn {
  background: #7c3aed;
  color: white;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}
#share-btn:hover { background: #6d28d9; }

/* Loading */
#loading { text-align: center; padding: 2rem; color: #666; }

/* Error */
#error { background: #fef2f2; border: 1px solid #fecaca; padding: 1rem; border-radius: 8px; margin-top: 1rem; }
#error-text { color: #dc2626; }

/* Responsive */
@media (max-width: 900px) {
  .calendar-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
  form { flex-direction: column; align-items: stretch; }
  .legend { gap: 0.75rem; }
}
@media (max-width: 400px) {
  .calendar-grid { grid-template-columns: 1fr; }
}
