/* ─────────────────────────────────────────────────────────────
   HIRE EV Events Calendar — Frontend Styles
   ───────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@300;400;500&display=swap');

/* ── Variables ── */
:root {
  --hec-bg:          #ffffff;
  --hec-surface:     #f5f7fa;
  --hec-border:      rgba(0, 0, 0, 0.08);
  --hec-divider:     rgba(0, 0, 0, 0.07);
  --hec-accent:      #1a56db;
  --hec-accent-dim:  rgba(26, 86, 219, 0.08);
  --hec-accent-lite: #e8effe;
  --hec-text:        #111827;
  --hec-muted:       #6b7280;
  --hec-radius:      6px;
  --hec-font-mono:   'DM Mono', ui-monospace, monospace;
  --hec-font-serif:  'DM Serif Display', Georgia, serif;
}

/* ── Resets scoped to plugin ── */
.hec-banner *,
.hec-modal-overlay *,
.hec-detail-overlay * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ═══════════════════════════════════════════════
   BANNER
   ═══════════════════════════════════════════════ */
.hec-banner {
  font-family: var(--hec-font-mono);
  background: var(--hec-bg);
  border: 1px solid var(--hec-border);
  border-radius: var(--hec-radius);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.04);
  animation: decFadeUp .65s ease both;
}

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

/* Top accent stripe */
.hec-banner::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--hec-accent) 0%, #60a5fa 100%);
}

/* Two-column grid */
.hec-banner-inner {
  display: grid;
  grid-template-columns: 255px 1fr;
}

/* ── Countdown column ── */
.hec-countdown-col {
  border-right: 1px solid var(--hec-divider);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.hec-countdown-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .6rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--hec-accent);
  font-weight: 500;
}

.hec-pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--hec-accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: decPulse 2s ease-in-out infinite;
}

@keyframes decPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.7); }
}

.hec-next-title {
  font-family: var(--hec-font-serif);
  font-size: 1.08rem;
  color: var(--hec-text);
  line-height: 1.35;
  margin-top: .2rem;
}

.hec-next-date {
  font-size: .65rem;
  color: var(--hec-muted);
}

.hec-countdown-digits {
  display: flex;
  gap: .35rem;
  margin-top: .9rem;
  align-items: flex-end;
}

.hec-digit-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
}

.hec-digit-wrap {
  background: var(--hec-accent-dim);
  border: 1px solid rgba(26, 86, 219, .15);
  border-radius: 4px;
  padding: .28rem .45rem;
  min-width: 2.2ch;
  text-align: center;
}

.hec-num {
  font-family: var(--hec-font-serif);
  font-size: 1.55rem;
  color: var(--hec-accent);
  line-height: 1;
}

.hec-unit {
  font-size: .5rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--hec-muted);
}

.hec-sep {
  font-family: var(--hec-font-serif);
  font-size: 1.35rem;
  color: var(--hec-accent);
  opacity: .3;
  padding-bottom: 1rem;
}

/* ── Events column ── */
.hec-events-col {
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.75rem;
  gap: .55rem;
}

.hec-events-header {
  font-size: .57rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--hec-muted);
}

.hec-event-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
}

.hec-event-loading {
  font-size: .72rem;
  color: var(--hec-muted);
  padding: 1rem 0;
}

/* Event card */
.hec-event-item {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: .85rem;
  padding: .7rem .9rem;
  border-radius: 5px;
  border: 1px solid var(--hec-border);
  background: var(--hec-surface);
  transition: border-color .2s, box-shadow .2s;
}

.hec-event-item:hover {
  border-color: rgba(26, 86, 219, .22);
  box-shadow: 0 2px 10px rgba(26, 86, 219, .06);
}

.hec-event-date-badge {
  text-align: center;
  border-right: 1px solid var(--hec-border);
  padding-right: .75rem;
}

.hec-event-date-badge .hec-day {
  font-family: var(--hec-font-serif);
  font-size: 1.2rem;
  color: var(--hec-accent);
  line-height: 1;
}

.hec-event-date-badge .hec-mon {
  font-size: .54rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--hec-muted);
  margin-top: .06rem;
}

