/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fef9f0;
  --card: #ffffff;
  --text: #3d3535;
  --text-light: #8a7e7e;
  --border: #f0e4d7;
  --primary: #5b9bd5;
  --primary-hover: #4a89c3;
  --danger: #e57373;

  /* Person colors — soft pastels */
  --jt: #7ecbf5;
  --jt-light: #d6effc;
  --katrin: #f5a7c7;
  --katrin-light: #fce0ec;
  --joachim: #f5d88e;
  --joachim-light: #fdf3d7;
  --antonia: #a8d5a2;
  --antonia-light: #dff0dd;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
}

body {
  font-family: 'Quicksand', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.screen { min-height: 100vh; }

/* === Login === */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fef9f0 0%, #e8f4fd 50%, #fce0ec 100%);
}

.bg-fiat {
  position: fixed;
  bottom: -1rem;
  right: -1rem;
  width: 260px;
  opacity: 0.13;
  pointer-events: none;
  z-index: 50;
}

.login-card {
  background: var(--card);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
}

.fiat-hero {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--border);
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px rgba(91,155,213,0.15);
}

.logo-text {
  font-family: 'Pacifico', cursive;
  font-size: 2.2rem;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

input[type="password"],
input[type="text"],
input[type="date"],
input[type="time"] {
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg);
}

input:focus {
  border-color: var(--primary);
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  font-weight: 600;
}

/* === Buttons === */
.btn {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 4px 12px rgba(91,155,213,0.3);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  padding: 0.5rem 1rem;
}
.btn-ghost:hover { color: var(--text); background: var(--border); }

.btn-danger {
  background: var(--danger);
  color: white;
  padding: 0.6rem 1.2rem;
}
.btn-danger:hover { background: #d45555; }

.btn-round {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--border);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.btn-round:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { font-size: 0.85rem; padding: 0.4rem 0.8rem; }

/* === Header === */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--card);
  border-bottom: 2px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.header-fiat {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.logo-text-sm {
  font-family: 'Pacifico', cursive;
  font-size: 1.3rem;
  color: var(--primary);
}

/* === Calendar === */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.calendar-nav h2 {
  font-size: 1.4rem;
  font-weight: 700;
  min-width: 200px;
  text-align: center;
}

.legend {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot-jt { background: var(--jt); }
.dot-katrin { background: var(--katrin); }
.dot-joakim { background: var(--joachim); }
.dot-antonia { background: var(--antonia); }

.calendar-wrapper {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}

.cal-head {
  text-align: center;
  padding: 0.7rem 0;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  min-height: 90px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}

.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: #fdf6ec; }

.cal-day.other-month {
  background: #faf7f2;
}
.cal-day.other-month .day-num {
  color: #ccc;
}

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

.day-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

/* Booking chips */
.booking-chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.1s;
}
.booking-chip:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.chip-jt { background: var(--jt-light); color: #2a7ab5; border-left: 3px solid var(--jt); }
.chip-katrin { background: var(--katrin-light); color: #c44a7a; border-left: 3px solid var(--katrin); }
.chip-joakim { background: var(--joachim-light); color: #b5942a; border-left: 3px solid var(--joachim); }
.chip-antonia { background: var(--antonia-light); color: #4a8a44; border-left: 3px solid var(--antonia); }

/* Multi-day booking bar spans */
.booking-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 22px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.1s;
}
.booking-bar:hover { opacity: 0.85; }

.bar-jt { background: var(--jt); color: #1a5a8a; }
.bar-katrin { background: var(--katrin); color: #8a2a5a; }
.bar-joakim { background: var(--joachim); color: #8a7a1a; }
.bar-antonia { background: var(--antonia); color: #2a6a24; }

.bar-start { border-radius: 6px 0 0 6px; margin-left: 4px; }
.bar-end { border-radius: 0 6px 6px 0; margin-right: 4px; }
.bar-single { border-radius: 6px; margin: 0 4px; }
.bar-mid { border-radius: 0; }

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

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

.modal {
  background: var(--card);
  border-radius: 20px;
  padding: 2rem;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  font-size: 1.3rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.fullday-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  margin-top: 0.2rem;
}
.fullday-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.datetime-row {
  display: flex;
  gap: 0.5rem;
}
.datetime-row input[type="date"] { flex: 1.2; }
.datetime-row input[type="time"] { flex: 0.8; }

.time-input.hidden { display: none; }

.modal label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.3rem;
}

.person-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.person-btn {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
}
.person-btn:hover { border-color: var(--primary); }
.person-btn.selected-jt { background: var(--jt-light); border-color: var(--jt); }
.person-btn.selected-katrin { background: var(--katrin-light); border-color: var(--katrin); }
.person-btn.selected-joakim { background: var(--joachim-light); border-color: var(--joachim); }
.person-btn.selected-antonia { background: var(--antonia-light); border-color: var(--antonia); }

.modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  gap: 0.5rem;
}

/* View mode */
.view-field {
  font-size: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.view-field:last-of-type { border-bottom: none; }

/* === Responsive === */
@media (max-width: 640px) {
  .cal-day { min-height: 70px; padding: 0.2rem; }
  .day-num { font-size: 0.75rem; }
  .booking-chip { font-size: 0.6rem; padding: 1px 4px; }
  .booking-bar { height: 18px; font-size: 0.6rem; }
  .calendar-nav h2 { font-size: 1.1rem; min-width: 160px; }
  header { padding: 0.8rem 1rem; }
  .legend { gap: 0.6rem; }
  .fiat-hero { width: 160px; height: 160px; }
  .bg-fiat { display: none; }
}
