/* Senti Vini Aktions-Kalender — Layout */

/* Toolbar */
.sv-cal-toolbar {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.sv-cal-year-nav { display: flex; align-items: center; gap: 8px; }
.sv-cal-year {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -.4px;
  margin: 0;
  min-width: 90px;
  text-align: center;
  color: var(--sv-navy);
}
.sv-cal-view-switch { display: flex; gap: 4px; padding: 4px; background: var(--sv-surface); border: 1px solid var(--sv-line); border-radius: 2px; }
.sv-view-btn { padding: 6px 14px; font-size: 13px; border: 0; }
.sv-view-btn.active { background: var(--sv-navy); color: #fff; }
.sv-view-btn:not(.active) { background: transparent; color: var(--sv-ink-2); }
.sv-cal-actions-right { margin-left: auto; }

/* Legende */
.sv-cal-legend {
  display: flex; gap: 18px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--sv-gray-500);
  margin-bottom: 16px;
}
.sv-cal-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.sv-cal-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
}

/* Workflow-Typ-Farben (auch im Grid + Liste verwendet) */
.sv-cal-dot[data-type="hausmesse"]      { background: #d94a3a; }
.sv-cal-dot[data-type="weekend_sale"]   { background: #c6a15b; }
.sv-cal-dot[data-type="angebot_monat"]  { background: #2e5373; }
.sv-cal-dot[data-type="kellerei_monat"] { background: #1e3039; }
.sv-cal-dot[data-type="wein_woche"]     { background: #3f6b4a; }
.sv-cal-dot[data-type="sonstige"]       { background: #9aa1a5; }

/* Kalender-Grid: 12 Monate als responsive Cards */
.sv-cal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}
.sv-cal-month {
  background: var(--sv-surface);
  border: 1px solid var(--sv-line);
  border-radius: 2px;
  padding: 16px 16px 12px;
  display: flex; flex-direction: column;
}
.sv-cal-month-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--sv-line-2);
  padding-bottom: 8px;
}
.sv-cal-month-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -.2px;
  color: var(--sv-ink);
  margin: 0;
}
.sv-cal-month-name em { font-style: italic; color: var(--sv-navy); }
.sv-cal-month-actcount {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--sv-gray-500);
}

/* Tabelle Mo-So */
.sv-cal-month-table {
  display: grid;
  grid-template-columns: 28px repeat(7, minmax(0, 1fr));
  gap: 2px;
  font-size: 11.5px;
}
.sv-cal-day-header {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--sv-gray-500);
  padding: 4px 0;
  background: var(--sv-paper);
}
.sv-cal-week-label {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .5px;
  color: var(--sv-gray-400);
  padding: 2px 0;
}
.sv-cal-cell {
  position: relative;
  min-height: 60px;
  min-width: 0;          /* kritisch fuer grid 1fr-Spalten */
  background: var(--sv-paper);
  padding: 3px 4px;
  display: flex; flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.sv-cal-cell.in-month { background: #fff; }
.sv-cal-cell.is-today { background: var(--sv-navy-50); }
.sv-cal-cell.is-weekend.in-month { background: var(--sv-surface-soft); }
.sv-cal-cell:hover { outline: 1px solid var(--sv-navy); z-index: 1; }
.sv-cal-cell-day {
  font-size: 10px;
  font-weight: 600;
  color: var(--sv-gray-500);
  align-self: flex-end;
}
.sv-cal-cell.is-today .sv-cal-cell-day { color: var(--sv-navy); }
.sv-cal-cell:not(.in-month) .sv-cal-cell-day { color: var(--sv-gray-300); }

/* Aktions-Pille — als separater Grid-Child mit grid-column-span ueber
   die Tage der Aktion. Liegt im Grid in der Wochenzeile am unteren Rand,
   so dass die Tag-Zahl oben in der Zelle weiterhin sichtbar bleibt. */
.sv-cal-pill {
  display: block;
  font-size: 10px;
  line-height: 14px;
  height: 14px;
  padding: 0 6px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  font-weight: 600;
  color: #fff;
  border-left: 2px solid rgba(0, 0, 0, .15);
  box-sizing: border-box;
  align-self: end;
  margin: 0 1px 2px 1px;
  z-index: 2;
  pointer-events: auto;
}
.sv-cal-pill:hover { filter: brightness(1.1); }
.sv-cal-pill[data-type="hausmesse"]      { background: #d94a3a; }
.sv-cal-pill[data-type="weekend_sale"]   { background: #c6a15b; color: var(--sv-ink); }
.sv-cal-pill[data-type="angebot_monat"]  { background: #2e5373; }
.sv-cal-pill[data-type="kellerei_monat"] { background: var(--sv-navy); }
.sv-cal-pill[data-type="wein_woche"]     { background: var(--sv-green); }
.sv-cal-pill[data-type="sonstige"]       { background: var(--sv-gray-500); }

/* Status-Indikator */
.sv-cal-pill.is-archived { opacity: .55; }
.sv-cal-pill.is-live { box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px currentColor; }

/* Liste / Tabelle */
.sv-list-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 2px;
  font-weight: 500;
  color: #fff;
}
.sv-list-pill[data-type="hausmesse"]      { background: #d94a3a; }
.sv-list-pill[data-type="weekend_sale"]   { background: #c6a15b; color: var(--sv-ink); }
.sv-list-pill[data-type="angebot_monat"]  { background: #2e5373; }
.sv-list-pill[data-type="kellerei_monat"] { background: var(--sv-navy); }
.sv-list-pill[data-type="wein_woche"]     { background: var(--sv-green); }
.sv-list-pill[data-type="sonstige"]       { background: var(--sv-gray-500); }

/* Status-Chip in der Liste */
.sv-chip.s-geplant      { background: var(--sv-paper-2); color: var(--sv-gray-700); }
.sv-chip.s-scharf       { background: #fdeedd; color: var(--sv-amber); }
.sv-chip.s-live         { background: #e6f1ea; color: var(--sv-green); }
.sv-chip.s-aufzuräumen  { background: var(--sv-red-50); color: var(--sv-red-600); }
.sv-chip.s-archiviert   { background: var(--sv-paper-2); color: var(--sv-gray-500); }

/* Search-Results-Dropdown (Wein-Auswahl) */
.sv-search-results {
  background: #fff;
  border: 1px solid var(--sv-line);
  border-radius: 2px;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 4px;
}
.sv-search-results:empty { display: none; }
.sv-search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex; gap: 10px; align-items: center;
  font-size: 13px;
  border-bottom: 1px solid var(--sv-line-2);
}
.sv-search-result-item:last-child { border-bottom: 0; }
.sv-search-result-item:hover { background: var(--sv-paper); }
.sv-search-result-item .num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--sv-gray-500);
  min-width: 70px;
}

@media (max-width: 720px) {
  .sv-cal-toolbar { gap: 10px; }
  .sv-cal-actions-right { margin-left: 0; width: 100%; }
  .sv-cal-actions-right .sv-btn { width: 100%; }
  .sv-cal-month-table { font-size: 10px; }
  .sv-cal-cell { min-height: 44px; }
}
