:root {
  --bg: #f3efe7;
  --bg-accent: #ebe4d5;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: rgba(255, 249, 240, 0.96);
  --text: #1f241f;
  --muted: #667064;
  --line: rgba(51, 61, 52, 0.1);
  --shadow: 0 24px 80px rgba(64, 53, 37, 0.12);
  --accent: #1f7a64;
  --accent-soft: rgba(31, 122, 100, 0.12);
  --accent-strong: #175c4c;
  --today: #c96f4a;
  --today-soft: rgba(201, 111, 74, 0.15);
  --danger: #c0392b;
  --danger-soft: rgba(192, 57, 43, 0.1);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 28%),
    radial-gradient(circle at bottom right, rgba(205, 187, 145, 0.35), transparent 26%),
    linear-gradient(145deg, var(--bg), var(--bg-accent));
}

button {
  font: inherit;
}

.app-shell {
  padding: 32px;
}

.calendar-app {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.82fr);
  gap: 24px;
  align-items: start;
}

.calendar-panel,
.detail-card {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.calendar-panel {
  padding: 28px;
  border-radius: var(--radius-xl);
}

.panel-header,
.calendar-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.calendar-heading {
  margin: 24px 0 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
.month-label {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  letter-spacing: -0.03em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.8rem;
  line-height: 1.05;
}

h3 {
  font-size: 1.3rem;
  line-height: 1.1;
}

.month-label {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.subtle-copy,
.detail-copy {
  color: var(--muted);
  line-height: 1.5;
}

.calendar-controls {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.nav-button,
.today-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border-radius: 999px;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.nav-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.today-button {
  padding: 0 18px;
  height: 46px;
}

.nav-button:hover,
.today-button:hover,
.day-button:hover {
  transform: translateY(-1px);
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.weekdays {
  margin-bottom: 10px;
}

.weekday {
  padding: 10px 8px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.calendar-grid {
  animation: fade-in 280ms ease;
}

.day-button,
.day-filler {
  min-height: 104px;
  border-radius: var(--radius-md);
}

.day-button {
  position: relative;
  padding: 14px;
  border: 1px solid transparent;
  background: var(--panel-strong);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.day-filler {
  border: 1px dashed rgba(51, 61, 52, 0.08);
  background: rgba(255, 255, 255, 0.24);
}

.day-number {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 1.35rem;
}

.day-meta {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
}

.day-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hookup-count {
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 999px;
  line-height: 1.3;
  letter-spacing: 0;
}

.day-button.is-today {
  border-color: rgba(201, 111, 74, 0.25);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), var(--today-soft));
}

.day-button.is-selected {
  border-color: rgba(31, 122, 100, 0.25);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), var(--accent-soft));
  box-shadow: inset 0 0 0 1px rgba(31, 122, 100, 0.08);
}

.day-button.is-selected .day-meta,
.day-button.is-selected .selection-dot {
  color: var(--accent-strong);
}

.day-button.is-today .selection-dot {
  color: var(--today);
}

.selection-dot {
  font-size: 1.1rem;
  line-height: 1;
}

/* ── Detail panel ──────────────────────────────────────────────────────────── */

.detail-panel {
  display: grid;
  gap: 18px;
}

.detail-card {
  padding: 24px;
  border-radius: var(--radius-lg);
}

/* Date card – log button sits below the date heading */
.date-card h2 {
  margin-bottom: 18px;
}

.log-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.log-button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.log-plus {
  font-size: 1.2rem;
  line-height: 1;
}

/* Hookups card */
.hookups-card .eyebrow {
  margin-bottom: 14px;
}

.empty-state,
.loading-state {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  padding: 8px 0;
}

/* Individual hookup item in side panel */
.hookup-item {
  display: block;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.hookup-item:last-child {
  margin-bottom: 0;
}

.hookup-item:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 122, 100, 0.3);
  box-shadow: 0 4px 16px rgba(31, 122, 100, 0.08);
}

.hookup-item-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.hookup-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.hookup-nationality {
  color: var(--muted);
  font-size: 0.82rem;
}

.hookup-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.hookup-has-photos {
  opacity: 0.7;
}

/* ── Modals ────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 20, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: fade-in 200ms ease;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: 0 32px 96px rgba(20, 24, 20, 0.22);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  animation: modal-in 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.modal-header .eyebrow {
  margin-bottom: 4px;
}

.modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 160ms ease, color 160ms ease;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

/* ── Form ──────────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-bottom: 7px;
}

.required {
  color: var(--today);
}

.form-group input[type="text"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  appearance: none;
}

.form-group input[type="text"]:focus,
.form-group input[type="time"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── Searchable combobox ───────────────────────────────────────────────────── */

.combobox {
  position: relative;
}

.combobox-input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.combobox-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(20, 24, 20, 0.14);
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 224px;
  overflow-y: auto;
  z-index: 1100;
  animation: fade-in 140ms ease;
}

.combobox-list[hidden] {
  display: none;
}

.combobox-option {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
}

.combobox-option:hover,
.combobox-option.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.combobox-empty {
  padding: 9px 12px;
  color: var(--muted);
  font-size: 0.88rem;
  list-style: none;
}

/* File upload */
.file-upload-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px dashed rgba(31, 122, 100, 0.35);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.file-upload-label:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.file-upload-label input[type="file"] {
  display: none;
}

.upload-icon {
  font-size: 1rem;
}

.image-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.preview-image {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* Existing images in edit mode */
.existing-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.existing-image-wrap {
  position: relative;
}

.existing-image-wrap img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
}

.remove-image-btn {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--panel-strong);
  font-size: 0.72rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
  transition: background 120ms ease;
}

.remove-image-btn:hover {
  background: #a93226;
}

/* Form error */
.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
}

.form-error[hidden] {
  display: none;
}

/* Buttons */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.95);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(192, 57, 43, 0.2);
}

.btn-danger:hover {
  background: rgba(192, 57, 43, 0.18);
}

/* ── Detail modal body ─────────────────────────────────────────────────────── */

.detail-modal-body {
  margin-bottom: 4px;
}

.detail-field {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.detail-field:first-child {
  padding-top: 0;
}

.detail-field--column {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.detail-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 80px;
  flex-shrink: 0;
}

.detail-value {
  font-size: 0.96rem;
  color: var(--text);
}

.detail-notes {
  font-size: 0.93rem;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.detail-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.detail-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 160ms ease;
}

.detail-image:hover {
  transform: scale(1.03);
}

/* ── Animations ────────────────────────────────────────────────────────────── */

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .calendar-app {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px;
  }

  .calendar-panel,
  .detail-card {
    padding: 20px;
  }

  .panel-header,
  .calendar-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .calendar-controls {
    width: 100%;
    justify-content: space-between;
  }

  .today-button {
    flex: 1;
  }

  .weekdays,
  .calendar-grid {
    gap: 8px;
  }

  .weekday {
    font-size: 0.72rem;
    padding: 8px 4px;
  }

  .day-button,
  .day-filler {
    min-height: 82px;
  }

  .day-button {
    padding: 10px;
  }

  .day-meta {
    left: 10px;
    right: 10px;
    bottom: 10px;
    font-size: 0.74rem;
  }

  .modal {
    padding: 20px;
    max-height: 95vh;
  }
}