.hec-event-info .hec-event-title {
  font-family: var(--hec-font-mono);
  font-size: .79rem;
  color: var(--hec-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hec-event-info .hec-event-meta {
  font-size: .61rem;
  color: var(--hec-muted);
  margin-top: .1rem;
}

/* Category tag */
.hec-tag {
  font-size: .54rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .18rem .5rem;
  border-radius: 3px;
  border: 1px solid var(--hec-accent);
  color: var(--hec-accent);
  background: var(--hec-accent-dim);
  white-space: nowrap;
  font-weight: 500;
}

/* ── Banner footer ── */
.hec-banner-footer {
  border-top: 1px solid var(--hec-divider);
  background: var(--hec-surface);
  padding: .85rem 1.75rem .85rem calc(255px + 1.75rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hec-footer-note {
  font-size: .61rem;
  color: var(--hec-muted);
  letter-spacing: .03em;
}

.hec-btn-view {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--hec-font-mono);
  font-size: .67rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--hec-accent);
  border: none;
  border-radius: 4px;
  padding: .55rem 1.2rem;
  cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(26, 86, 219, .28);
}

.hec-btn-view:hover {
  background: #1648c0;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(26, 86, 219, .35);
}

.hec-btn-view:active { transform: translateY(0); }

.hec-btn-view svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   MODAL OVERLAY
   ═══════════════════════════════════════════════ */
.hec-modal-overlay {
  font-family: var(--hec-font-mono);
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: decFadeBg .25s ease;
}

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

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

.hec-modal {
  background: var(--hec-bg);
  border-radius: 8px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .2);
  animation: decModalIn .3s cubic-bezier(.34, 1.3, .64, 1);
}

@keyframes decModalIn {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Modal header */
.hec-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--hec-border);
  flex-shrink: 0;
}

.hec-modal-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--hec-accent) 0%, #60a5fa 100%);
  border-radius: 8px 8px 0 0;
}

.hec-modal { position: relative; }

.hec-modal-title {
  font-family: var(--hec-font-serif);
  font-size: 1.25rem;
  color: var(--hec-text);
  font-weight: normal;
}

.hec-modal-close {
  background: none;
  border: 1px solid var(--hec-border);
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--hec-muted);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

.hec-modal-close svg { width: 14px; height: 14px; }
.hec-modal-close:hover { background: var(--hec-surface); color: var(--hec-text); }

/* Modal body */
.hec-modal-body {
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Calendar navigation ── */
.hec-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hec-cal-nav-btn {
  background: none;
  border: 1px solid var(--hec-border);
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--hec-muted);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

.hec-cal-nav-btn svg { width: 14px; height: 14px; }
.hec-cal-nav-btn:hover { background: var(--hec-surface); color: var(--hec-text); }

.hec-cal-month-label {
  font-family: var(--hec-font-serif);
  font-size: 1.05rem;
  color: var(--hec-text);
  text-align: center;
  flex: 1;
}

/* ── Calendar grid ── */
.hec-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  border: 1px solid var(--hec-border);
  border-radius: 5px;
  overflow: hidden;
}

.hec-cal-dow {
  text-align: center;
  font-size: .58rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--hec-muted);
  padding: .5rem 0;
  background: var(--hec-surface);
  font-weight: 500;
}

.hec-cal-day {
  background: var(--hec-bg);
  min-height: 54px;
  padding: .4rem .35rem .35rem;
  position: relative;
  cursor: default;
  border-top: 1px solid var(--hec-divider);
  transition: background .15s;
}

.hec-cal-day.hec-other-month {
  background: #fafafa;
}

.hec-cal-day.hec-today {
  background: var(--hec-accent-lite);
}

.hec-cal-day.hec-has-event {
  cursor: pointer;
}

.hec-cal-day.hec-has-event:hover {
  background: #f0f4ff;
}

.hec-day-num {
  font-size: .7rem;
  color: var(--hec-text);
  line-height: 1;
  font-weight: 500;
}

.hec-cal-day.hec-other-month .hec-day-num {
  color: #c3c4c7;
}

.hec-cal-day.hec-today .hec-day-num {
  color: var(--hec-accent);
  font-weight: 700;
}

.hec-day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 3px;
}

.hec-day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--hec-accent);
  flex-shrink: 0;
}

/* ── Month event list ── */
.hec-month-events {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.hec-month-events-header {
  font-size: .58rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--hec-muted);
  margin-bottom: .2rem;
}

.hec-month-event-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: .75rem;
  padding: .65rem .85rem;
  border-radius: 5px;
  border: 1px solid var(--hec-border);
  background: var(--hec-surface);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}

.hec-month-event-item:hover {
  border-color: rgba(26, 86, 219, .25);
  box-shadow: 0 2px 8px rgba(26, 86, 219, .06);
}

.hec-mei-badge {
  text-align: center;
  border-right: 1px solid var(--hec-border);
  padding-right: .65rem;
}

.hec-mei-badge .hec-day {
  font-family: var(--hec-font-serif);
  font-size: 1.1rem;
  color: var(--hec-accent);
  line-height: 1;
}

.hec-mei-badge .hec-mon {
  font-size: .52rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--hec-muted);
}

