/**
 * Arcane Druid Calendar Styles
 * 
 * Comprehensive calendar styling with support for festivals, seasons, 
 * and moon phases integration.
 */

/* ========================================
   Calendar Container & Base Styles
   ======================================== */

.arcane-calendar-container {
  max-width: 100%;
  margin: 20px auto;
  padding: 1.5rem;
  border-radius: 12px;
  font-family: var(--e-global-typography-primary-font-family, sans-serif);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
}

/* Theme variants */
.arcane-calendar-theme-light {
  background-color: #ffffff;
  color: #333333;
  border: 1px solid #e0e0e0;
}

.arcane-calendar-theme-dark {
  background-color: #2c2c2c;
  color: #ffffff;
  border: 1px solid #444444;
}

.arcane-calendar-theme-auto {
  background-color: var(--e-global-color-background, #ffffff);
  color: var(--e-global-color-text, #333333);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Compact variant */
.arcane-calendar-compact {
  padding: 1rem;
  margin: 10px auto;
}

/* ========================================
   Calendar Header & Navigation
   ======================================== */

.arcane-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.arcane-calendar-theme-light .arcane-calendar-header {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

.arcane-calendar-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  flex: 1;
  margin: 0;
  line-height: 1.2;
}

.arcane-calendar-compact .arcane-calendar-title {
  font-size: 24px;
}

.arcane-calendar-navigation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.arcane-calendar-nav-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: currentColor;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  outline: none;
}

.arcane-calendar-nav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.arcane-calendar-nav-btn:active {
  transform: scale(0.95);
}

.arcane-calendar-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.arcane-calendar-theme-light .arcane-calendar-nav-btn {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

.arcane-calendar-theme-light .arcane-calendar-nav-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.2);
}

/* ========================================
   Calendar Grid Structure
   ======================================== */

.arcane-calendar-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  margin: 0;
}

.arcane-calendar-day-names {
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  color: currentColor;
  opacity: 0.8;
}

.arcane-calendar-theme-light .arcane-calendar-day-names {
  background: rgba(0, 0, 0, 0.05);
}

.arcane-calendar-day-names td {
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.arcane-calendar-compact .arcane-calendar-day-names td {
  padding: 0.5rem 0.25rem;
  font-size: 12px;
}

/* ========================================
   Calendar Day Cells
   ======================================== */

.arcane-calendar-day-cell {
  width: 14.28%; /* 1/7th for equal columns */
  height: 120px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  position: relative;
  vertical-align: top;
  cursor: pointer;
}

.arcane-calendar-compact .arcane-calendar-day-cell {
  height: 80px;
  padding: 6px;
}

.arcane-calendar-theme-light .arcane-calendar-day-cell {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

.arcane-calendar-day-cell:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.arcane-calendar-theme-light .arcane-calendar-day-cell:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.2);
}

/* Empty cells (days from other months) */
.arcane-calendar-day-cell.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
  opacity: 0.3;
}

.arcane-calendar-day-cell.empty:hover {
  transform: none;
  box-shadow: none;
  background: transparent;
}

/* Today highlight */
.arcane-calendar-day-cell.today {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.arcane-calendar-day-cell.today .arcane-calendar-day-number {
  color: #ffd700;
  font-weight: 800;
}

/* Day number */
.arcane-calendar-day-number {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  text-align: left;
  line-height: 1;
  color: currentColor;
}

.arcane-calendar-compact .arcane-calendar-day-number {
  font-size: 14px;
  margin-bottom: 2px;
}

/* ========================================
   Event Display
   ======================================== */

.arcane-calendar-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  max-height: calc(100% - 24px);
  overflow: hidden;
}

.arcane-calendar-compact .arcane-calendar-events {
  gap: 1px;
  margin-top: 2px;
  max-height: calc(100% - 18px);
}

