/**
 * Element Event Calendar - Frontend Styles
 * Version: 1.0.0
 * Uses system font stack — no external font dependencies.
 */

:root {
  --eec-bg: #f8f9fa;
  --eec-surface: #ffffff;
  --eec-border: #e1e4e8;
  --eec-text-primary: #1a1a1a;
  --eec-text-secondary: #6e7781;
  --eec-accent: #0969da;
  --eec-today: #ffd33d;
  --eec-hover: #f6f8fa;
}

.eec-app-container {
  display: flex;
  gap: 20px;
  width: 100%;
  position: relative;
}

/* Loading overlay */
.eec-loading-overlay {
  display: flex;
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 10;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
}

.eec-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--eec-border, #e1e4e8);
  border-top-color: var(--eec-accent, #0969da);
  border-radius: 50%;
  animation: eec-spin 0.7s linear infinite;
}

@keyframes eec-spin {
  to {
    transform: rotate(360deg);
  }
}

.eec-app-container * {
  box-sizing: border-box;
}

.eec-calendar-container {
  background: var(--eec-surface);
  border: 1px solid var(--eec-border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 0 0 440px;
  height: 580px;
  box-shadow: 50px 154px 45px 0 rgba(110, 110, 110, 0.00), 32px 98px 41px 0 rgba(110, 110, 110, 0.01), 18px 55px 35px 0 rgba(110, 110, 110, 0.05), 8px 25px 26px 0 rgba(110, 110, 110, 0.09), 2px 6px 14px 0 rgba(110, 110, 110, 0.10);
}

.eec-calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.eec-month-year {
  font-size: 20px;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: color 0.2s ease;
  color: var(--eec-text-primary);
}

.eec-month-year:hover {
  color: var(--eec-accent);
}

.eec-nav-buttons {
  display: flex;
  gap: 8px;
}

.eec-nav-btn {
  background: var(--eec-surface);
  border: 1px solid var(--eec-text-secondary);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  color: var(--eec-text-secondary);
}

.eec-nav-btn .eec-nav-icon {
  pointer-events: none;
}

.eec-nav-btn:hover,
.eec-nav-btn:active {
  border-color: var(--eec-text-primary);
  color: var(--eec-text-primary);
}

.eec-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.eec-weekday {
  text-align: center;
  color: var(--eec-text-primary);
  letter-spacing: 0.05em;
  padding: 8px 0;
  font-weight: 600;
}

.eec-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  flex: 1;
  align-items: stretch;
}

.eec-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 2px;
  line-height: 1.2;
  color: var(--eec-text-primary);
  min-height: 0;
  min-width: 0;
}

.eec-day:hover {
  background: var(--eec-hover);
}

.eec-day.other-month {
  color: var(--eec-text-secondary);
  opacity: 0.4;
}

.eec-day.today {
  background: var(--eec-today);
  color: var(--eec-text-primary);
  font-weight: 700;
}

.eec-day.today:hover {
  background: var(--eec-today);
  transform: scale(1.05);
}

.eec-day.selected {
  background: var(--eec-accent);
}

.eec-day.selected:hover {
  background: var(--eec-accent);
}

.eec-day.has-events {
  font-weight: 600;
}

.eec-event-dots {
  display: flex;
  gap: 3px;
  margin-top: 2px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  position: absolute;
  bottom: 8px;
}

.eec-event-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  opacity: 0.9;
  background: var(--eec-accent, #0969da);
}

/* Events Panel */
.eec-events-panel {
  flex: 1;
  background: var(--eec-surface);
  border: 1px solid var(--eec-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  height: 580px;
}

.eec-events-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--eec-border);
}

.eec-events-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: var(--eec-text-primary);
}

.eec-events-subtitle {
  font-size: 13px;
  color: var(--eec-text-secondary);
}

.eec-events-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--eec-border) transparent;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  align-items: flex-start;
}

.eec-events-list::-webkit-scrollbar {
  width: 6px;
}

.eec-events-list::-webkit-scrollbar-track {
  background: transparent;
}

.eec-events-list::-webkit-scrollbar-thumb {
  background: var(--eec-border);
  border-radius: 3px;
}

.eec-events-list::-webkit-scrollbar-thumb:hover {
  background: var(--eec-text-secondary);
}

.eec-event-item {
  padding: 16px;
  border-radius: 3px 10px 10px 3px;
  background: var(--eec-hover);
  border-left: 3px solid;
  transition: all 0.2s ease;
  cursor: pointer;
}

/* Category-specific border & dot colors are generated dynamically via wp_add_inline_style */

.eec-event-item-category {
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  color: var(--eec-accent);
}

.eec-event-item-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--eec-text-primary);
}