.hec-mei-title {
  font-size: .78rem;
  color: var(--hec-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hec-mei-meta {
  font-size: .61rem;
  color: var(--hec-muted);
  margin-top: .1rem;
}

.hec-no-events {
  font-size: .72rem;
  color: var(--hec-muted);
  text-align: center;
  padding: 1.25rem 0;
}

/* ═══════════════════════════════════════════════
   EVENT DETAIL OVERLAY (inside modal)
   ═══════════════════════════════════════════════ */
.hec-detail-overlay {
  font-family: var(--hec-font-mono);
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(17, 24, 39, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: decFadeBg .2s ease;
}

.hec-detail-overlay[hidden] { display: none; }

.hec-detail-card {
  background: var(--hec-bg);
  border-radius: 8px;
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
  animation: decModalIn .25s cubic-bezier(.34, 1.2, .64, 1);
  overflow-y: auto;
  max-height: 80vh;
}

/* Accent stripe */
.hec-detail-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--hec-accent) 0%, #60a5fa 100%);
  border-radius: 8px 8px 0 0;
}

.hec-detail-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: 1px solid var(--hec-border);
  border-radius: 4px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--hec-muted);
  transition: background .15s, color .15s;
}

.hec-detail-close svg { width: 13px; height: 13px; }
.hec-detail-close:hover { background: var(--hec-surface); color: var(--hec-text); }

.hec-detail-cats {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .75rem;
}

.hec-detail-title {
  font-family: var(--hec-font-serif);
  font-size: 1.3rem;
  color: var(--hec-text);
  line-height: 1.3;
  font-weight: normal;
  margin-bottom: .85rem;
}

.hec-detail-meta {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1rem;
  padding: .85rem;
  background: var(--hec-surface);
  border: 1px solid var(--hec-border);
  border-radius: 5px;
}

.hec-detail-meta-row {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .7rem;
  color: var(--hec-text);
}

.hec-detail-meta-row .hec-meta-icon {
  color: var(--hec-accent);
  flex-shrink: 0;
  margin-top: .05rem;
}

.hec-detail-meta-row svg { width: 13px; height: 13px; }

.hec-detail-desc {
  font-size: .78rem;
  color: var(--hec-muted);
  line-height: 1.65;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 620px) {
  .hec-banner-inner { grid-template-columns: 1fr; }
  .hec-countdown-col { border-right: none; border-bottom: 1px solid var(--hec-divider); }
  .hec-banner-footer { padding-left: 1.5rem; flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════
   DATE RANGE & ONGOING STATES
   ═══════════════════════════════════════════════ */

/* Ongoing pulse tag */
.hec-tag-ongoing {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .54rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .18rem .5rem;
  border-radius: 3px;
  border: 1px solid #059669;
  color: #059669;
  background: rgba(5, 150, 105, .08);
  white-space: nowrap;
  font-weight: 600;
  font-family: var(--hec-font-mono);
}

.hec-tag-ongoing .hec-ongoing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #059669;
  flex-shrink: 0;
  animation: hecOngoingPulse 1.4s ease-in-out infinite;
}

@keyframes hecOngoingPulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(5,150,105,.5); }
  50%       { opacity: .7; transform: scale(.85); box-shadow: 0 0 0 3px rgba(5,150,105,0); }
}

/* Ongoing event card accent */
.hec-event-item.hec-ongoing,
.hec-month-event-item.hec-ongoing {
  border-color: rgba(5, 150, 105, .3);
  background: rgba(5, 150, 105, .03);
}

.hec-event-item.hec-ongoing:hover,
.hec-month-event-item.hec-ongoing:hover {
  border-color: rgba(5, 150, 105, .45);
  box-shadow: 0 2px 10px rgba(5, 150, 105, .1);
}

/* Green date badge for ongoing */
.hec-event-item.hec-ongoing .hec-day,
.hec-event-item.hec-ongoing .hec-mon,
.hec-month-event-item.hec-ongoing .hec-day,
.hec-month-event-item.hec-ongoing .hec-mon,
.hec-mei-badge .hec-day {
  color: inherit;
}

.hec-event-item.hec-ongoing .hec-event-date-badge .hec-day,
.hec-month-event-item.hec-ongoing .hec-mei-badge .hec-day {
  color: #059669;
}

/* Date range display in meta row */
.hec-detail-meta-row .hec-date-range {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.hec-date-range .hec-date-range-end {
  font-size: .65rem;
  color: var(--hec-muted);
}

/* Calendar grid: ongoing range highlight */
.hec-cal-day.hec-in-range {
  background: rgba(5, 150, 105, .07);
}

.hec-cal-day.hec-in-range .hec-day-num {
  color: #059669;
}

.hec-cal-day.hec-has-event.hec-in-range .hec-day-dot {
  background: #059669;
}

/* Countdown label when event is ongoing */
.hec-countdown-label.hec-label-ongoing {
  color: #059669;
}

.hec-countdown-label.hec-label-ongoing .hec-pulse-dot {
  background: #059669;
}

.hec-num.hec-num-ongoing {
  color: #059669;
}

.hec-digit-wrap.hec-wrap-ongoing {
  background: rgba(5, 150, 105, .08);
  border-color: rgba(5, 150, 105, .2);
}
