/* ICS Calendar Bas — Google Calendar UI (pixel-accurate) */

/* =====================
   ROOT / CONTAINER
   ===================== */

.ics-calendar-bas {
  --gcal-blue:           #30999a; /* Kameleon Kinheim teal — override here or via shortcode */
  --gcal-blue-light:     #e6f5f5;
  --gcal-blue-dark:      #249799;
  --gcal-border:         #dadce0;
  --gcal-border-light:   rgba(218,220,224,0.5);
  --gcal-text:           #3c4043;
  --gcal-text-secondary: #70757a;
  --gcal-text-light:     #9aa0a6;
  --gcal-bg:             #ffffff;
  --gcal-bg-alt:         #f8f9fa;
  --gcal-bg-hover:       #f1f3f4;
  --gcal-today-bg:       rgba(26,115,232,0.04);
  --gcal-today-circle:   24px;
  --gcal-red:            #ea4335;
  --gcal-green:          #34a853;
  --gcal-yellow:         #fbbc04;
  --gcal-font:           'Roboto', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --gcal-shadow-card:    0 1px 2px 0 rgba(60,64,67,.30), 0 2px 6px 2px rgba(60,64,67,.15);
  --gcal-shadow-popup:   0 4px 12px rgba(32,33,36,.28);
  --gcal-shadow-btn:     0 1px 2px rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
  --gcal-hour-height:    48px;

  font-family: var(--gcal-font);
  font-size: 14px;
  font-weight: 400;
  color: var(--gcal-text);
  background: var(--gcal-bg);
  border: 1px solid var(--gcal-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--gcal-shadow-card);
  display: flex;
  flex-direction: column;
}

.ics-calendar-bas *,
.ics-calendar-bas *::before,
.ics-calendar-bas *::after {
  box-sizing: border-box;
}

.ics-calendar-bas a {
  text-decoration: none;
  color: var(--gcal-blue);
}
.ics-calendar-bas a:hover { text-decoration: underline; }

/* =====================
   LOADING STATE
   ===================== */

.r34icsbas-ajax-container {
  min-height: 300px;
  position: relative;
}

/* Spinner overlay — centered over the container during AJAX load */
.gcal-loading-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  z-index: 9000;
  min-height: 80px;
}

.gcal-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid #dadce0;
  border-top-color: #30999a;
  border-radius: 50%;
  animation: gcalbas-spin 0.7s linear infinite;
}

@keyframes gcalbas-spin {
  to { transform: rotate(360deg); }
}

/* =====================
   HEADER TOOLBAR
   ===================== */

.gcal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gcal-border);
  background: var(--gcal-bg);
  gap: 8px;
  flex-shrink: 0;
  user-select: none;
  min-height: 56px;
}

.gcal-header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.gcal-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Logo in header */
.gcal-logo {
  display: flex;
  align-items: center;
  margin-right: 4px;
  flex-shrink: 0;
}

.gcal-logo img {
  height: 36px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}

.gcal-title {
  font-size: 22px;
  font-weight: 400;
  color: var(--gcal-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 4px;
  letter-spacing: -0.3px;
  min-width: 0;
  /* button reset + interactive styles */
  background: none;
  border: none;
  font-family: var(--gcal-font);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: background 0.1s;
}
.gcal-title:hover { background: var(--gcal-bg-hover); }
.gcal-title:focus-visible {
  outline: 2px solid var(--gcal-blue);
  outline-offset: 1px;
}
.gcal-title-chevron {
  width: 20px;
  height: 20px;
  fill: currentColor;
  opacity: 0.65;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.gcal-title[aria-expanded="true"] .gcal-title-chevron {
  transform: rotate(180deg);
}

/* Today button */
.gcal-today-btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 15px;
  border: 1px solid var(--gcal-border);
  border-radius: 4px;
  background: var(--gcal-bg);
  color: var(--gcal-text);
  font-size: 14px;
  font-family: var(--gcal-font);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, box-shadow 0.1s;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}
.gcal-today-btn:hover {
  background: var(--gcal-bg-hover);
  box-shadow: var(--gcal-shadow-btn);
}
.gcal-today-btn:focus-visible {
  outline: 2px solid var(--gcal-blue);
  outline-offset: 1px;
}

/* Navigation arrow buttons */
.gcal-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  color: var(--gcal-text-secondary);
  transition: background 0.1s;
  flex-shrink: 0;
}
.gcal-nav-btn:hover {
  background: var(--gcal-bg-hover);
  color: var(--gcal-text);
}
.gcal-nav-btn:focus-visible {
  outline: 2px solid var(--gcal-blue);
  outline-offset: 1px;
}
.gcal-nav-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}

