/* ===================================================
   EVENT CALENDAR – Frontend Styles
   Wzorowany na screenie (granatowy, zielony, czerwony)
=================================================== */

:root {
  --ec-navy:       #0f2137;
  --ec-navy-light: #1a3356;
  --ec-green:      #2e7d32;
  --ec-green-bg:   #1b5e20;
  --ec-red:        #c62828;
  --ec-red-bg:     #b71c1c;
  --ec-white:      #ffffff;
  --ec-gray-light: #f5f5f5;
  --ec-gray-border:#ddd;
  --ec-today-bg:   #e8f5e9;
  --ec-font:       'Segoe UI', Arial, sans-serif;
  --ec-radius:     4px;
  --ec-shadow:     0 8px 32px rgba(0,0,0,.25);
}

/* ── WRAP ── */
.ec-calendar-wrap {
  font-family: var(--ec-font);
  max-width: 100%;
  overflow-x: auto;
}

/* ── HEADER ── */
.ec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ec-month-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}

.ec-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ec-btn-today,
.ec-btn-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: #888;
  color: #fff;
  border: none;
  border-radius: var(--ec-radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  min-width: 36px;
}
.ec-btn-today:hover,
.ec-btn-nav:hover { background: var(--ec-navy); color: #fff; text-decoration: none; }
.ec-btn-nav { font-size: 1.2rem; padding: 6px 12px; }

/* ── GRID ── */
.ec-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--ec-gray-border);
  border-top:  1px solid var(--ec-gray-border);
}

/* ── DAY HEADERS ── */
.ec-day-header {
  background: var(--ec-navy);
  color: var(--ec-white);
  text-align: right;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 0.85rem;
  border-right: 1px solid var(--ec-navy-light);
  border-bottom: 1px solid var(--ec-navy-light);
  letter-spacing: .03em;
}

/* ── CELLS ── */
.ec-cell {
  min-height: 100px;
  border-right:  1px solid var(--ec-gray-border);
  border-bottom: 1px solid var(--ec-gray-border);
  padding: 4px 2px 4px 4px;
  vertical-align: top;
  position: relative;
  background: #fff;
}

.ec-cell--empty {
  background: var(--ec-gray-light);
}

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

.ec-cell--weekend {
  background: #fafafa;
}

.ec-day-num {
  display: block;
  text-align: right;
  padding: 2px 6px 4px 0;
  font-size: 0.85rem;
  color: #555;
  line-height: 1;
}

.ec-cell--today .ec-day-num {
  color: var(--ec-navy);
  font-weight: 700;
}

/* ── EVENT PILLS ── */
.ec-event-pill {
  display: block;
  margin: 2px 0;
  padding: 4px 6px;
  border-radius: var(--ec-radius);
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  line-height: 1.3;
  word-break: break-word;
  transition: filter .15s, transform .1s;
  user-select: none;
}
.ec-event-pill:hover {
  filter: brightness(1.15);
  transform: scale(1.01);
}

.ec-event-pill--green  { background: var(--ec-green-bg); }
.ec-event-pill--red    { background: var(--ec-red-bg); }
.ec-event-pill--navy   { background: var(--ec-navy); }

/* Multi-day pill spans full row – handled inline via grid-column */
.ec-event-pill--multiday {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ec-event-pill--continuation {
  opacity: 0;   /* invisible filler – maintains space */
  pointer-events: none;
}

/* ── LEGEND ── */
.ec-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  font-size: 0.82rem;
  color: #333;
  align-items: center;
}

.ec-legend strong { margin-right: 4px; }

.ec-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ec-legend-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}
.ec-legend-dot--green { background: var(--ec-green-bg); }
.ec-legend-dot--red   { background: var(--ec-red-bg); }

.ec-legend-icon { font-size: 1rem; }

/* ───────────────────────────────────────────
   MODAL
─────────────────────────────────────────── */
.ec-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9998;
}

.ec-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  background: #fff;
  border-radius: 6px;
  box-shadow: var(--ec-shadow);
  width: 90%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  outline: none;
}

.ec-modal.is-open,
.ec-modal-overlay.is-open {
  display: block;
}

.ec-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #c62828;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  font-weight: 700;
  transition: opacity .15s;
}
.ec-modal-close:hover { opacity: .7; }

.ec-modal-inner {
  padding: 24px 24px 0;
}

.ec-modal-content {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.ec-modal-image-wrap {
  flex-shrink: 0;
  width: 180px;
}
.ec-modal-image-wrap img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.ec-modal-image-wrap img[src=""] {
  display: none;
}

.ec-modal-info h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--ec-navy);
  line-height: 1.3;
}

.ec-modal-info p {
  margin: 4px 0;
  font-size: 0.88rem;
  color: #333;
}

.ec-modal-info p strong {
  color: #111;
}

.ec-modal-info .ec-time {
  color: var(--ec-green);
  font-weight: 600;
}

.ec-modal-desc {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #444;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
}
.ec-modal-desc p { margin: 0 0 6px; }

.ec-modal-footer {
  text-align: center;
  padding: 16px 24px 20px;
  margin-top: 16px;
}

.ec-btn-close-modal {
  background: none;
  border: 2px solid var(--ec-red);
  color: var(--ec-red);
  padding: 10px 40px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: .08em;
  cursor: pointer;
  border-radius: 2px;
  transition: background .15s, color .15s;
}
.ec-btn-close-modal:hover {
  background: var(--ec-red);
  color: #fff;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .ec-modal-content { flex-direction: column; }
  .ec-modal-image-wrap { width: 100%; }
  .ec-modal-image-wrap img { height: 180px; }
  .ec-cell { min-height: 70px; }
  .ec-day-header { font-size: 0.7rem; padding: 6px 4px; }
  .ec-event-pill { font-size: 0.65rem; padding: 2px 4px; }
  .ec-month-title { font-size: 1.3rem; }
}
