/*
 * Event Calendar – Frontend Styles v2
 * Mobile-first, minimalist, Divi-compatible.
 * Prefix: ec-  (nie nadpisuje stylów motywu)
 * @package EventCalendar
 */

/* ===================================================================
   Custom Properties
   =================================================================== */
:root {
  --ec-primary:      #1a56db;
  --ec-accent:       #f59e0b;
  --ec-text:         #111827;
  --ec-muted:        #6b7280;
  --ec-border:       #e5e7eb;
  --ec-bg:           #ffffff;
  --ec-bg-alt:       #f9fafb;
  --ec-radius:       10px;
  --ec-radius-sm:    6px;
  --ec-shadow:       0 1px 3px rgb(0 0 0/.08),0 1px 2px -1px rgb(0 0 0/.06);
  --ec-shadow-md:    0 4px 14px rgb(0 0 0/.10);
  --ec-transition:   .18s ease;
}

/* ===================================================================
   Base wrapper
   =================================================================== */
.ec-wrap { box-sizing: border-box; color: var(--ec-text); }
.ec-wrap *, .ec-wrap *::before, .ec-wrap *::after { box-sizing: inherit; }

/* ===================================================================
   Filters bar
   =================================================================== */
.ec-filters {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; margin-bottom: 26px;
}
.ec-search-form {
  display: flex; align-items: center; flex: 1 1 200px; max-width: 320px;
  border: 1.5px solid var(--ec-border); border-radius: var(--ec-radius-sm);
  background: var(--ec-bg); overflow: hidden;
  transition: border-color var(--ec-transition);
}
.ec-search-form:focus-within { border-color: var(--ec-primary); }
.ec-search-input {
  border: none !important; outline: none !important; box-shadow: none !important;
  padding: 8px 12px !important; font-size: 14px !important;
  width: 100%; background: transparent !important; color: var(--ec-text) !important;
}
.ec-search-btn {
  background: none; border: none; padding: 8px 10px; cursor: pointer;
  color: var(--ec-muted); display: flex; align-items: center;
  transition: color var(--ec-transition);
}
.ec-search-btn:hover { color: var(--ec-primary); }
.ec-archive-link {
  font-size: 13px; color: var(--ec-muted); text-decoration: none;
  margin-left: auto; white-space: nowrap;
  transition: color var(--ec-transition);
}
.ec-archive-link:hover { color: var(--ec-primary); }

/* ===================================================================
   Card grid
   =================================================================== */
.ec-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}
.ec-event-card {
  border: 1.5px solid var(--ec-border); border-radius: var(--ec-radius);
  background: var(--ec-bg); box-shadow: var(--ec-shadow); overflow: hidden;
  transition: box-shadow var(--ec-transition), transform var(--ec-transition);
}
.ec-event-card:hover { box-shadow: var(--ec-shadow-md); transform: translateY(-2px); }
.ec-card-link { display: block; text-decoration: none; color: inherit; }
.ec-card-image { width: 100%; aspect-ratio: 16/9; overflow: hidden; background: var(--ec-bg-alt); }
.ec-card-image img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.ec-event-card:hover .ec-card-image img { transform: scale(1.04); }
.ec-card-no-img {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
}
.ec-card-no-img svg { width: 48px; height: 48px; }
.ec-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.ec-card-date {
  font-size: 12px; font-weight: 700; color: var(--ec-primary);
  text-transform: uppercase; letter-spacing: .04em;
  display: flex; align-items: center; gap: 6px;
}
.ec-card-time { font-weight: 400; color: var(--ec-muted); text-transform: none; }
.ec-card-title {
  font-size: 16px !important; font-weight: 700 !important;
  line-height: 1.35 !important; margin: 0 !important;
}
.ec-card-excerpt { font-size: 14px; color: var(--ec-muted); line-height: 1.55; margin: 0; flex: 1; }
.ec-card-price {
  display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 700;
  color: #fff; background: var(--ec-accent); border-radius: 4px; padding: 2px 8px;
  align-self: flex-start;
}
.ec-no-events { text-align: center; padding: 48px 24px; color: var(--ec-muted); font-size: 15px; }
.ec-no-events a { color: var(--ec-primary); margin-left: 4px; }

