/* css/calendar.css */

.calendar-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin: var(--space-lg) 0;
}

.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-primary);
  color: white;
}
.calendar-nav h2 {
  font-family: var(--font-kn-serif);
  font-size: 1.3rem;
  text-align: center;
}
.calendar-nav .month-kn { display: block; font-size: 0.85rem; opacity: 0.85; }
.nav-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.nav-btn:hover { background: rgba(255,255,255,0.35); }
.nav-btn-print { width: auto; min-width: 44px; padding: 0 var(--space-sm); border-radius: var(--radius-sm); font-size: 0.9rem; }

.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: #F5EDE8;
  border-left: 1px solid var(--border);
  border-bottom: 2px solid var(--color-secondary);
}
[data-theme="dark"] .calendar-days-header { background: #2A1A1A; }
.day-header {
  padding: var(--space-sm);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  box-sizing: border-box;
  min-width: 0;
}
.day-header.sunday { color: var(--color-major); }
.day-header.saturday { color: var(--color-vrat); }

/* Wrapper for horizontal scroll on narrow viewports */
.calendar-scroll-wrap {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}
.calendar-scroll-wrap .calendar-days-header,
.calendar-scroll-wrap .calendar-grid { min-width: 280px; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  box-sizing: border-box;
}

.cal-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--space-xs) var(--space-sm);
  min-height: 70px;
  min-width: 0;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  box-sizing: border-box;
}
.cal-cell:hover { background: rgba(196, 30, 58, 0.05); }
.cal-cell.empty { background: var(--bg); cursor: default; }
.cal-cell.today { background: var(--color-today); }
.cal-cell.holiday { background: #FFF0F0; }
[data-theme="dark"] .cal-cell.holiday { background: #2A1010; }

.cal-date {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  line-height: 1;
}
.cal-cell.sunday .cal-date { color: var(--color-major); }
.cal-cell.saturday .cal-date { color: var(--color-vrat); }
.cal-cell.holiday .cal-date { color: var(--color-major); }

.cal-tithi {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.cal-festival {
  display: block;
  font-size: 0.6rem;
  line-height: 1.2;
  margin-top: 3px;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.festival-major    { background: #FECDD3; color: #9F1239; }
.festival-national { background: #FED7AA; color: #92400E; }
.festival-vrat     { background: #E9D5FF; color: #5B21B6; }
.festival-moon     { background: #BFDBFE; color: #1E40AF; }
.festival-auspicious { background: #BBF7D0; color: #065F46; }

.cal-cell.today::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: var(--color-primary);
  border-radius: 50%;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8rem;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