/* View switcher — segmented control */
.gcal-view-switcher {
  display: inline-flex;
  border: 1px solid var(--gcal-border);
  border-radius: 4px;
  overflow: hidden;
}

.gcal-view-btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border: none;
  border-right: 1px solid var(--gcal-border);
  background: var(--gcal-bg);
  color: var(--gcal-text);
  font-size: 14px;
  font-family: var(--gcal-font);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
  letter-spacing: 0.01em;
}
.gcal-view-btn:last-child { border-right: none; }
.gcal-view-btn:hover { background: var(--gcal-bg-hover); }
.gcal-view-btn.active {
  background: var(--gcal-blue-light);
  color: var(--gcal-blue);
}
.gcal-view-btn:focus-visible {
  outline: 2px solid var(--gcal-blue);
  outline-offset: -2px;
}

/* Language toggle */
.gcal-lang-toggle {
  display: inline-flex;
  border: 1px solid var(--gcal-border);
  border-radius: 4px;
  overflow: hidden;
}

.gcal-lang-btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 9px;
  border: none;
  border-right: 1px solid var(--gcal-border);
  background: var(--gcal-bg);
  color: var(--gcal-text-secondary);
  font-size: 11px;
  font-family: var(--gcal-font);
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.1s;
}
.gcal-lang-btn:last-child { border-right: none; }
.gcal-lang-btn:hover { background: var(--gcal-bg-hover); color: var(--gcal-text); }
.gcal-lang-btn.active {
  background: var(--gcal-blue-light);
  color: var(--gcal-blue);
}

/* =====================
   MONTH VIEW
   ===================== */

.gcal-month-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Day-of-week column header */
.gcal-weekday-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--gcal-border);
  background: var(--gcal-bg);
  flex-shrink: 0;
}

.gcal-weekday-label {
  text-align: center;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--gcal-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Month grid */
.gcal-month-container {
  flex: 1;
  overflow: hidden;
}

.gcal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--gcal-border);
  border-top: 1px solid var(--gcal-border);
}

/* Each day cell */
.gcal-day-cell {
  min-height: 112px;
  border-right: 1px solid var(--gcal-border);
  border-bottom: 1px solid var(--gcal-border);
  padding: 4px 2px 2px 4px;
  overflow: hidden;
  cursor: default;
  position: relative;
  transition: background 0.08s;
}

.gcal-day-cell:hover {
  background: var(--gcal-bg-hover);
  cursor: pointer;
}

.gcal-day-cell.other-month {
  background: var(--gcal-bg-alt);
}
.gcal-day-cell.other-month .gcal-day-num {
  color: var(--gcal-text-light);
}

.gcal-day-cell.today {
  background: var(--gcal-today-bg);
}

/* Day number circle */
.gcal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--gcal-today-circle);
  height: var(--gcal-today-circle);
  font-size: 12px;
  font-weight: 400;
  color: var(--gcal-text);
  border-radius: 50%;
  margin-bottom: 2px;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}

.gcal-day-cell.today .gcal-day-num {
  background: var(--gcal-blue);
  color: #ffffff;
  font-weight: 700;
}

/* Event chip — all-day / multiday (filled bar) */
.gcal-event-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 4px;
  margin-bottom: 1px;
  height: 18px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 18px;
  color: #ffffff;
  background: var(--gcal-blue);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: filter 0.1s;
  position: relative;
}
.gcal-event-chip:hover {
  filter: brightness(0.9);
}
.gcal-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Timed event chip (dot + title, no background) */
.gcal-event-chip.timed {
  background: transparent;
  color: var(--gcal-text);
  border-radius: 3px;
  padding: 0 2px;
}
.gcal-event-chip.timed .gcal-chip-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.gcal-event-chip.timed:hover {
  filter: none;
  background: var(--gcal-bg-hover);
}

