/* ========================================
   HINDU PANCHANG CALENDAR - Premium Styling
   Uses CSS variables from style.css
   ======================================== */

/* Layout */
.calendar-layout {
  display: flex;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.calendar-main {
  flex: 1;
  min-width: 0;
}

/* Month Navigation */
.calendar-controls {
  margin-bottom: 20px;
}

.controls-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.btn-nav {
  background: var(--bg-tertiary);
  color: var(--saffron);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-poppins);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-nav:hover {
  background: var(--saffron);
  color: var(--bg-primary);
  box-shadow: var(--shadow-glow);
}

.month-year-display h2 {
  font-family: var(--font-cinzel);
  color: var(--saffron);
  font-size: 1.6rem;
  text-shadow: 0 0 10px rgba(255, 149, 0, 0.3);
}

/* Calendar Grid */
.calendar-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

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

/* Day Headers */
.day-header {
  text-align: center;
  padding: 10px 4px;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--saffron);
  background: var(--bg-tertiary);
  border-radius: 6px;
  letter-spacing: 0.5px;
}

/* Calendar Cell - Premium Panchang Card */
.calendar-cell {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.calendar-cell:hover {
  transform: translateY(-3px);
  border-color: var(--saffron);
  box-shadow: 0 0 20px rgba(255, 149, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.3);
}

.calendar-cell.empty {
  background: transparent;
  border: none;
  cursor: default;
  min-height: 0;
}

.calendar-cell.empty:hover {
  transform: none;
  box-shadow: none;
}

/* Cell Top Row: Date + Weekday */
.cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.cell-date {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.cell-weekday {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 600;
}

/* Cell Center: Tithi */
.cell-tithi {
  font-family: var(--font-devanagari);
  font-size: 0.72rem;
  color: var(--saffron);
  font-weight: 600;
  margin: 3px 0;
  line-height: 1.2;
}

/* Cell Bottom: Nakshatra + Moon Sign */
.cell-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cell-nakshatra {
  font-size: 0.62rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-rashi {
  font-size: 0.62rem;
  color: var(--text-tertiary);
}

/* Moon Phase Icon */
.cell-moon {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Festival Badge */
.cell-festival-badge {
  font-size: 0.55rem;
  background: linear-gradient(135deg, var(--saffron-dark), var(--saffron));
  color: #000;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Special Day Badge */
.cell-special-badge {
  font-size: 0.55rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
  margin-top: 2px;
}

/* ===== TODAY HIGHLIGHT ===== */
.calendar-cell.today {
  border: 2px solid var(--saffron);
  box-shadow: 0 0 15px rgba(255, 149, 0, 0.4);
  animation: todayPulse 2s ease-in-out infinite;
}

.calendar-cell.today .cell-date {
  color: var(--saffron);
}

.today-label {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--saffron);
  color: #000;
  font-size: 0.5rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 0 0 4px 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

@keyframes todayPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(255, 149, 0, 0.4); }
  50% { box-shadow: 0 0 25px rgba(255, 149, 0, 0.7); }
}

/* ===== SPECIAL DAY HIGHLIGHTING ===== */
.calendar-cell.purnima {
  background: linear-gradient(135deg, var(--bg-tertiary), rgba(255, 215, 0, 0.1));
  border-color: rgba(255, 215, 0, 0.5);
}
.calendar-cell.purnima .cell-special-badge {
  background: rgba(255, 215, 0, 0.2);
  color: #FFD700;
}

.calendar-cell.amavasya {
  background: linear-gradient(135deg, var(--bg-tertiary), rgba(100, 100, 150, 0.1));
  border-color: rgba(100, 100, 150, 0.5);
}
.calendar-cell.amavasya .cell-special-badge {
  background: rgba(100, 100, 150, 0.2);
  color: #9999cc;
}

.calendar-cell.ekadashi {
  background: linear-gradient(135deg, var(--bg-tertiary), rgba(76, 175, 80, 0.08));
  border-color: rgba(76, 175, 80, 0.4);
}
.calendar-cell.ekadashi .cell-special-badge {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
}

.calendar-cell.pradosh {
  border-color: rgba(156, 39, 176, 0.4);
}
.calendar-cell.pradosh .cell-special-badge {
  background: rgba(156, 39, 176, 0.2);
  color: #CE93D8;
}

.calendar-cell.chaturthi {
  border-color: rgba(255, 87, 34, 0.4);
}
.calendar-cell.chaturthi .cell-special-badge {
  background: rgba(255, 87, 34, 0.2);
  color: #FF7043;
}

.calendar-cell.festival {
  background: linear-gradient(135deg, var(--bg-tertiary), rgba(255, 149, 0, 0.1));
  border-color: var(--saffron);
}

/* Selected Cell */
.calendar-cell.selected {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* ===== LEGEND ===== */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 16px;
  margin-top: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.today-dot { background: var(--saffron); box-shadow: 0 0 6px var(--saffron); }
.purnima-dot { background: #FFD700; }
.amavasya-dot { background: #6666aa; }
.ekadashi-dot { background: #4CAF50; }
.festival-dot { background: linear-gradient(135deg, var(--saffron-dark), var(--saffron)); }

/* ===== ASTROLOGY SIDEBAR ===== */
.astrology-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  height: fit-content;
  position: sticky;
  top: 100px;
  box-shadow: var(--shadow-soft);
}

.sidebar-header {
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
  font-family: var(--font-cinzel);
  color: var(--saffron);
  font-size: 1.1rem;
}

.sidebar-date {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.sidebar-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 149, 0, 0.1);
}

.sidebar-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-value {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

/* ===== FESTIVALS SECTION ===== */
.festivals-section {
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 20px;
}

.festivals-section h2 {
  font-family: var(--font-cinzel);
  color: var(--saffron);
  margin-bottom: 20px;
  text-align: center;
}

.festivals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.festival-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  transition: var(--transition);
}

.festival-card:hover {
  border-color: var(--saffron);
  box-shadow: var(--shadow-glow);
}

.festival-card-name {
  font-weight: 700;
  color: var(--saffron);
  font-size: 0.95rem;
}

.festival-card-date {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.festival-card-hindi {
  font-family: var(--font-devanagari);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===== HINDU MONTHS SECTION ===== */
.months-section {
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 20px;
}

.months-section h2 {
  font-family: var(--font-cinzel);
  color: var(--saffron);
  margin-bottom: 20px;
  text-align: center;
}

.months-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.month-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  transition: var(--transition);
}

.month-card:hover {
  border-color: var(--saffron);
  box-shadow: var(--shadow-glow);
}

.month-card h3 {
  font-family: var(--font-devanagari);
  color: var(--saffron);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.month-card p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ===== PANCHANG DETAIL OVERLAY ===== */
.panchang-detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.panchang-detail-overlay.active {
  opacity: 1;
  visibility: visible;
}

.panchang-detail-card {
  background: var(--bg-secondary);
  width: 90%;
  max-width: 480px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--saffron);
  box-shadow: 0 0 40px rgba(255, 149, 0, 0.3);
  transform: scale(0.9);
  opacity: 0;
  transition: var(--transition);
}

.panchang-detail-card.active {
  transform: scale(1);
  opacity: 1;
}

.detail-header {
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border-bottom: 1px solid var(--border-color);
  padding: 20px;
  text-align: center;
  position: relative;
}

.detail-header h3 {
  color: var(--saffron);
  font-family: var(--font-cinzel);
  font-size: 1.2rem;
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 16px;
  color: var(--text-tertiary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.detail-close:hover {
  color: var(--saffron);
}

.detail-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 149, 0, 0.1);
}

.detail-label {
  font-weight: 600;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.detail-value {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.85rem;
  text-align: right;
}

/* Loading Spinner */
.loading-spinner {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-tertiary);
}

.spinner-ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--saffron);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 1s linear infinite;
}

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

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet */
@media (max-width: 1024px) {
  .calendar-layout {
    flex-direction: column;
  }

  .astrology-sidebar {
    width: 100%;
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
  }

  .sidebar-header {
    grid-column: 1 / -1;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .calendar-layout {
    padding: 0 10px;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-cell {
    padding: 5px;
    min-height: 90px;
    border-radius: 6px;
  }

  .cell-date { font-size: 0.9rem; }
  .cell-weekday { display: none; }
  .cell-tithi { font-size: 0.6rem; }
  .cell-nakshatra { font-size: 0.55rem; }
  .cell-rashi { display: none; }
  .cell-festival-badge { font-size: 0.5rem; }
  .today-label { font-size: 0.45rem; }

  .controls-wrapper {
    gap: 10px;
  }

  .btn-nav {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .month-year-display h2 {
    font-size: 1.2rem;
  }

  .astrology-sidebar {
    grid-template-columns: 1fr;
  }

  .festivals-grid {
    grid-template-columns: 1fr;
  }

  .months-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .calendar-cell {
    min-height: 70px;
    padding: 3px;
  }

  .cell-date { font-size: 0.8rem; }
  .cell-tithi { font-size: 0.55rem; }
  .cell-nakshatra { display: none; }
  .cell-moon { display: none; }
  .day-header { font-size: 0.65rem; padding: 6px 2px; }
}