.arcane-calendar-event {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.2;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arcane-calendar-compact .arcane-calendar-event {
  font-size: 9px;
  padding: 1px 4px;
}

.arcane-calendar-event:hover {
  transform: scale(1.05);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Festival events */
.arcane-calendar-event.festival-event {
  background: linear-gradient(135deg, #8B4513, #A0522D);
  color: #FFE4B5;
  border: 1px solid #CD853F;
}

.arcane-calendar-event.festival-event:hover {
  background: linear-gradient(135deg, #A0522D, #CD853F);
}

/* Season events */
.arcane-calendar-event.season-start-event {
  background: linear-gradient(135deg, #228B22, #32CD32);
  color: white;
  border: 1px solid #90EE90;
}

.arcane-calendar-event.season-end-event {
  background: linear-gradient(135deg, #B22222, #DC143C);
  color: white;
  border: 1px solid #FFB6C1;
}

.arcane-calendar-event.season-start-event:hover {
  background: linear-gradient(135deg, #32CD32, #00FF32);
}

.arcane-calendar-event.season-end-event:hover {
  background: linear-gradient(135deg, #DC143C, #FF1493);
}

/* Moon phase events */
.arcane-calendar-event.moon-phase-event {
  background: linear-gradient(135deg, #2F4F4F, #4682B4);
  color: #E0E0E0;
  border: 1px solid #87CEEB;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.arcane-calendar-event.moon-phase-event:hover {
  background: linear-gradient(135deg, #4682B4, #6495ED);
}

.arcane-calendar-event.moon-phase-event.new-moon {
  background: linear-gradient(135deg, #191970, #483D8B);
}

.arcane-calendar-event.moon-phase-event.full-moon {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #000080;
}

.arcane-calendar-event.moon-phase-event.first-quarter,
.arcane-calendar-event.moon-phase-event.last-quarter {
  background: linear-gradient(135deg, #708090, #B0C4DE);
  color: #000000;
}

/* Moon phase icons */
.arcane-calendar-moon-icon {
  font-size: 12px;
  line-height: 1;
}

.arcane-calendar-compact .arcane-calendar-moon-icon {
  font-size: 10px;
}

/* ========================================
   Calendar Legend
   ======================================== */

.arcane-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  justify-content: center;
  font-size: 13px;
}

.arcane-calendar-theme-light .arcane-calendar-legend {
  border-top-color: rgba(0, 0, 0, 0.1);
}

.arcane-calendar-compact .arcane-calendar-legend {
  margin-top: 1rem;
  padding-top: 0.75rem;
  font-size: 12px;
  gap: 0.75rem;
}

.arcane-calendar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.arcane-calendar-legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.arcane-calendar-compact .arcane-calendar-legend-color {
  width: 12px;
  height: 12px;
}

.arcane-calendar-legend-color.festival {
  background: linear-gradient(135deg, #8B4513, #A0522D);
}

.arcane-calendar-legend-color.season {
  background: linear-gradient(135deg, #228B22, #32CD32);
}

.arcane-calendar-legend-color.moon {
  background: linear-gradient(135deg, #2F4F4F, #4682B4);
}

/* ========================================
   Loading & Error States
   ======================================== */

.arcane-calendar-loading {
  text-align: center;
  padding: 3rem 1rem;
  font-size: 18px;
  opacity: 0.7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.arcane-calendar-loading::before {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: arcane-calendar-spin 1s linear infinite;
}

.arcane-calendar-error {
  text-align: center;
  padding: 2rem;
  color: #e74c3c;
  font-size: 16px;
  background: rgba(231, 76, 60, 0.1);
  border-radius: 8px;
  border: 2px solid rgba(231, 76, 60, 0.3);
}

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

/* ========================================
   Tooltips
   ======================================== */

.arcane-calendar-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  max-width: 200px;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.arcane-calendar-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .arcane-calendar-container {
    margin: 10px;
    padding: 1rem;
  }
  
  .arcane-calendar-title {
    font-size: 24px;
  }
  
  .arcane-calendar-day-cell {
    height: 100px;
    padding: 6px;
  }
  
  .arcane-calendar-day-number {
    font-size: 14px;
  }
  
  .arcane-calendar-event {
    font-size: 9px;
    padding: 1px 4px;
  }
  
  .arcane-calendar-legend {
    gap: 0.5rem;
    font-size: 12px;
  }
  
  .arcane-calendar-nav-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .arcane-calendar-container {
    margin: 5px;
    padding: 0.75rem;
  }
  
  .arcane-calendar-title {
    font-size: 20px;
  }
  
  .arcane-calendar-day-cell {
    height: 80px;
    padding: 4px;
  }
  
  .arcane-calendar-day-number {
    font-size: 12px;
  }
  
  .arcane-calendar-event {
    font-size: 8px;
    padding: 1px 3px;
  }
  
  .arcane-calendar-legend {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
  
  .arcane-calendar-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .arcane-calendar-navigation {
    order: -1;
  }
}

/* ========================================
   Accessibility
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .arcane-calendar-day-cell,
  .arcane-calendar-event,
  .arcane-calendar-nav-btn {
    transition: none !important;
    animation: none !important;
  }
  
  .arcane-calendar-day-cell:hover,
  .arcane-calendar-event:hover,
  .arcane-calendar-nav-btn:hover {
    transform: none !important;
  }
  
  .arcane-calendar-loading::before {
    animation: none !important;
    border-top-color: transparent;
  }
}

/* Focus styles for keyboard navigation */
.arcane-calendar-day-cell:focus,
.arcane-calendar-event:focus,
.arcane-calendar-nav-btn:focus {
  outline: 3px solid rgba(255, 215, 0, 0.6);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .arcane-calendar-container {
    border: 2px solid currentColor;
  }
  
  .arcane-calendar-day-cell {
    border: 1px solid currentColor;
  }
  
  .arcane-calendar-event {
    border: 1px solid currentColor;
  }
}

/* Print styles */
@media print {
  .arcane-calendar-container {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  .arcane-calendar-navigation {
    display: none;
  }
  
  .arcane-calendar-day-cell:hover {
    transform: none;
    box-shadow: none;
  }
}