/* Multi-day spanning chips */
.gcal-event-chip.multiday-first  { border-radius: 3px 0 0 3px; margin-right: 0; }
.gcal-event-chip.multiday-middle { border-radius: 0; margin-left: 0; margin-right: 0; }
.gcal-event-chip.multiday-last   { border-radius: 0 3px 3px 0; margin-left: 0; }

/* Overflow event chips — hidden until "+N meer" is clicked */
.gcal-overflow-chip {
  display: none !important;
}
/* When the cell is expanded, show overflow chips */
.gcal-day-cell.gcal-expanded .gcal-overflow-chip {
  display: flex !important;
}

/* "+N meer/more" link */
.gcal-more-link {
  display: block;
  height: 18px;
  line-height: 18px;
  font-size: 12px;
  color: var(--gcal-text-secondary);
  cursor: pointer;
  padding: 0 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gcal-more-link:hover {
  background: var(--gcal-bg-hover);
  color: var(--gcal-text);
}

/* =====================
   WEEK VIEW
   ===================== */

.gcal-week-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.gcal-week-outer {
  overflow-x: hidden;
  flex: 1;
  position: relative;
}

/* Sticky header */
.gcal-week-header-row {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1px solid var(--gcal-border);
  background: var(--gcal-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.gcal-week-time-gutter-hdr {
  border-right: 1px solid var(--gcal-border);
}

.gcal-week-day-header {
  text-align: center;
  padding: 6px 4px 8px;
  border-right: 1px solid var(--gcal-border);
  cursor: pointer;
}
.gcal-week-day-header:last-child { border-right: none; }

.gcal-week-day-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--gcal-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  line-height: 1.5;
}

.gcal-week-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 20px;
  font-weight: 400;
  color: var(--gcal-text);
  border-radius: 50%;
  margin-top: 2px;
  transition: background 0.1s;
}

.gcal-week-day-header.today .gcal-week-day-name { color: var(--gcal-blue); }
.gcal-week-day-header.today .gcal-week-day-num {
  background: var(--gcal-blue);
  color: #ffffff;
  font-weight: 700;
}

/* All-day row */
.gcal-allday-row {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1px solid var(--gcal-border);
  min-height: 28px;
  background: var(--gcal-bg);
  position: sticky;
  top: 61px; /* height of week-header-row */
  z-index: 9;
}

.gcal-allday-label {
  border-right: 1px solid var(--gcal-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--gcal-text-secondary);
  white-space: nowrap;
}

.gcal-allday-cell {
  border-right: 1px solid var(--gcal-border);
  padding: 2px;
}
.gcal-allday-cell:last-child { border-right: none; }

.gcal-allday-chip {
  display: block;
  height: 18px;
  line-height: 18px;
  font-size: 12px;
  border-radius: 3px;
  padding: 0 4px;
  color: #fff;
  background: var(--gcal-blue);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  margin-bottom: 1px;
}
.gcal-allday-chip:hover { filter: brightness(0.9); }

/* Time grid */
.gcal-week-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  position: relative;
}

.gcal-time-column { /* time labels */ }

.gcal-time-label {
  height: var(--gcal-hour-height);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0 8px;
  font-size: 10px;
  color: var(--gcal-text-secondary);
  border-right: 1px solid var(--gcal-border);
  position: relative;
}
.gcal-time-label span {
  transform: translateY(-7px);
  display: block;
  white-space: nowrap;
}
.gcal-time-label:first-child span { visibility: hidden; } /* hide 00:00 */

/* Day columns */
.gcal-day-column {
  position: relative;
  border-right: 1px solid var(--gcal-border);
}
.gcal-day-column:last-child { border-right: none; }

.gcal-hour-line {
  height: var(--gcal-hour-height);
  border-bottom: 1px solid var(--gcal-border-light);
  position: relative;
}

/* Dashed half-hour line */
.gcal-hour-line::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  border-bottom: 1px dashed var(--gcal-border-light);
}