/* ===================================================================
   Pagination
   =================================================================== */
.ec-pagination {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 6px; margin-top: 32px;
}
.ec-page-btn {
  min-width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--ec-radius-sm); border: 1.5px solid var(--ec-border);
  background: var(--ec-bg); color: var(--ec-muted); font-size: 14px; font-weight: 500;
  text-decoration: none;
  transition: border-color var(--ec-transition), color var(--ec-transition), background var(--ec-transition);
}
.ec-page-btn:hover, .ec-page-btn--active {
  border-color: var(--ec-primary); color: var(--ec-primary); background: #eff6ff;
}

/* ===================================================================
   Month calendar
   =================================================================== */
.ec-calendar-wrap {
  border: 1.5px solid var(--ec-border); border-radius: var(--ec-radius);
  box-shadow: var(--ec-shadow); overflow: hidden; background: var(--ec-bg);
}
.ec-cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--ec-bg-alt);
  border-bottom: 1.5px solid var(--ec-border);
}
.ec-cal-title {
  font-size: 17px !important; font-weight: 700 !important; margin: 0 !important;
}
.ec-cal-nav-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--ec-radius-sm);
  border: 1.5px solid var(--ec-border); background: var(--ec-bg);
  text-decoration: none; color: var(--ec-text);
  transition: border-color var(--ec-transition), background var(--ec-transition);
}
.ec-cal-nav-btn:hover { border-color: var(--ec-primary); background: #eff6ff; }
.ec-cal-nav-btn svg { width: 16px; height: 16px; }
.ec-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.ec-grid-head {
  padding: 8px 4px; text-align: center; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ec-muted);
  background: var(--ec-bg-alt); border-bottom: 1.5px solid var(--ec-border);
}
.ec-grid-cell {
  min-height: 88px; padding: 5px 5px 7px;
  border-right: 1px solid var(--ec-border);
  border-bottom: 1px solid var(--ec-border);
}
.ec-grid-cell:nth-child(7n) { border-right: none; }
.ec-grid-cell--empty { background: var(--ec-bg-alt); }
.ec-grid-cell--today .ec-day-number { background: var(--ec-primary); color: #fff; }
.ec-day-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 12px; font-weight: 600; color: var(--ec-text); margin-bottom: 3px;
}
.ec-day-events {
  list-style: none !important;
  margin: 0 !important; padding: 0 !important;
  display: flex; flex-direction: column; gap: 2px;
}
.ec-day-events li {
  list-style: none !important;
  margin: 0 !important; padding: 0 !important;
  background: none !important;
}
/* Izolacja kalendarza — blokuje nachodzące elementy Divi (strzałki slidera itp.) */
.ec-calendar-wrap {
  position: relative;
  z-index: 1;
  isolation: isolate;
}
/* Jeśli slider Divi jest bezpośrednio przed kalendarzem — ukryj wystające strzałki */
.et_pb_slider { overflow: hidden !important; }
.et_pb_section:has(.ec-wrap) { position: relative; z-index: 2; }
.ec-day-event a {
  display: block; padding: 2px 5px; border-radius: 3px; font-size: 11px; line-height: 1.4;
  text-decoration: none; background: #eff6ff; color: var(--ec-primary);
  border-left: 2px solid var(--ec-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--ec-transition);
}
.ec-day-event a:hover { background: #dbeafe; }
.ec-day-event-time { font-weight: 700; margin-right: 3px; }
.ec-day-more { font-size: 10px; color: var(--ec-muted); padding: 1px 5px; }

/* ===================================================================
   Single event view
   =================================================================== */
.ec-single-meta {
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  padding: 16px 18px; background: var(--ec-bg-alt);
  border: 1.5px solid var(--ec-border); border-radius: var(--ec-radius);
  margin-bottom: 26px;
}
.ec-single-meta-item { display: flex; align-items: center; gap: 7px; font-size: 15px; }
.ec-meta-icon { width: 18px; height: 18px; color: var(--ec-primary); flex-shrink: 0; }
.ec-single-description { margin-bottom: 32px; }
.ec-single-gallery { margin-bottom: 32px; }
.ec-gallery-title {
  font-size: 18px !important; font-weight: 700 !important; margin-bottom: 14px !important;
}
.ec-gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px;
}
.ec-gallery-item {
  display: block; border-radius: var(--ec-radius-sm); overflow: hidden;
  aspect-ratio: 4/3; background: var(--ec-bg-alt);
}
.ec-gallery-img {
  width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease;
}
.ec-gallery-item:hover .ec-gallery-img { transform: scale(1.05); }
.ec-single-actions {
  display: flex; flex-direction: column; gap: 14px;
  padding-top: 26px; border-top: 1.5px solid var(--ec-border); margin-top: 32px;
}

