/* ============================================================
   KD Volunteers – Public Styles
   ============================================================ */

/* ── Reset ────────────────────────────────────────────────── */
.kdvol-wrapper *, .kdvol-modal * { box-sizing: border-box; }

/* ── Base ─────────────────────────────────────────────────── */
.kdvol-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a1a2e;
  line-height: 1.5;
}

/* ── Event Card Grid ──────────────────────────────────────── */
.kdvol-event-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.kdvol-event-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .2s, transform .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.kdvol-event-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.kdvol-event-card-title { font-size: 1.1rem; font-weight: 700; }
.kdvol-event-card-date,
.kdvol-event-card-loc   { font-size: .85rem; color: #64748b; }
.kdvol-event-card-desc  { font-size: .88rem; color: #475569; flex: 1; }
.kdvol-event-card-cta   {
  margin-top: 6px;
  display: inline-block;
  background: #3b82f6;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: .83rem;
  font-weight: 600;
  text-align: center;
}
.kdvol-event-card:hover .kdvol-event-card-cta { background: #2563eb; }

/* ── Event Header (2-column when map present) ─────────────── */
.kdvol-event-header {
  margin-bottom: 24px;
}
.kdvol-header-with-map {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
.kdvol-event-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 8px;
}
.kdvol-event-location {
  font-size: .9rem;
  color: #475569;
  margin: 0 0 8px;
}
.kdvol-maps-link {
  color: #3b82f6;
  font-size: .82rem;
  white-space: nowrap;
}
.kdvol-maps-link:hover { text-decoration: underline; }
.kdvol-event-desc {
  font-size: .92rem;
  color: #475569;
  margin: 0;
}

/* ── Map ──────────────────────────────────────────────────── */
.kdvol-header-map {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.kdvol-map-frame {
  display: block;
  width: 100%;
  height: 220px;
  border: none;
}

/* ── Legend ───────────────────────────────────────────────── */
.kdvol-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 9px 14px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: .82rem;
  color: #475569;
}
.kdvol-legend-item { display: flex; align-items: center; gap: 8px; }

/* Mini-bar previews in the legend */
.kdvol-legend-bar {
  display: inline-block;
  width: 38px; height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1.5px solid rgba(0,0,0,.12);
}
.kdvol-lbar-open    { background: #3b82f6; }
.kdvol-lbar-partial {
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,.45) 0px,
      rgba(255,255,255,.45) 3px,
      transparent 3px,
      transparent 7px
    ),
    #3b82f6;
}
.kdvol-lbar-full    { background: #e2e8f0; border-color: #cbd5e1; }

/* ── Day Section ──────────────────────────────────────────── */
.kdvol-day-section  { margin-bottom: 36px; }
.kdvol-day-header   { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.kdvol-day-title    { font-size: 1.05rem; font-weight: 700; margin: 0; }
.kdvol-day-range    { font-size: .82rem; color: #64748b; }

.kdvol-day-label-pub {
  display: inline-block;
  background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  font-size: .68rem; font-weight: 700;
  padding: 2px 9px;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Timeline ─────────────────────────────────────────────── */
.kdvol-timeline     { width: 100%; overflow-x: auto; }

.kdvol-tl-row {
  display: flex;
  align-items: stretch;
  min-width: 520px;
}

.kdvol-tl-label-col {
  width: 130px;
  flex-shrink: 0;
  padding: 0 10px 0 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.kdvol-label-name {
  font-size: .78rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kdvol-label-count      { font-size: .72rem; color: #64748b; }
.kdvol-count-full       { color: #ef4444; font-weight: 700; }

.kdvol-tl-track {
  flex: 1;
  position: relative;
  min-height: 36px;
}

/* ── Time axis ────────────────────────────────────────────── */
.kdvol-tl-axis-row      { margin-bottom: 4px; }
.kdvol-axis-track       { height: 24px; }

.kdvol-axis-tick {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  top: 0;
}
.kdvol-axis-tick span {
  font-size: .7rem;
  color: #94a3b8;
  white-space: nowrap;
  user-select: none;
  line-height: 1.2;
}
.kdvol-axis-tick::after {
  content: '';
  display: block;
  width: 1px;
  height: 6px;
  background: #cbd5e1;
  margin-top: 2px;
}

/* ── Grid lines ───────────────────────────────────────────── */
.kdvol-grid-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: #e2e8f0;
  pointer-events: none;
  z-index: 0;
}

/* ── Position rows ────────────────────────────────────────── */
.kdvol-pos-row {
  margin-bottom: 6px;
}
.kdvol-pos-row .kdvol-tl-track {
  min-height: 40px;
  height: var(--track-h, 40px);
  background: #f8fafc;
  border-radius: 4px;
}

/* ── Position bar ─────────────────────────────────────────── */
.kdvol-pos-bar {
  position: absolute;
  top: 4px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
  overflow: hidden;
  z-index: 1;
  border: 1.5px solid rgba(0,0,0,.1);
  cursor: pointer;
  transition: filter .15s, transform .1s;
  white-space: nowrap;
}
.kdvol-pos-bar:hover {
  filter: brightness(1.08);
  transform: scaleY(1.06);
}

.kdvol-pos-bar.kdvol-pos-full {
  background: #e2e8f0 !important;
  border-color: #cbd5e1;
  cursor: default;
  opacity: .75;
}
.kdvol-pos-bar.kdvol-pos-full:hover {
  filter: none; transform: none;
}
.kdvol-pos-bar.kdvol-pos-partial {
  border-color: rgba(0,0,0,.2);
}

.kdvol-bar-name {
  font-size: .76rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}
.kdvol-bar-time {
  font-size: .68rem;
  color: rgba(255,255,255,.85);
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  flex-shrink: 0;
}
.kdvol-bar-slots {
  font-size: .68rem;
  color: rgba(255,255,255,.9);
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  flex-shrink: 0;
  margin-left: auto;
}
.kdvol-pos-bar.kdvol-pos-full .kdvol-bar-name,
.kdvol-pos-bar.kdvol-pos-full .kdvol-bar-time,
.kdvol-pos-bar.kdvol-pos-full .kdvol-bar-slots {
  color: #64748b;
  text-shadow: none;
}

/* ── Partial-state: diagonal stripe overlay ───────────────── */
.kdvol-pos-bar.kdvol-pos-partial {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255,255,255,.25) 0px,
    rgba(255,255,255,.25) 3px,
    transparent 3px,
    transparent 8px
  ) !important;
}

/* ── Hint line (under each day header) ───────────────────── */
.kdvol-hint {
  font-size: .8rem;
  color: #94a3b8;
  margin: 2px 0 10px;
  padding: 0;
}

/* ── Registration Modal ───────────────────────────────────── */
#kdvol-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#kdvol-modal-overlay.active { display: flex; }

.kdvol-modal {
  background: #fff;
  border-radius: 14px;
  padding: 26px 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  position: relative;
  animation: kdvolSlide .2s ease;
}
@keyframes kdvolSlide {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.kdvol-modal-x {
  position: absolute;
  top: 12px; right: 14px;
  background: none; border: none;
  font-size: 1.3rem; cursor: pointer;
  color: #94a3b8; line-height: 1; padding: 4px;
}
.kdvol-modal-x:hover { color: #475569; }

.kdvol-modal-title-txt    { font-size: 1.1rem; font-weight: 700; margin: 0 0 4px; }
.kdvol-modal-subtitle-txt { font-size: .84rem; color: #64748b; margin: 0 0 18px; min-height: 1em; }

.kdvol-field          { margin-bottom: 13px; }
.kdvol-field label    { display: block; font-size: .82rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.kdvol-field input    {
  width: 100%; padding: 9px 11px;
  border: 1.5px solid #d1d5db; border-radius: 7px;
  font-size: .9rem; outline: none;
  transition: border-color .15s;
}
.kdvol-field input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.kdvol-req { color: #ef4444; }
.kdvol-opt { color: #94a3b8; font-weight: 400; font-size: .78rem; }

.kdvol-privacy {
  font-size: .76rem;
  color: #94a3b8;
  margin: 0 0 14px;
  line-height: 1.4;
}

#kdvol-btn-submit {
  width: 100%; padding: 10px;
  background: #3b82f6; color: #fff;
  border: none; border-radius: 8px;
  font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: background .15s;
}
#kdvol-btn-submit:hover    { background: #2563eb; }
#kdvol-btn-submit:disabled { background: #93c5fd; cursor: default; }

.kdvol-msg-ok {
  background: #d1fae5; color: #065f46;
  border-radius: 7px; padding: 12px;
  font-size: .9rem; text-align: center;
  margin-top: 8px;
}
.kdvol-msg-err {
  background: #fee2e2; color: #b91c1c;
  border-radius: 7px; padding: 9px 12px;
  font-size: .85rem; margin-top: 10px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
  .kdvol-header-with-map {
    grid-template-columns: 1fr;
  }
  .kdvol-map-frame { height: 200px; }
  .kdvol-event-cards { grid-template-columns: 1fr; }
  .kdvol-tl-label-col { width: 90px; }
}

/* ── Remarks textarea ─────────────────────────────────────── */
.kdvol-field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-size: .9rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
  line-height: 1.5;
}
.kdvol-field textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ── Tooltip ──────────────────────────────────────────────── */
.kdvol-tooltip {
  display: none;
  position: fixed;
  z-index: 99998;
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 10px 13px;
  max-width: 240px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  font-size: .82rem;
  line-height: 1.45;
}
.kdvol-tip-name {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.kdvol-tip-time {
  display: block;
  color: #94a3b8;
  font-size: .78rem;
  margin-bottom: 4px;
}
.kdvol-tip-desc {
  display: block;
  color: #cbd5e1;
  font-size: .78rem;
  border-top: 1px solid #334155;
  padding-top: 5px;
  margin-bottom: 5px;
}
.kdvol-tip-status   { display: block; font-size: .78rem; font-weight: 600; }
.kdvol-tip-open     { color: #4ade80; }
.kdvol-tip-full     { color: #f87171; }

/* ── Modal – richer header ────────────────────────────────── */
.kdvol-modal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 0;
  flex-wrap: wrap;
}
.kdvol-modal-time-txt {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -.01em;
}
.kdvol-modal-slots-txt {
  font-size: .82rem;
  background: #dcfce7;
  color: #166534;
  border-radius: 20px;
  padding: 2px 10px;
  font-weight: 600;
}
.kdvol-modal-desc-box {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  border-radius: 0 6px 6px 0;
  padding: 9px 12px;
  margin: 10px 0 16px;
  font-size: .88rem;
  color: #1e40af;
  line-height: 1.5;
}

/* ── Plugin credit line ───────────────────────────────────── */
.kdvol-plugin-credit {
  margin-top: 24px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  font-size: .75rem;
  color: #cbd5e1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.kdvol-plugin-credit a {
  color: #94a3b8;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.kdvol-plugin-credit a:hover { text-decoration: none; opacity: .8; }
.kdvol-credit-logo {
  height: 28px;
  width: auto;
  max-width: 160px;
  vertical-align: middle;
  display: inline-block;
  opacity: .7;
  transition: opacity .15s;
}
.kdvol-plugin-credit a:hover .kdvol-credit-logo { opacity: 1; }

/* ── Junction marker (adjacent bars in same lane) ────────── */
.kdvol-junction-mark {
  position: absolute;
  width: 3px;
  transform: translateX(-1px);
  background: rgba(255,255,255,.9);
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}

/* ── Overlap zone overlay ─────────────────────────────────── */
.kdvol-overlap-zone {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  border-radius: 4px;
  /* Diagonal warning stripes over the overlapping section */
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.55) 0px,
    rgba(255, 255, 255, 0.55) 4px,
    rgba(0, 0, 0, 0.18) 4px,
    rgba(0, 0, 0, 0.18) 8px
  );
  border: 1.5px solid rgba(255,255,255,0.7);
}
/* Small label inside the overlap zone via pseudo-element */
.kdvol-overlap-zone::after {
  content: '⚡';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.4));
}

/* ── Event card logo ──────────────────────────────────────── */
.kdvol-event-card-logo {
  width: 100%;
  height: 120px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kdvol-event-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Announcement card ────────────────────────────────────── */
.kdvol-event-card-announce {
  opacity: .82;
  cursor: default;
  border-style: dashed;
  border-color: #f59e0b;
  background: #fffbeb;
}
.kdvol-event-card-announce:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transform: none;
}
.kdvol-announce-badge {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 6px;
  letter-spacing: .04em;
}
.kdvol-cta-announce {
  background: #d97706 !important;
  opacity: .7;
  cursor: default;
}

/* ── Event website link ───────────────────────────────────── */
.kdvol-event-website { margin: 8px 0 0; }
.kdvol-website-btn {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s;
}
.kdvol-website-btn:hover {
  background: #dbeafe;
  text-decoration: none;
  color: #1e40af;
}