/* Event blocks in time grid */
.gcal-event-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 4px;
  background: var(--gcal-blue);
  color: #ffffff;
  font-size: 11px;
  line-height: 1.3;
  padding: 3px 5px;
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  transition: filter 0.1s, box-shadow 0.1s;
  min-height: 20px;
}
.gcal-event-block:hover {
  filter: brightness(0.9);
  box-shadow: var(--gcal-shadow-btn);
  z-index: 3;
}
.gcal-event-block-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gcal-event-block-time {
  font-size: 10px;
  opacity: 0.9;
}

/* Current time indicator */
.gcal-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gcal-red);
  z-index: 5;
  pointer-events: none;
}
.gcal-now-line::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gcal-red);
}

/* =====================
   DAY VIEW
   ===================== */

.gcal-day-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.gcal-day-outer {
  overflow-x: hidden;
  flex: 1;
}

.gcal-day-header-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  border-bottom: 1px solid var(--gcal-border);
  background: var(--gcal-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.gcal-day-header-row .gcal-week-time-gutter-hdr { border-right: 1px solid var(--gcal-border); }
.gcal-day-view-header {
  text-align: center;
  padding: 6px 4px 8px;
}

.gcal-day-allday-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  border-bottom: 1px solid var(--gcal-border);
  min-height: 28px;
  background: var(--gcal-bg);
  position: sticky;
  top: 61px;
  z-index: 9;
}
.gcal-day-allday-row .gcal-allday-label { border-right: 1px solid var(--gcal-border); }

.gcal-day-grid {
  display: grid;
  grid-template-columns: 52px 1fr;
  position: relative;
}

/* =====================
   EVENT POPUP
   ===================== */

.gcal-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
}

.gcal-popup {
  position: fixed;
  /* Hardcoded white — CSS var(--gcal-bg) is out of scope when appended to <body> */
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(32, 33, 36, 0.28), 0 1px 3px rgba(32, 33, 36, 0.15);
  z-index: 9999;
  min-width: 300px;
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
  animation: gcalbas-popup-in 0.12s ease-out;
  /* Default: centered on screen */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes gcalbas-popup-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.gcal-popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gcal-text-secondary);
  font-size: 20px;
  line-height: 1;
  transition: background 0.1s;
  z-index: 1;
}
.gcal-popup-close:hover { background: var(--gcal-bg-hover); }

.gcal-popup-header {
  display: flex;
  align-items: flex-start;
  padding: 16px 48px 8px 16px;
  gap: 12px;
}

.gcal-popup-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gcal-blue);
  flex-shrink: 0;
  margin-top: 4px;
}

.gcal-popup-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--gcal-text);
  line-height: 1.4;
  flex: 1;
  word-break: break-word;
}

.gcal-popup-body {
  padding: 0 16px 16px;
}

