/* IWP Event Calendar */
.iwpes-calendar {
  font-family: inherit;
  color: #1f2937;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 40%);
  border: 1px solid #e7eef8;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.iwpes-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 14px;
}

.iwpes-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.iwpes-nav h3 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
}

.iwpes-nav-btn,
.iwpes-today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}

.iwpes-nav-btn {
  width: 38px;
  font-size: 24px;
  line-height: 1;
}

.iwpes-today {
  padding: 0 16px;
  font-size: 14px;
}

.iwpes-grid-wrap {
  border: 1px solid #dbe7f6;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.iwpes-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.iwpes-grid th,
.iwpes-grid td {
  border: 1px solid #e5e7eb;
  vertical-align: top;
}

.iwpes-grid th {
  padding: 8px 10px;
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  font-size: 13px;
  text-align: left;
  font-weight: 700;
}

.iwpes-grid .is-sun {
  color: #dc2626;
}

.iwpes-grid .is-sat {
  color: #2563eb;
}

.iwpes-day {
  min-height: 118px;
  padding: 8px;
  transition: background-color 0.18s ease;
}

.iwpes-date {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.iwpes-date-btn {
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  padding: 0;
  margin-bottom: 6px;
  cursor: pointer;
  color: inherit;
}

.iwpes-grid td.is-out {
  background: #f9fafb;
  color: #9ca3af;
}

.iwpes-grid td:hover .iwpes-day {
  background: #f7faff;
}

.iwpes-grid td.is-today {
  background: linear-gradient(180deg, #eef6ff 0%, #ffffff 55%);
  box-shadow: inset 0 0 0 2px #64a3ff;
}

.iwpes-grid td.is-today .iwpes-date,
.iwpes-grid td.is-today .iwpes-date-btn {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #1a73e8;
  color: #fff;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.iwpes-events {
  margin: 0;
  padding: 0;
  list-style: none;
}

.iwpes-events li {
  margin: 0 0 3px;
}

.iwpes-event-btn,
.iwpes-more-btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  font-size: 12px;
  line-height: 1.35;
}

.iwpes-event-btn {
  color: #0f172a;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.iwpes-event-btn.is-range {
  background: var(--iwpec-bg, #1a73e8);
  color: #fff;
  border-radius: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset;
}

.iwpes-event-btn.is-range::before {
  color: #fff;
}

.iwpes-event-btn.is-range-start {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  margin-left: 1px;
}

.iwpes-event-btn.is-range-end {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  margin-right: 1px;
}

.iwpes-event-btn.is-holiday {
  background: #15803d;
  color: #fff;
}

.iwpes-event-btn.is-holiday::before {
  color: #fff;
}

.iwpes-event-btn::before {
  content: "• ";
  color: #3b82f6;
}

.iwpes-event-btn:hover,
.iwpes-more-btn:hover {
  background: #eff6ff;
}

.iwpes-event-btn.is-range:hover {
  background: var(--iwpec-bg, #1a73e8);
  filter: brightness(0.96);
}

.iwpes-event-btn.is-holiday:hover {
  background: #15803d;
  filter: brightness(0.96);
}

.iwpes-more-btn {
  color: #6b7280;
  margin-top: 3px;
}

.iwpes-manage-wrap {
  margin-top: 14px;
}

.iwpes-register-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.iwpes-manage-panel {
  margin-top: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.iwpes-panel-title {
  margin: 0 0 10px;
  font-size: 18px;
}

.iwpes-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.iwpes-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.iwpes-check {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

.iwpes-inline-row {
  display: grid;
  grid-template-columns: 1fr 1fr 120px;
  gap: 10px;
}

.iwpes-inline-row label {
  min-width: 0;
}

.iwpes-inline-row label.is-date input {
  max-width: 100%;
}

.iwpes-inline-row label.is-color {
  width: 120px;
}

.iwpes-form input,
.iwpes-form textarea {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
}

.iwpes-form input[type="color"] {
  width: 120px;
  padding: 2px;
  height: 36px;
}

.iwpes-save-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: #1a73e8;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.iwpes-actions-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.iwpes-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 14px 0 10px;
}

.iwpes-list-title {
  margin: 0 0 8px;
  font-size: 15px;
}

.iwpes-admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.iwpes-admin-row {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.iwpes-admin-row .meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.iwpes-admin-row .meta span {
  font-size: 12px;
  color: #6b7280;
}

.iwpes-admin-row .actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.iwpes-admin-row .actions form {
  margin: 0;
}

.iwpes-mini-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
  color: #111827;
}

.iwpes-mini-btn.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.iwpes-empty-admin {
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  padding: 10px;
  color: #6b7280;
  font-size: 13px;
}

.iwpes-toast {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.iwpes-toast.ok {
  background: #ecfdf3;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.iwpes-toast.err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.iwpes-modal[hidden] {
  display: none;
}

.iwpes-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.iwpes-modal-dim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
}

.iwpes-modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 24px));
  max-height: calc(100vh - 70px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  padding: 20px 18px 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.iwpes-modal-panel.is-manage {
  width: min(760px, calc(100% - 24px));
}

.iwpes-modal-x {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}

.iwpes-modal-list h4,
.iwpes-modal-detail h4 {
  margin: 0 0 10px;
  font-size: 24px;
}

.iwpes-modal-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.iwpes-modal-list li + li {
  margin-top: 6px;
}

.iwpes-modal-item {
  width: 100%;
  border: 0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  font-size: 15px;
}

.iwpes-modal-item:hover {
  background: #e2e8f0;
}

.iwpes-back-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  margin-bottom: 10px;
  cursor: pointer;
}

.iwpes-detail-date {
  margin: 14px 0 0;
  color: #6b7280;
  font-size: 14px;
}

.iwpes-detail-row {
  margin: 6px 0;
  font-size: 15px;
}

.iwpes-detail-body {
  font-size: 16px;
  white-space: pre-line;
}

body.iwpes-modal-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .iwpes-nav h3 {
    font-size: 22px;
  }

  .iwpes-day {
    min-height: 86px;
    padding: 6px;
  }

  .iwpes-event-btn,
  .iwpes-more-btn {
    font-size: 11px;
  }

  .iwpes-modal-panel {
    top: 52%;
    width: calc(100% - 16px);
    max-height: calc(100vh - 24px);
  }

  .iwpes-inline-row {
    grid-template-columns: 1fr;
  }

  .iwpes-inline-row label.is-color {
    width: auto;
  }
}

