* {
  box-sizing: border-box;
}

body {
  font-family: "Manrope", ui-sans-serif, system-ui;
}

.page-backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(31, 95, 168, 0.15), transparent 55%),
    radial-gradient(circle at 80% 15%, rgba(177, 78, 106, 0.2), transparent 45%),
    radial-gradient(circle at 30% 80%, rgba(30, 142, 112, 0.12), transparent 50%),
    linear-gradient(160deg, #f9f6f0 0%, #f1efe8 45%, #f5f0e6 100%);
  background-size: 160% 160%, 180% 180%, 170% 170%, 200% 200%;
  background-position: 10% 10%, 90% 10%, 20% 90%, 50% 50%;
  animation: gradientShift 26s ease-in-out infinite;
  will-change: background-position;
  z-index: -1;
}

.glass-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.search-card {
  position: relative;
  z-index: 60;
  overflow: visible;
}

.search-section {
  position: relative;
  z-index: 50;
}

.month-nav {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
}

.month-nav.is-stuck {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.nav-btn {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 0.45rem 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.7);
}

.nav-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 95, 168, 0.4);
}

.toggle-btn {
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.06);
  color: #1c2a33;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: rgba(31, 95, 168, 0.12);
  border-color: rgba(31, 95, 168, 0.3);
  color: #1f5fa8;
}

.connection-status {
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #64748b;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
}

.connection-status.ok .status-dot {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.connection-status.warn .status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.day-cell {
  min-height: 130px;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.day-cell:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 95, 168, 0.3);
}

.day-cell.today {
  border-color: rgba(31, 95, 168, 0.8);
  box-shadow: 0 10px 30px rgba(31, 95, 168, 0.15);
}

.day-cell.dimmed {
  opacity: 0.45;
}