.gcal-popup-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.gcal-popup-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 0;
  color: var(--gcal-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gcal-popup-icon svg {
  width: 18px;
  height: 18px;
  fill: var(--gcal-text-secondary);
  display: block;
}

.gcal-popup-text {
  font-size: 13px;
  color: var(--gcal-text);
  line-height: 1.5;
  word-break: break-word;
}
.gcal-popup-text a { color: var(--gcal-blue); }
.gcal-popup-text a:hover { text-decoration: underline; }

.gcal-popup-divider {
  height: 1px;
  background: var(--gcal-border);
  margin: 8px 0;
}

/* =====================
   DATE PICKER
   ===================== */

/* Appended to <body> — CSS vars from .ics-calendar-bas are out of scope,
   so all colors are hardcoded to match the Kameleon Kinheim teal theme. */

.gcal-datepicker {
  position: fixed;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(32,33,36,.28), 0 1px 4px rgba(32,33,36,.15);
  z-index: 9997;
  width: 256px;
  padding: 0 6px 10px;
  font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  color: #3c4043;
  animation: gcalbas-popup-in .1s ease-out;
  user-select: none;
}
.gcal-datepicker * { box-sizing: border-box; }

/* Header row with prev/next arrows and title */
.gcal-dp-header {
  display: flex;
  align-items: center;
  padding: 8px 0 4px;
  gap: 0;
}

.gcal-dp-title-btn {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #3c4043;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 4px;
  font-family: inherit;
  transition: background .1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.gcal-dp-title-btn:hover { background: #f1f3f4; }
.gcal-dp-title-btn svg { fill: #70757a; flex-shrink: 0; }

.gcal-dp-nav-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  color: #70757a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .1s;
}
.gcal-dp-nav-btn:hover { background: #f1f3f4; color: #3c4043; }
.gcal-dp-nav-btn svg { width: 18px; height: 18px; fill: currentColor; display: block; }

/* Weekday label row */
.gcal-dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
}
.gcal-dp-weekdays span {
  text-align: center;
  font-size: 11px;
  color: #70757a;
  font-weight: 500;
  line-height: 28px;
}

/* Day buttons grid */
.gcal-dp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.gcal-dp-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: #3c4043;
  font-family: inherit;
  padding: 0;
  transition: background .1s;
}
.gcal-dp-day:hover:not(:disabled):not(.selected) { background: #f1f3f4; }
.gcal-dp-day.other-month { color: #9aa0a6; }
.gcal-dp-day.today { color: #30999a; font-weight: 700; }
.gcal-dp-day.selected {
  background: #30999a;
  color: #ffffff !important;
  font-weight: 700;
}

/* Year selection grid */
.gcal-dp-years {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 4px 0;
}
.gcal-dp-year {
  height: 36px;
  border: none;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: #3c4043;
  font-family: inherit;
  transition: background .1s;
}
.gcal-dp-year:hover:not(.selected) { background: #f1f3f4; }
.gcal-dp-year.today { color: #30999a; font-weight: 700; }
.gcal-dp-year.selected {
  background: #30999a;
  color: #ffffff !important;
  font-weight: 700;
}

/* =====================
   DARK MODE
   ===================== */

.ics-calendar-bas.darkmode {
  --gcal-bg:             #1e1e1e;
  --gcal-bg-alt:         #252525;
  --gcal-bg-hover:       #2d2d2d;
  --gcal-border:         #3c3c3c;
  --gcal-border-light:   rgba(60,60,60,0.6);
  --gcal-text:           #e8eaed;
  --gcal-text-secondary: #9aa0a6;
  --gcal-text-light:     #5f6368;
  --gcal-today-bg:       rgba(26,115,232,0.08);
}

/* =====================
   RESPONSIVE / MOBILE
   ===================== */

/* --- Tablet (≤768px) --- */
@media screen and (max-width: 768px) {
  .gcal-week-day-num {
    font-size: 16px;
    width: 28px;
    height: 28px;
  }
}

/* --- Mobile landscape / small tablet (≤640px) --- */
@media screen and (max-width: 640px) {
  .gcal-title {
    font-size: 15px;
    min-width: 0;
  }
  .gcal-view-btn {
    padding: 0 8px;
    font-size: 12px;
    height: 32px;
  }
  .gcal-today-btn {
    padding: 0 10px;
    font-size: 12px;
    height: 32px;
  }
  .gcal-header {
    padding: 6px 10px;
    min-height: 48px;
    gap: 4px;
  }
  .gcal-event-chip {
    font-size: 10px;
    height: 15px;
    line-height: 15px;
  }
  .gcal-day-cell {
    min-height: 68px;
    padding: 2px 1px 1px 2px;
  }
  .gcal-day-num {
    font-size: 11px;
    width: 20px;
    height: 20px;
    --gcal-today-circle: 20px;
  }
  .gcal-weekday-label {
    font-size: 9px;
    padding: 6px 1px;
    letter-spacing: 0;
  }
  .gcal-lang-toggle { display: none; }
  .gcal-logo img { height: 28px; max-width: 80px; }

  /* Week/Day header */
  .gcal-week-day-num {
    font-size: 14px;
    width: 24px;
    height: 24px;
  }
  .gcal-week-day-name {
    font-size: 9px;
  }

  /* Time grid narrower gutter */
  .gcal-week-header-row,
  .gcal-allday-row,
  .gcal-week-grid {
    grid-template-columns: 36px repeat(7, 1fr);
  }
  .gcal-day-header-row,
  .gcal-day-allday-row,
  .gcal-day-grid {
    grid-template-columns: 36px 1fr;
  }
  .gcal-time-label {
    padding: 0 4px;
    font-size: 9px;
  }
}

/* --- Mobile portrait (≤480px) --- */
@media screen and (max-width: 480px) {
  /* Header wraps: nav row on top, view switcher below */
  .gcal-header { flex-wrap: wrap; }
  .gcal-header-right { gap: 4px; }
  .gcal-title { font-size: 14px; margin: 0 4px; }
  .gcal-nav-btn { width: 30px; height: 30px; }
  .gcal-today-btn { padding: 0 8px; font-size: 11px; height: 28px; }

  /* View switcher: second row, full width */
  .gcal-view-switcher {
    display: inline-flex;
    order: 10;
    width: 100%;
    margin-top: 4px;
  }
  .gcal-view-btn {
    flex: 1;
    justify-content: center;
    height: 28px;
    font-size: 11px;
    padding: 0 4px;
  }

  /* Month: even smaller cells */
  .gcal-day-cell { min-height: 56px; }
  .gcal-day-num  { width: 18px; height: 18px; font-size: 10px; --gcal-today-circle: 18px; }
  .gcal-event-chip { font-size: 9px; height: 14px; line-height: 14px; padding: 0 2px; }
  .gcal-more-link  { font-size: 9px; height: 14px; line-height: 14px; }

  /* Week/day: horizontal scroll for compact mobile layout */
  .gcal-week-outer,
  .gcal-day-outer {
    overflow-x: auto;
  }
  .gcal-week-header-row,
  .gcal-allday-row,
  .gcal-week-grid {
    grid-template-columns: 32px repeat(7, minmax(42px, 1fr));
    min-width: 340px;
  }
  .gcal-day-header-row,
  .gcal-day-allday-row,
  .gcal-day-grid {
    grid-template-columns: 32px 1fr;
  }
  .gcal-time-label  { padding: 0 2px; font-size: 8px; }

  /* Event popup: centered full-width on mobile */
  .gcal-popup {
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    max-width: none;
    min-width: 0;
    border-radius: 12px;
  }
}

/* --- Narrow: title on its own line so it isn't overlapped (≤438px) --- */
@media screen and (max-width: 438px) {
  .gcal-header-left { flex-wrap: wrap; }
  .gcal-title {
    order: 10;
    width: 100%;
    margin: 4px 0 0;
  }
}

/* --- Narrow: view switcher on its own line (≤344px) --- */
@media screen and (max-width: 344px) {
  .gcal-header-right {
    order: 20;
    width: 100%;
    flex-shrink: 1;
  }
  .gcal-view-switcher {
    width: 100%;
    margin-top: 4px;
  }
}

/* --- Very small (≤360px) --- */
@media screen and (max-width: 360px) {
  .gcal-weekday-label { display: none; }
  .gcal-month-grid { border-top: none; }
  .gcal-day-cell { min-height: 48px; }
}

/* =====================
   CALENDAR TITLE
   ===================== */

.ics-calendar-title {
  font-size: 16px;
  font-weight: 500;
  padding: 8px 16px 4px;
  color: var(--gcal-text);
  border-bottom: 1px solid var(--gcal-border-light);
  margin: 0;
}

/* =====================
   LIST & BASIC VIEWS
   ===================== */

.ics-calendar-bas .ics-calendar-select {
  display: none; /* hidden; navigation handled by gcal-header */
}

.ics-calendar-bas .ics-calendar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gcal-text);
  padding: 12px 16px 4px;
  border-top: 1px solid var(--gcal-border);
  margin: 0;
}
.ics-calendar-bas .ics-calendar-label:first-child { border-top: none; }

.ics-calendar-bas dl.events {
  margin: 0;
  padding: 0 16px;
}

.ics-calendar-bas dl.events .event {
  padding: 4px 0;
  border-bottom: 1px solid var(--gcal-border-light);
}

.ics-calendar-bas .event .title {
  font-size: 13px;
  color: var(--gcal-text);
  font-weight: 500;
}

.ics-calendar-bas .descloc {
  font-size: 12px;
  color: var(--gcal-text-secondary);
}

/* =====================
   UTILITY
   ===================== */

.gcal-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}