/* Share buttons */
.ec-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ec-share-label, .ec-atc-label {
  font-size: 13px; font-weight: 600; color: var(--ec-muted);
  white-space: nowrap; margin-right: 2px;
}
.ec-share-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px;
  border-radius: var(--ec-radius-sm); font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 1.5px solid transparent; line-height: 1;
  transition: opacity var(--ec-transition), transform var(--ec-transition);
}
/* Icon-only variant: square, no padding asymmetry */
.ec-share-btn--icon {
  padding: 8px;
  width: 36px; height: 36px;
}
.ec-share-btn:hover { opacity: .85; transform: translateY(-1px); }
.ec-share-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.ec-share-btn--fb  { background: #1877f2; color: #fff; }
.ec-share-btn--wa  { background: #25d366; color: #fff; }
.ec-share-btn--x   { background: #000; color: #fff; }
.ec-share-btn--copy {
  background: var(--ec-bg-alt); color: var(--ec-text); border-color: var(--ec-border);
}
.ec-share-btn--copy.ec-copied {
  background: #ecfdf5; color: #059669; border-color: #6ee7b7;
}

/* PLN label as meta icon */
.ec-meta-icon--pln {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0;
  font-size: 11px; font-weight: 800; color: var(--ec-primary);
  line-height: 1;
}

/* Add to calendar */
.ec-add-to-calendar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ec-atc-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px;
  border-radius: var(--ec-radius-sm); font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer; line-height: 1;
  border: 1.5px solid var(--ec-border); background: var(--ec-bg); color: var(--ec-text);
  transition: border-color var(--ec-transition), background var(--ec-transition), color var(--ec-transition);
}
.ec-atc-btn:hover { border-color: var(--ec-primary); background: #eff6ff; color: var(--ec-primary); }
.ec-atc-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.ec-atc-btn--gcal { color: #4285f4; border-color: #4285f4; }
.ec-atc-btn--gcal:hover { background: #eff6ff; }

/* ===================================================================
   Single event PAGE (template/single-event.php)
   =================================================================== */
.ec-single-page {
  background: var(--ec-bg);
}
.ec-single-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* Hero image */
.ec-single-hero {
  margin: 0 -20px 36px;
  max-height: 460px;
  overflow: hidden;
  background: var(--ec-bg-alt);
}
.ec-single-hero-img {
  width: 100%;
  height: 100%;
  max-height: 460px;
  object-fit: cover;
  display: block;
}

/* Back link */
.ec-single-back {
  margin-bottom: 20px;
  margin-top: 28px;
}
.ec-single-back a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ec-muted);
  text-decoration: none;
  transition: color var(--ec-transition);
}
.ec-single-back a:hover { color: var(--ec-primary); }

/* Category tags */
.ec-single-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.ec-single-cat {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eff6ff;
  color: var(--ec-primary);
  text-decoration: none;
  border: 1px solid #bfdbfe;
  transition: background var(--ec-transition);
}
.ec-single-cat:hover { background: #dbeafe; }

/* Title */
.ec-single-title {
  font-size: clamp(22px, 4vw, 34px) !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  margin: 0 0 22px !important;
  color: var(--ec-text) !important;
}

/* ===================================================================
   Calendar event button (replaces <a> in month grid)
   =================================================================== */
.ec-day-event-btn {
  display: block; width: 100%; text-align: left;
  padding: 2px 5px; border-radius: 3px; font-size: 11px; line-height: 1.4;
  background: #eff6ff; color: var(--ec-primary);
  border: none; border-left: 2px solid var(--ec-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; font-family: inherit;
  transition: background var(--ec-transition);
}
.ec-day-event-btn:hover { background: #dbeafe; }

/* ===================================================================
   Popup overlay + card
   =================================================================== */
.ec-popup-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgb(0 0 0 / .45);
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
}
.ec-popup-overlay[hidden] { display: none !important; }
/* Stan otwarty ustawiany przez JS: style="display:flex!important" */

@keyframes ecFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.ec-popup {
  position: relative;
  background: var(--ec-bg);
  border-radius: var(--ec-radius);
  box-shadow: 0 20px 60px rgb(0 0 0 / .25);
  width: 100%; max-width: 400px;
  overflow: hidden;
  animation: ecSlideUp .18s ease;
}

@keyframes ecSlideUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.ec-popup-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgb(0 0 0 / .35); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background var(--ec-transition);
}
.ec-popup-close:hover { background: rgb(0 0 0 / .55); }
.ec-popup-close svg { width: 14px; height: 14px; }

.ec-popup-thumb {
  width: 100%; aspect-ratio: 16/9; overflow: hidden; background: var(--ec-bg-alt);
}
.ec-popup-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.ec-popup-body {
  padding: 18px 20px 20px;
  display: flex; flex-direction: column; gap: 6px;
}

.ec-popup-meta {
  font-size: 12px; font-weight: 700; color: var(--ec-primary);
  text-transform: uppercase; letter-spacing: .04em;
  display: flex; gap: 10px; flex-wrap: wrap;
}

.ec-popup-title {
  font-size: 17px !important; font-weight: 800 !important;
  line-height: 1.3 !important; margin: 0 !important; color: var(--ec-text) !important;
}

.ec-popup-excerpt {
  font-size: 13px; color: var(--ec-muted); line-height: 1.55; margin: 0;
}

.ec-popup-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; font-size: 13px; font-weight: 700;
  color: var(--ec-primary); text-decoration: none;
  transition: gap var(--ec-transition);
}
.ec-popup-link:hover { gap: 8px; }

/* ===================================================================
   Default view — upcoming list + calendar
   =================================================================== */
.ec-default-wrap {
  display: flex; flex-direction: column; gap: 36px;
}

.ec-upcoming-title {
  font-size: 18px !important; font-weight: 800 !important;
  margin: 0 0 16px !important; color: var(--ec-text) !important;
}

.ec-upcoming-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
  border: 1.5px solid var(--ec-border); border-radius: var(--ec-radius);
  overflow: hidden;
}

.ec-upcoming-item { border-bottom: 1px solid var(--ec-border); }
.ec-upcoming-item:last-child { border-bottom: none; }

.ec-upcoming-link {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px; text-decoration: none; color: inherit;
  background: var(--ec-bg);
  transition: background var(--ec-transition);
}
.ec-upcoming-link:hover { background: #f8faff; }

.ec-upcoming-datebox {
  flex-shrink: 0;
  width: 48px; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--ec-primary); border-radius: var(--ec-radius-sm);
  color: #fff; line-height: 1.1;
}
.ec-upcoming-datebox--empty { background: var(--ec-bg-alt); }

.ec-upcoming-day {
  font-size: 22px; font-weight: 800; line-height: 1;
}
.ec-upcoming-month {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}

.ec-upcoming-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}

.ec-upcoming-event-title {
  font-size: 15px; font-weight: 700; color: var(--ec-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ec-upcoming-details {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 12px; color: var(--ec-muted);
}

.ec-upcoming-time {
  display: flex; align-items: center; gap: 3px;
}

.ec-upcoming-price {
  font-weight: 700; color: var(--ec-accent);
}

.ec-upcoming-arrow {
  flex-shrink: 0; width: 16px; height: 16px;
  color: var(--ec-border);
  transition: color var(--ec-transition), transform var(--ec-transition);
}
.ec-upcoming-link:hover .ec-upcoming-arrow {
  color: var(--ec-primary); transform: translateX(3px);
}

/* ===================================================================
   Responsive
   =================================================================== */
@media (max-width: 640px) {
  .ec-list { grid-template-columns: 1fr; }
  .ec-grid-cell { min-height: 58px; padding: 3px 3px 5px; }
  .ec-day-event a { font-size: 10px; padding: 1px 3px; }
  .ec-day-number { width: 20px; height: 20px; font-size: 11px; }
  .ec-cal-title { font-size: 14px !important; }
  .ec-gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .ec-single-meta { flex-direction: column; gap: 8px; }
  .ec-filters { flex-direction: column; align-items: stretch; }
  .ec-search-form { max-width: 100%; }
  .ec-archive-link { margin-left: 0; }
}
@media (max-width: 380px) {
  .ec-grid-head { font-size: 9px; letter-spacing: 0; }
  .ec-grid-cell { min-height: 44px; }
}

/* ===================================================================
   NOWE STYLE — Załączniki, data od-do, odznaka edycji
   =================================================================== */

/* Sekcja tytułu (galeria + załączniki) */
.ec-section-title {
	font-size: 1.15rem;
	font-weight: 700;
	margin: 2rem 0 .75rem;
	padding-bottom: .4rem;
	border-bottom: 2px solid var(--ec-primary, #1a56db);
	display: inline-block;
}

/* Odznaka edycji */
.ec-edition-badge {
	display: inline-block;
	background: var(--ec-primary, #1a56db);
	color: #fff;
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	border-radius: 3px;
	padding: 3px 10px;
	margin-bottom: .6rem;
}

/* Separator dat od-do */
.ec-meta-date-sep {
	color: #888;
	font-weight: 400;
}

/* Załączniki */
.ec-single-attachments {
	margin-top: 2rem;
}

.ec-att-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: .5rem;
}

.ec-att-item {
	margin: 0;
}

.ec-att-link {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	padding: .55rem .9rem;
	border: 1px solid #e2e4e7;
	border-radius: 6px;
	color: inherit;
	text-decoration: none;
	font-size: .9rem;
	font-weight: 500;
	background: #fafafa;
	transition: background .15s, border-color .15s, color .15s;
	max-width: 480px;
	width: 100%;
}

.ec-att-link:hover {
	background: #f0f6ff;
	border-color: var(--ec-primary, #1a56db);
	color: var(--ec-primary, #1a56db);
}

.ec-att-icon {
	flex-shrink: 0;
	color: var(--ec-primary, #1a56db);
	opacity: .8;
}

.ec-att-label {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ec-att-ext {
	flex-shrink: 0;
	font-size: .68rem;
	font-weight: 700;
	background: #e8edf7;
	color: #1a56db;
	border-radius: 3px;
	padding: 1px 5px;
	letter-spacing: .04em;
}

.ec-att-download {
	flex-shrink: 0;
	color: #aaa;
}

.ec-att-link:hover .ec-att-download {
	color: var(--ec-primary, #1a56db);
}