.event-pill {
  border-radius: 12px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--resource-color, #0f172a);
  background: rgba(79, 79, 79, 0.1);
  border-left: 18px solid var(--ministry-color, var(--event-color, #4b5563));
  cursor: pointer;
  transition: transform 0.2s ease;
}

.event-pill.is-special {
  background: var(--special-color, var(--event-color, #4b5563));
  border-left: none;
  color: var(--special-text-color, #f8fafc);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.event-pill:hover {
  transform: translateX(2px);
}

.event-dots {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.35rem;
}

.event-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--event-color, #4b5563);
}

.event-dot.is-special {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 0 4px var(--special-color, var(--event-color, #4b5563));
}

.event-dot.more {
  width: auto;
  height: auto;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(31, 95, 168, 0.12);
  color: #1f5fa8;
}

.list-card {
  border-radius: 20px;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-left: 6px solid var(--ministry-color, var(--event-color, #4b5563));
  display: grid;
  gap: 0.35rem;
  transition: transform 0.2s ease;
}

.list-card.is-special {
  background: var(--special-color, var(--event-color, #4b5563));
  border-color: transparent;
  border-left: none;
  color: var(--special-text-color, #f8fafc);
}

.list-card .event-title,
.list-card .event-meta,
.list-card .event-date,
.list-card .event-summary,
.list-card .event-meta-extra {
  color: var(--list-text-color, var(--resource-color, #1c2a33));
}

.list-card.is-special .text-slate-700,
.list-card.is-special .text-slate-600,
.list-card.is-special .text-slate-500 {
  color: var(--special-text-color, #f8fafc);
}

.list-card.is-special .event-title,
.list-card.is-special .event-meta,
.list-card.is-special .event-date,
.list-card.is-special .event-summary,
.list-card.is-special .event-meta-extra {
  color: var(--special-text-color, #f8fafc);
}

.list-card.is-special .tag {
  background: rgba(255, 255, 255, 0.2);
  color: var(--special-text-color, #f8fafc);
}

.conflict-count {
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.conflict-card {
  border-radius: 18px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(255, 255, 255, 0.75);
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.35rem;
}

.conflict-title {
  font-weight: 700;
  color: #b91c1c;
  font-size: 0.95rem;
}

.conflict-meta {
  font-size: 0.8rem;
  color: #64748b;
}

.list-card:hover {
  transform: translateY(-2px);
}

.list-card.is-past {
  opacity: 0.55;
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.tag {
  border-radius: 999px;
  background: rgba(31, 95, 168, 0.12);
  color: #1f5fa8;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
}

.tag-filter-group {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-selector {
  position: relative;
}

.tag-suggestions {
  position: absolute;
  z-index: 120;
  left: 0;
  right: 0;
  margin-top: 0.35rem;
  padding: 0.4rem;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  display: grid;
  gap: 0.35rem;
  max-height: 180px;
  overflow: auto;
}

.tag-suggestions.hidden {
  display: none;
}

.tag-suggestion {
  border: none;
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.06);
  cursor: pointer;
}

.tag-suggestion:hover {
  background: rgba(31, 95, 168, 0.14);
  color: #1f5fa8;
}

.tag-filter {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1c2a33;
  background: rgba(15, 23, 42, 0.06);
  transition: all 0.2s ease;
  cursor: pointer;
}

.tag-filter.active {
  border-color: rgba(31, 95, 168, 0.45);
  background: rgba(31, 95, 168, 0.16);
  color: #1f5fa8;
}

.search-hint {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: #64748b;
}

.hide-panel {
  margin-top: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.6);
  padding: 0.75rem 1rem;
}

.hide-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
}

.hide-summary::-webkit-details-marker {
  display: none;
}

.hide-summary-note {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1f5fa8;
}

.hide-body {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.9rem;
}

.hide-chip-group {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hide-chip {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1c2a33;
  background: rgba(15, 23, 42, 0.06);
  transition: all 0.2s ease;
  cursor: pointer;
}

.hide-chip.active {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.hide-actions {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hide-action {
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1f5fa8;
  cursor: pointer;
}

.hide-action:hover {
  text-decoration: underline;
}

.hint-btn {
  border-radius: 999px;
  border: 1px solid rgba(31, 95, 168, 0.35);
  padding: 0.2rem 0.65rem;
  font-weight: 600;
  color: #1f5fa8;
  background: rgba(31, 95, 168, 0.08);
  transition: all 0.2s ease;
}

.hint-btn:hover {
  transform: translateY(-1px);
  background: rgba(31, 95, 168, 0.16);
}

.collapse-card {
  position: relative;
}

.collapse-toggle {
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.15rem 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #64748b;
  cursor: pointer;
}

.collapse-icon {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex: none;
}

.collapse-body {
  margin-top: 0.75rem;
}

.collapse-body[hidden] {
  display: none;
}

.collapse-card.is-collapsed .collapse-icon {
  transform: rotate(-45deg);
}

@media (max-width: 640px) {
  .day-cell {
    min-height: 70px;
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .event-pill,
  .more-indicator {
    display: none;
  }
}

@media (min-width: 641px) {
  .collapse-toggle {
    display: none;
  }

  .collapse-body {
    margin-top: 0;
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.5);
  padding: 1.5rem;
  z-index: 50;
}

.modal-card {
  width: min(560px, 95vw);
  border-radius: 24px;
  background: #ffffff;
  padding: 1.5rem;
  position: relative;
  animation: floatIn 0.25s ease;
}

.detail-row {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: nowrap;
}

.detail-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: #1f5fa8;
}

.detail-icon path {
  fill: currentColor;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  white-space: nowrap;
}

.detail-value {
  font-size: 0.95rem;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-btn {
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid rgba(31, 95, 168, 0.35);
  color: #ffffff;
  background: linear-gradient(135deg, #1f5fa8, #3b82f6);
  box-shadow: 0 12px 24px rgba(31, 95, 168, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.share-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(31, 95, 168, 0.28);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  height: 2rem;
  width: 2rem;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.06);
  font-size: 1.5rem;
  cursor: pointer;
}

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

@keyframes gradientShift {
  0% {
    background-position: 10% 10%, 90% 10%, 20% 90%, 50% 50%;
  }
  50% {
    background-position: 70% 30%, 20% 80%, 80% 20%, 40% 70%;
  }
  100% {
    background-position: 10% 10%, 90% 10%, 20% 90%, 50% 50%;
  }
}
