/* ============================================================
   CARO Einsatzplanung – Stylesheet
   Gemäss Corporate Identity / Corporate Design Manual CARO v1.0
   Primärfarben:   Salbei #7FAF9C | Tiefgrün #2F4F46
   Sekundärfarben: Sand #E6D8C9 | Crème #F5F2EC | Blaugrau #6E8FA3 | Taubengrau #E8EEF1
   Funktionsfarbe: Terracotta #C27A5A
   Schrift:        Source Sans 3
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600;700&display=swap');

:root {
  --salbei:          #7FAF9C;
  --salbei-light:    #e8f3ef;
  --tiefgruen:       #2F4F46;
  --tiefgruen-dark:  #223b34;
  --sand:            #E6D8C9;
  --creme:           #F5F2EC;
  --blaugrau:        #6E8FA3;
  --taubengrau:      #E8EEF1;
  --terracotta:      #C27A5A;
  --terracotta-bg:   #f8ece6;
  --primary:         #2F4F46;
  --primary-dark:    #223b34;
  --primary-light:   #e8f3ef;
  --accent:          #7FAF9C;
  --success:         #7FAF9C;
  --success-bg:      #e8f3ef;
  --success-text:    #2F4F46;
  --warning:         #C27A5A;
  --warning-bg:      #f8ece6;
  --danger:          #9b3a2a;
  --danger-bg:       #fbeae7;
  --bg:              #F5F2EC;
  --card:            #ffffff;
  --border:          #E6D8C9;
  --text:            #2F4F46;
  --text-muted:      #6b7f78;
  --shadow:          0 2px 16px rgba(47,79,70,.07);
  --radius:          12px;
  --radius-lg:       18px;
  --radius-btn:      50px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: 'Source Sans 3', Tahoma, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; line-height: 1.3; color: var(--tiefgruen); }

/* ── Navbar ── */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--sand);
  padding: .7rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 1rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: .9rem;
  text-decoration: none;
}
.navbar-brand img { height: 36px; width: auto; }
.navbar-divider { width: 1px; height: 26px; background: var(--sand); }
.navbar-subtitle { font-size: .8rem; color: var(--text-muted); font-weight: 400; }
.navbar-user { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.user-badge { font-size: .85rem; color: var(--text-muted); display: flex; align-items: center; gap: .35rem; }
.badge-admin {
  background: var(--tiefgruen); color: #fff; border-radius: 4px;
  font-size: .65rem; padding: .1rem .4rem; font-weight: 700; letter-spacing: .04em;
}

/* ── Main Content ── */
.main-content { max-width: 1300px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ── Week Navigation ── */
.week-nav {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: var(--radius-lg); padding: 1rem 1.5rem;
  margin-bottom: 1.25rem; box-shadow: var(--shadow); flex-wrap: wrap; gap: .75rem;
  border: 1px solid var(--sand);
}
.week-title { display: flex; flex-direction: column; align-items: center; text-align: center; }
.week-title strong { font-size: 1rem; color: var(--tiefgruen); font-weight: 700; }
.week-title span { font-size: .82rem; color: var(--text-muted); }

/* ── Legend ── */
.legend {
  display: flex; align-items: center; gap: 1.25rem; font-size: .82rem;
  color: var(--text-muted); margin-bottom: 1.25rem; flex-wrap: wrap;
  padding: .6rem 1rem; background: var(--card);
  border-radius: var(--radius); border: 1px solid var(--sand);
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-green  { background: var(--salbei); }
.dot-orange { background: var(--terracotta); }
.dot-red    { background: #b84a38; }

/* ── Calendar Grid ── */
.calendar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }

/* ── Day Column ── */
.day-column { display: flex; flex-direction: column; gap: .75rem; }

.day-header {
  background: var(--card); border-radius: var(--radius); padding: .85rem 1rem;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: .5rem;
  border: 1px solid var(--sand); border-left: 4px solid var(--sand);
}
.day-today .day-header {
  border-left-color: var(--salbei); background: var(--salbei-light); border-color: var(--salbei);
}
.day-past .day-header { opacity: .6; }
.day-name { font-weight: 700; font-size: .95rem; color: var(--tiefgruen); }
.day-date { font-size: .8rem; color: var(--text-muted); }
.today-badge {
  margin-left: auto; background: var(--tiefgruen); color: #fff;
  border-radius: 50px; font-size: .68rem; padding: .15rem .6rem; font-weight: 700;
}

/* ── Slot Card ── */
.slot-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; border: 1px solid var(--sand); transition: box-shadow .2s, border-color .2s;
}
.slot-card:hover { box-shadow: 0 4px 24px rgba(47,79,70,.12); border-color: var(--salbei); }

.slot-header {
  padding: .7rem 1rem; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--taubengrau); background: #fafaf8;
}
.slot-info { display: flex; flex-direction: column; }
.slot-name { font-weight: 700; font-size: .88rem; color: var(--tiefgruen); }
.slot-time { font-size: .75rem; color: var(--text-muted); }

.coverage { font-size: .82rem; font-weight: 700; padding: .2rem .65rem; border-radius: 50px; }
.status-green  { background: var(--salbei-light); color: var(--tiefgruen); }
.status-orange { background: var(--terracotta-bg); color: var(--terracotta); }
.status-red    { background: var(--danger-bg); color: var(--danger); }

.coord-list {
  padding: .75rem 1rem; min-height: 52px; display: flex; flex-direction: column; gap: .35rem;
}
.coord-chip {
  display: flex; align-items: center; gap: .45rem; font-size: .83rem;
  color: var(--tiefgruen); padding: .25rem .6rem; border-radius: 50px; background: var(--taubengrau);
}
.coord-self {
  background: var(--salbei-light); color: var(--tiefgruen);
  font-weight: 600; border: 1px solid var(--salbei);
}
.coord-avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--tiefgruen);
  color: #fff; font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.coord-self .coord-avatar { background: var(--salbei); color: var(--tiefgruen); }
