/* Calendly Year Calendar – calendar.css
   Layout: Month title in its own row, 31 equal day columns beneath it.
   Mobile: each month row is horizontally scrollable (no clipping).
*/

/* Wrapper */
.cyc-wrap {
  max-width: 100%;
  overflow-x: visible; /* month handles horizontal scrolling */
  padding: 8px 0;
}

/* Year tabs */
.cyc-year-tabs {
  display: flex;
  gap: 10px;
  margin: 0 0 14px 0;
  padding: 0 6px;
  flex-wrap: wrap;
}

.cyc-year-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.14);
  text-decoration: none;
  font-weight: 700;
  background: rgba(255,255,255,.95);
}

.cyc-year-tab.is-active {
  border-color: rgba(0,0,0,.28);
  box-shadow: 0 1px 8px rgba(0,0,0,.08);
}

/* Month block – makes the calendar scrollable on mobile */
.cyc-month {
  margin: 0 0 18px 0;
  max-width: 100%;
  overflow-x: auto;                /* <-- key */
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding-bottom: 6px;             /* room for scrollbar on some browsers */
  touch-action: pan-x pan-y;       /* allow horizontal swipe */
}

/* Grid: 31 day columns, rows = month title + day header + lanes */
.cyc-grid {
  --cyc-lanes: 2;
  --cyc-day-col: 36px;     /* <- Tagesbreite (Desktop). Passe hier an */
  --cyc-month-h: 36px;     /* Monatszeile */
  --cyc-header-h: 26px;    /* Tageszahlen */
  --cyc-lane-h: 28px;      /* Höhe pro Event-Lane */

  display: grid; /* <-- important: intrinsic width so parent can scroll */
  width: max-content;      /* behält die „intrinsic“ Breite fürs Scrollen */
  margin: 0 auto;          /* zentriert, wenn genug Platz da ist */
  grid-template-columns: repeat(31, var(--cyc-day-col));
  grid-template-rows: var(--cyc-month-h) var(--cyc-header-h) repeat(var(--cyc-lanes), var(--cyc-lane-h));
  position: relative;

  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

/* Month title (Row 1) */
.cyc-month-title {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-weight: 800;
  background: rgba(0,0,0,.03);
  border-bottom: 1px solid rgba(0,0,0,.10);
  z-index: 5;
}

/* Day column background cells (Rows 2..end) */
.cyc-day-bg {
  background: rgba(0,0,0,.02);
  border-left: 1px solid rgba(0,0,0,.05);
  z-index: 1;
}

.cyc-day-bg.is-weekend {
  background: rgba(0,0,0,.06);
}

.cyc-day-bg.is-invalid {
  background: rgba(0,0,0,.015);
}

/* Day numbers (Row 2) */
.cyc-day-hdr {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(0,0,0,.72);
  z-index: 3;
  border-left: 1px solid rgba(0,0,0,.05);
}

/* Hide invalid day numbers (e.g. 31 in April) */
.cyc-day-hdr.is-invalid {
  color: transparent;
}

/* Event bars */
.cyc-event {
  z-index: 6;
  align-self: center;
  height: calc(var(--cyc-lane-h) - 6px);
  margin: 3px 3px;
  border-radius: 999px;

  background: rgba(0, 107, 255, .14); /* default; overridden inline when color exists */
  border: 1px solid rgba(0, 107, 255, .28);
  box-shadow: 0 1px 8px rgba(0,0,0,.06);

  text-decoration: none;
  display: flex;
  align-items: center;
  overflow: hidden;

  transition: transform .08s ease, box-shadow .08s ease;
}

.cyc-event:hover {
  box-shadow: 0 2px 14px rgba(0,0,0,.12);
  transform: translateY(-1px);
}

.cyc-event-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(0,0,0,.82);
  padding: 0 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Topbar: alles exakt auf einer Linie */
.cyc-topbar{
  align-items:center;             /* bleibt */
}

/* Tabs + Filter-Button gleiche Höhe geben */
.cyc-year-tab,
.cyc-filter-btn{
  height: 44px;                   /* einheitliche Höhe */
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

/* gleiche vertikale Innenabstände (falls deine Tabs andere Padding haben) */
.cyc-year-tab{
  padding: 0 16px;
}
.cyc-filter-btn{
  padding: 0 16px;
}

/* Swatch minimal nach unten korrigieren, falls er "zieht" */
.cyc-filter-btn .cyc-swatch{
  position: relative;
  top: 0;                         /* ggf. 1px, wenn noch nötig */
}

.cyc-year-tab,
.cyc-filter-btn{
  line-height: 1;
}

/* Topbar sauber ausrichten */
.cyc-topbar{
  align-items:center;
}

/* Beide Gruppen als Flex, damit nichts "baseline" spielt */
.cyc-year-tabs{
  display:flex;
  align-items:center;
  gap:12px;
}
.cyc-filter{
  display:flex;
  align-items:center;
  margin:0;
}

/* Tabs + Filter exakt gleiche Höhe */
.cyc-year-tab,
.cyc-filter-btn{
  height:44px;
  display:inline-flex;
  align-items:center;
  box-sizing:border-box;
  padding:0 18px;      /* gleiche horizontale Polsterung */
  line-height:1;       /* verhindert vertikale Font-Abweichungen */
  margin:0;
}

/* falls dein Theme bei <a> eine andere line-height reinbringt */
.cyc-year-tab{
  text-decoration:none;
}

/* Swatch zieht manchmal optisch – minimal stabilisieren */
.cyc-filter-btn .cyc-swatch{
  flex:0 0 auto;
}

/* HARD OVERRIDE: Topbar Alignment */
.cyc-topbar{
  align-items:center !important;
}

.cyc-year-tabs{
  display:flex !important;
  align-items:center !important;
  gap:12px !important;
}

.cyc-filter{
  display:flex !important;
  align-items:center !important;
  margin:0 !important;
  padding:0 !important;
}

/* Tabs + Filter exakt gleiche Höhe und Baseline killen */
.cyc-year-tab,
.cyc-filter-btn{
  height:44px !important;
  min-height:44px !important;

  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;

  box-sizing:border-box !important;
  padding:0 18px !important;

  line-height:44px !important;   /* wichtig: zwingt gleiche Textbaseline */
  margin:0 !important;
  vertical-align:middle !important;
}

/* Falls Theme bei <a> top/bottom padding rein drückt */
.cyc-year-tab{
  padding-top:0 !important;
  padding-bottom:0 !important;
}

/* Swatch stabil */
.cyc-filter-btn .cyc-swatch{
  display:inline-block !important;
  margin:-1px !important;
}



/* Fix: Tabs hatten früher margin-bottom, das verschiebt jetzt den Dropdown nach unten */
.cyc-topbar{
  margin: 0 0 14px 0 !important;
  align-items: center !important;
}

.cyc-topbar .cyc-year-tabs{
  margin: 0 !important;      /* <- das ist der Haupt-Fix */
  padding: 0 !important;
  align-items: center !important;
}

.cyc-topbar .cyc-filter{
  margin: 0 !important;
  align-items: center !important;
}

/* Kalender wie normale Seitencontainer zentrieren */
.cyc-wrap{
  max-width: 1200px;   /* ggf. 1140/1240 je nach Theme */
  margin-left: auto;
  margin-right: auto;
}

/* verhindert 100vw-Offset durch volle Breite */
.cyc-wrap{
  width: 100%;
  box-sizing: border-box;
  padding-left: 15px;
  padding-right: 15px;
}

/* Topbar soll die gleiche (intrinsic) Breite wie der Kalender haben */
.cyc-topbar{
  width: max-content;
  margin: 0 auto 14px auto;   /* zentriert + Abstand nach unten */
}

/* damit es auf Mobile nicht aus dem Viewport läuft, bleibt sie scrollbar wie die Monate */
.cyc-wrap{
  overflow-x: auto;
}

.cyc-topbar{
  width: max-content;
  margin: 0 auto 14px auto;
}

/* 1) Eine Quelle der Wahrheit für die Tagesbreite */
.cyc-wrap{
  --cyc-day-col: 36px; /* MUSS zum Grid passen */
  --cyc-grid-width: calc(31 * var(--cyc-day-col) + 2px); /* +2px für 1px Border links/rechts */
}

/* 2) Kalender bleibt zentriert (hast du schon) */
.cyc-grid{
  margin: 0 auto;
}

/* 3) Topbar-Inhalt an die linke Kalenderkante schieben */
.cyc-topbar{
  width: 100%;
  box-sizing: border-box;
  justify-content: flex-start;

  /* Padding entspricht dem Zentrier-Offset des Kalenders */
  padding-left: clamp(0px, calc((100% - var(--cyc-grid-width)) / 2), 9999px);
  padding-right: clamp(0px, calc((100% - var(--cyc-grid-width)) / 2), 9999px);
}

/* Responsive tweaks */
@media (max-width: 1024px) {
  .cyc-grid { --cyc-day-col: 32px; }
}

@media (max-width: 768px) {
  .cyc-grid {
    --cyc-day-col: 26px;
    --cyc-month-h: 34px;
    --cyc-lane-h: 26px;
  }
  .cyc-year-tabs { padding: 0 2px; }
}


/* -------------------------------------------------------
   View toggle + List view (Agenda)
-------------------------------------------------------- */

.cyc-topbar-left{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

/* Toggle rechts wie im Screenshot */
.cyc-view-toggle{
  margin-left:auto;
  display:inline-flex;
  align-items:stretch;
  border:1px solid rgba(0,0,0,.14);
  border-radius:999px;
  overflow:hidden;
  background:rgba(255,255,255,.95);
}

.cyc-view-btn{
  height:44px;
  padding:0 18px;
  border:0;
  background:transparent;
  cursor:pointer;
  font-weight:800;
  line-height:44px;
  color: rgba(0,0,0,.78);
}

.cyc-view-btn.is-active{
  background: rgba(0,0,0,.18);
  color: rgba(0,0,0,.92);
}

.cyc-view-btn:focus{
  outline:2px solid rgba(0,0,0,.25);
  outline-offset:-2px;
}

.cyc-wrap[data-view="calendar"] .cyc-view-list{ display:none; }
.cyc-wrap[data-view="calendar"] .cyc-view-calendar{ display:block; }
.cyc-wrap[data-view="list"] .cyc-view-calendar{ display:none; }
.cyc-wrap[data-view="list"] .cyc-view-list{ display:block; }

/* List months */
.cyc-view-list .cyc-month{
  overflow-x: visible;   /* keine horizontale Scrollbar in der Liste */
  padding-bottom: 0;
}

.cyc-list-box{
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.cyc-list-rows{
  padding: 8px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}

.cyc-view-list .cyc-event{
  width:100%;
  margin:0;
  height: 40px;
  align-self: stretch;
  gap: 10px;
}

.cyc-list-date{
  flex: 0 0 150px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(0,0,0,.82);
  padding-left: 8px;
  white-space: nowrap;
}

.cyc-list-title{
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: rgba(0,0,0,.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cyc-list-time{
  flex: 0 0 92px;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  color: rgba(0,0,0,.70);
  padding-right: 10px;
  white-space: nowrap;
}

/* Filter in der Topbar ganz nach rechts schieben */
.cyc-topbar .cyc-filter {
  margin-left: auto;
}

/* Falls der Filter-Button selbst zu breit wirkt: optional */
.cyc-topbar .cyc-filter-btn {
  justify-content: flex-start;
}

/* Dropdown rechts am Filter-Button ausrichten */
.cyc-topbar .cyc-filter-menu {
  left: auto !important;
  right: 0 !important;
}


/* Topbar muss volle Breite haben, sonst kann nichts nach rechts wandern */
.cyc-topbar{
  width: 100% !important;
  display: flex !important;
}

/* Filter-Block ganz nach rechts schieben (muss !important sein, weil du margin:0 !important hast) */
.cyc-topbar .cyc-filter{
  margin-left: auto !important;
}

/* Dropdown-Menü rechts am Button andocken */
.cyc-topbar .cyc-filter-menu{
  left: auto !important;
  right: 0 !important;
}


@media (max-width: 640px) {
  .cyc-list-date{ flex-basis: 118px; }
  .cyc-list-time{ flex-basis: 76px; }
  .cyc-view-btn{ padding: 0 14px; }
}


/* -------------------------------------------------------
   Short-Event Label Extension (1-2 Tage) – Kalenderansicht
   - Label darf bis Monatsende laufen (bis vor nächsten Termin in Lane)
   - Dezente Hinterlegung im Überhang
-------------------------------------------------------- */
.cyc-view-calendar .cyc-event.cyc-short-label{
  overflow: visible;
  position: relative;
}

.cyc-view-calendar .cyc-event.cyc-short-label::before{
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;

  /* Startet am rechten Rand des „echten“ Events (leicht überlappend) */
  left: calc(100% - 10px);
  width: calc(var(--cyc-label-extra, 0px) + 10px);

  background: rgba(255,255,255,.50);
  border: 1px solid rgba(0,0,0,.06);
  border-left: 0;

  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;

  z-index: 0;
  pointer-events: none;
}

.cyc-view-calendar .cyc-event.cyc-short-label .cyc-event-label{
  position: relative;
  z-index: 1;

  /* darf breiter als der Event-Balken sein */
  flex: 0 0 auto;
  display: block;
}

/* -------------------------------------------------------
   Kalender-Ansicht: Label NIE abschneiden.
   Stattdessen dürfen Labels über die "echte" Dauer hinausragen
   und der nachfolgende Termin bekommt per JS eine neue Lane.
-------------------------------------------------------- */
.cyc-view-calendar .cyc-event{
  overflow: visible; /* erlaubt Label-Überhang */
}

.cyc-view-calendar .cyc-event-label{
  overflow: visible;
  text-overflow: clip;
  /* flex item soll nicht schrumpfen -> volle Textbreite */
  flex: 0 0 auto;
  display: block;
}

/* optional: Grid darf Überhang zeigen (sonst wird am Monatsrand ggf. geclippt) */
.cyc-view-calendar .cyc-grid{
  overflow: visible;
}