.eec-event-item-date {
  font-size: 12px;
  color: var(--eec-text-secondary);
  margin-bottom: 8px;
}

.eec-event-item-summary {
  font-size: 13px;
  color: var(--eec-text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.eec-event-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.eec-event-item-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  text-decoration: none;
  background: var(--eec-accent);
  cursor: pointer;
}

.eec-no-events {
  text-align: center;
  padding: 40px 20px;
  color: var(--eec-text-secondary);
  font-size: 14px;
  grid-column: 1 / -1;
}

/* Show More (Mobile Only) */
.eec-show-more-container {
  display: none;
  text-align: center;
  padding: 16px 0;
  border-top: 1px solid var(--eec-border);
  margin-top: 12px;
}

.eec-show-more-text {
  font-size: 13px;
  color: var(--eec-text-secondary);
  margin-bottom: 12px;
}

.eec-show-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--eec-accent);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.eec-show-more-btn:hover {
  filter: brightness(0.85);
  transform: translateY(-1px);
}

.eec-show-more-btn:active {
  transform: translateY(0);
}

/* Category Bar */
.eec-category-bar {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--eec-border);
  flex-wrap: wrap;
}

.eec-category-item {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  font-size: 12px;
  color: var(--eec-text-secondary);
}

.eec-category-bar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Animations */
@keyframes eecFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eec-day {
  animation: eecFadeIn 0.3s ease backwards;
}

.eec-day:nth-child(7n+1) {
  animation-delay: 0.02s;
}

.eec-day:nth-child(7n+2) {
  animation-delay: 0.04s;
}

.eec-day:nth-child(7n+3) {
  animation-delay: 0.06s;
}

.eec-day:nth-child(7n+4) {
  animation-delay: 0.08s;
}

.eec-day:nth-child(7n+5) {
  animation-delay: 0.1s;
}

.eec-day:nth-child(7n+6) {
  animation-delay: 0.12s;
}

.eec-day:nth-child(7n) {
  animation-delay: 0.14s;
}

/* Responsive Design */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) and (min-width: 768px) {
  .eec-app-container {
    max-width: 100%;
  }

  .eec-calendar-container {
    flex: 0 0 360px;
  }

  .eec-events-panel {
    flex: 1;
  }

  .eec-events-list {
    grid-template-columns: 1fr;
  }
}

/* Mobile: Below 768px */
@media (max-width: 767px) {
  .eec-app-container {
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
  }

  .eec-calendar-container {
    flex: 0 0 auto;
    height: auto;
    width: 100%;
    padding: 20px;
  }

  .eec-events-panel {
    height: auto;
    max-height: none;
    width: 100%;
    padding: 20px;
  }

  .eec-events-list {
    max-height: none;
    overflow-y: visible;
    grid-template-columns: 1fr;
  }

  .eec-show-more-container {
    display: block;
  }

  .eec-month-year {
    font-size: 18px;
  }

  .eec-day {
    font-size: 13px;
    padding: 4px 2px;
  }

  .eec-weekday {
    font-size: 10px;
  }

  .eec-event-dots {
    gap: 2px;
  }

  .eec-event-dot {
    width: 4px;
    height: 4px;
  }

  .eec-category-bar {
    gap: 12px;
  }

  .eec-category-item {
    font-size: 11px;
  }

  .eec-events-title {
    font-size: 16px;
  }

  .eec-events-subtitle {
    font-size: 12px;
  }

  .eec-event-item {
    padding: 14px;
  }

  .eec-event-item-title {
    font-size: 13px;
  }

  .eec-event-item-date {
    font-size: 11px;
  }

  .eec-event-item-summary {
    font-size: 12px;
  }

  .eec-event-item-button {
    font-size: 11px;
    padding: 5px 10px;
  }
}

/* Small mobile: Below 480px */
@media (max-width: 479px) {

  .eec-calendar-container,
  .eec-events-panel {
    padding: 16px;
  }

  .eec-calendar-header {
    margin-bottom: 16px;
  }

  .eec-month-year {
    font-size: 16px;
  }

  .eec-nav-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .eec-day {
    font-size: 12px;
  }

  .eec-category-bar {
    gap: 8px;
  }

  .eec-category-item {
    font-size: 10px;
  }

  .eec-category-bar-dot {
    width: 6px;
    height: 6px;
  }
}

/* Event Thumbnails */
.eec-event-item {
  display: flex;
  gap: 12px;
}

.eec-event-thumbnail {
  max-width: 185px;
  max-height: 185px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.eec-event-item-content {
  flex: 1;
  min-width: 0;
}

/* Mobile thumbnail adjustments */
@media (max-width: 767px) {
  .eec-event-thumbnail {
    width: 60px;
    height: 60px;
  }
}