.no-coords { font-size: .8rem; color: var(--text-muted); font-style: italic; padding: .1rem 0; }

.slot-actions {
  padding: .65rem 1rem; border-top: 1px solid var(--taubengrau); background: #fafaf8;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.4rem; border-radius: var(--radius-btn);
  font-family: 'Source Sans 3', Tahoma, sans-serif; font-size: .9rem; font-weight: 600;
  cursor: pointer; border: none; transition: all .18s; text-decoration: none;
  white-space: nowrap; letter-spacing: .01em;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--tiefgruen); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--tiefgruen-dark); }
.btn-success { background: var(--salbei); color: var(--tiefgruen); width: 100%; font-weight: 700; }
.btn-success:hover { background: #6ba08e; }
.btn-danger { background: transparent; color: var(--terracotta); width: 100%; border: 1.5px solid var(--terracotta); }
.btn-danger:hover { background: var(--terracotta-bg); }
.btn-outline { background: transparent; color: var(--tiefgruen); border: 1.5px solid var(--sand); }
.btn-outline:hover { border-color: var(--tiefgruen); background: var(--salbei-light); }
.btn-link { background: transparent; color: var(--salbei); text-decoration: underline; padding: .4rem; border-radius: 0; }
.btn-sm { padding: .35rem .9rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .82rem; font-weight: 700; color: var(--tiefgruen); margin-bottom: .35rem; }
.form-control {
  width: 100%; padding: .65rem 1rem; border: 1.5px solid var(--sand);
  border-radius: 10px; font-family: 'Source Sans 3', Tahoma, sans-serif;
  font-size: .92rem; color: var(--tiefgruen); background: #fff;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-control:focus { border-color: var(--salbei); box-shadow: 0 0 0 3px rgba(127,175,156,.18); }
textarea.form-control { resize: vertical; }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }

/* ── Cards ── */
.card { background: var(--card); border-radius: var(--radius-lg); padding: 1.75rem; box-shadow: var(--shadow); border: 1px solid var(--sand); }

/* ── Tabs ── */
.tabs { display: flex; gap: .25rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--sand); }
.tab {
  padding: .65rem 1.4rem; font-size: .9rem; font-weight: 600; color: var(--text-muted);
  text-decoration: none; border-radius: 10px 10px 0 0; transition: .15s; border: none; cursor: pointer;
}
.tab:hover { color: var(--tiefgruen); background: var(--salbei-light); }
.tab.active { color: var(--tiefgruen); border-bottom: 2px solid var(--tiefgruen); margin-bottom: -2px; background: var(--salbei-light); }

/* ── Alerts ── */
.alert { padding: .9rem 1.2rem; border-radius: 10px; font-size: .9rem; margin-bottom: 1rem; }
.alert-success { background: var(--salbei-light); color: var(--tiefgruen); border: 1px solid var(--salbei); }
.alert-danger  { background: var(--terracotta-bg); color: var(--terracotta); border: 1px solid #dba890; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 2rem; right: 1.5rem; background: var(--tiefgruen);
  color: #fff; padding: .85rem 1.4rem; border-radius: 50px; font-size: .88rem;
  font-weight: 600; opacity: 0; transform: translateY(12px);
  transition: opacity .25s, transform .25s; z-index: 200; pointer-events: none;
  max-width: 320px; box-shadow: 0 4px 24px rgba(47,79,70,.25);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-success { border-left: 4px solid var(--salbei); }
.toast.toast-error   { border-left: 4px solid var(--terracotta); }

/* ── Loading state ── */
.slot-card.loading { opacity: .6; pointer-events: none; }

/* ── Admin ── */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--creme); color: var(--text-muted); font-weight: 700; text-transform: uppercase; font-size: .72rem; letter-spacing: .06em; padding: .75rem 1rem; text-align: left; }
td { padding: .8rem 1rem; border-bottom: 1px solid var(--taubengrau); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--creme); }
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.day-toggle { background: var(--card); border: 2px solid var(--sand); border-radius: 12px; padding: .75rem 1rem; cursor: pointer; transition: .2s; }
.day-toggle.active { border-color: var(--salbei); background: var(--salbei-light); }
.day-toggle label { cursor: pointer; display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--tiefgruen); }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(47,79,70,.35); z-index: 100; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border-radius: var(--radius-lg); box-shadow: 0 8px 48px rgba(47,79,70,.18); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 2rem; border: 1px solid var(--sand); }
.modal h3 { margin: 0 0 1.5rem; font-size: 1.2rem; color: var(--tiefgruen); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.mono { font-family: monospace; font-size: .88rem; }
.has-pw { color: var(--tiefgruen); font-size: .8rem; font-weight: 600; }
.no-pw  { color: var(--terracotta); font-size: .8rem; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .main-content { padding: 1rem .75rem 3rem; }
  .navbar { padding: .65rem 1rem; }
  .calendar-grid { grid-template-columns: 1fr; }
  .navbar-subtitle { display: none; }
  .navbar-divider { display: none; }
}
@media (min-width: 1100px) {
  .calendar-grid { grid-template-columns: repeat(5, 1fr); }
}
