/* Modern Premium Panchang Calendar Modal CSS */
.panchang-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10005;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.panchang-modal-backdrop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.panchang-modal-card {
  background: #fcf9f2;
  border-radius: 20px;
  width: 95%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 15px 30px rgba(0,0,0,0.25);
  border: 1px solid #e2d7c5;
  font-family: 'Outfit', 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.panchang-modal-backdrop.show .panchang-modal-card {
  transform: scale(1);
}

/* Header */
.panchang-modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 20px;
  background: #fdfbf7;
  border-bottom: 1px solid #ebdcb9;
  position: relative;
  flex-shrink: 0;
  min-height: 52px;
  box-sizing: border-box;
}
.modal-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 14px;
  top: 50%;
  bottom: auto;
  left: auto;
  width: 34px;
  height: 34px;
  margin: 0;
  margin-top: -17px;
  line-height: 0;
  border-radius: 50%;
  z-index: 2;
  transform: none;
}
.modal-back-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}
.modal-header-title {
  font-size: 18px;
  font-weight: 700;
  color: #3c281e;
  text-align: center;
  line-height: 1.2;
  margin: 0;
}

/* Navigation Bar */
.panchang-modal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #fdfbf7;
  flex-shrink: 0;
}
.nav-arrow-btn {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: #7d6b58;
  cursor: pointer;
  transition: color 0.2s;
}
.nav-arrow-btn:hover {
  color: #3c281e;
}
.nav-month-title {
  font-size: 16px;
  font-weight: 700;
  color: #3c281e;
}

/* Tabs Selector */
.panchang-modal-tabs {
  display: flex;
  background: #efebe4;
  margin: 0 15px 15px 15px;
  border-radius: 10px;
  padding: 4px;
}
.panchang-modal-tabs .tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #7d6b58;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.panchang-modal-tabs .tab-btn.active {
  background: #b08d57;
  color: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Zodiac Header (Dark Brown) */
.zodiac-info-bar {
  background: #3c281e;
  color: white;
  padding: 15px;
  margin: 0 15px 15px 15px;
  border-radius: 12px;
  text-align: center;
}
.zodiac-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}
.zodiac-month-guj {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}
.zodiac-date-range {
  font-size: 12px;
  opacity: 0.9;
}
.zodiac-vs-year {
  font-weight: 600;
  font-size: 13px;
}
.zodiac-today-pill {
  display: inline-block;
  padding: 4px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  position: relative;
  background: rgba(255, 255, 255, 0.08);
}
.zodiac-today-pill::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 20px;
  padding: 1px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.8),
    rgba(255, 255, 255, 0.8) 5px,
    transparent 5px,
    transparent 10px
  );
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  animation: crawl 1.2s infinite linear;
}

/* Table Grid Styling */
.sideways-grid-wrapper {
  padding: 0 15px 15px 15px;
  overflow-x: auto;
}
.sideways-calendar-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.sideways-calendar-table td {
  border: 1px solid #ebdcb9;
  text-align: center;
  padding: 8px 4px;
  vertical-align: middle;
  font-family: inherit;
}
.weekday-label-cell {
  background: #4a382e;
  color: white;
  font-weight: 700;
  font-size: 11px;
  width: 50px;
  text-transform: uppercase;
}
.calendar-cell {
  min-width: 60px;
  height: 65px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.calendar-cell:hover {
  background: #fdfaf2;
}
.calendar-cell.parva-highlight {
  background-color: #e5eef9 !important;
}
.cell-tithi-num {
  font-size: 18px;
  font-weight: 700;
  color: #3c281e;
  display: block;
  margin-bottom: 2px;
}
.cell-tithi-num.red-tithi {
  color: #ff3b30 !important;
}
.cell-paksha {
  font-size: 10px;
  font-weight: 600;
  color: #7d6b58;
  display: block;
  margin-bottom: 2px;
}
.cell-paksha.red-paksha {
  color: #ff3b30 !important;
}
.cell-gregorian-date {
  font-size: 9px;
  color: #9e8e7c;
  display: block;
}
.cell-gregorian-date.red-date {
  color: #ff3b30 !important;
}
.cell-empty-dash {
  font-size: 18px;
  color: #d1c7bd;
  font-weight: 500;
}

/* Today Cell Highlight */
.calendar-cell.today-highlight {
  background: #ffeb3b !important;
  position: relative;
  border: none !important;
  border-radius: 8px;
}
.calendar-cell.today-highlight::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 8px;
  padding: 2px;
  background: repeating-linear-gradient(
    -45deg,
    #ff9800,
    #ff9800 6px,
    transparent 6px,
    transparent 12px
  );
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  animation: crawl 1.2s infinite linear;
}
.calendar-cell.today-highlight .cell-tithi-num {
  color: #3c281e !important;
}
.calendar-cell.today-highlight .cell-paksha {
  color: #5d4037 !important;
}
.calendar-cell.today-highlight .cell-gregorian-date {
  color: #795548 !important;
}

/* Digital List View */
.digital-view-container {
  padding: 0 15px 15px 15px;
}
.digital-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: white;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #ebdcb9;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.digital-list-row.today-row {
  background: #fffde7;
  border: 1px solid #ffb74d;
}
.digital-row-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.digital-tithi-label {
  font-size: 15px;
  font-weight: 700;
  color: #3c281e;
}
.digital-date-label {
  font-size: 11px;
  color: #7d6b58;
}
.digital-row-right {
  font-size: 13px;
  font-weight: 600;
  color: #b08d57;
}

.hidden {
  display: none !important;
}

@keyframes crawl {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 14.14px 14.14px;
  }
}

.nav-timing-row { display: flex; justify-content: space-between; align-items: center; margin: 0 auto 15px; font-size: 18px; max-width: 220px; }

/* Compact modals on tablet / phone */
@media (max-width: 991px) {
  .panchang-modal-backdrop {
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
  }

  .panchang-modal-card {
    width: min(94vw, 400px);
    max-width: 400px;
    max-height: min(85vh, 85dvh);
    border-radius: 14px;
  }

  .panchang-modal-header {
    padding: 12px 16px;
    min-height: 48px;
    flex-shrink: 0;
  }

  .modal-header-title {
    font-size: 16px;
    line-height: 1.2;
  }

  .modal-back-btn {
    right: 12px;
    top: 50%;
    bottom: auto;
    left: auto;
    width: 34px;
    height: 34px;
    margin: 0;
    margin-top: -17px;
    padding: 5px;
    transform: none;
  }

  .modal-back-btn svg {
    width: 20px;
    height: 20px;
  }

  .panchang-modal-nav {
    padding: 8px 12px;
  }

  .nav-arrow-btn {
    font-size: 12px;
  }

  .nav-month-title {
    font-size: 14px;
  }

  .zodiac-info-bar {
    padding: 10px;
    margin: 0 10px 10px;
  }

  .zodiac-month-guj {
    font-size: 15px;
  }

  .zodiac-date-range,
  .zodiac-vs-year,
  .zodiac-today-pill {
    font-size: 11px;
  }

  .sideways-grid-wrapper,
  .digital-view-container {
    padding: 0 10px 10px;
  }

  .calendar-cell {
    min-width: 48px;
    height: 54px;
    padding: 4px 2px;
  }

  .cell-tithi-num {
    font-size: 15px;
  }

  .weekday-label-cell {
    width: 42px;
    font-size: 10px;
    padding: 4px 2px;
  }

  /* Navkarshi / city-time modal */
  #navkarshi-modal .panchang-modal-card {
    padding: 10px !important;
    max-width: 360px !important;
    max-height: min(82vh, 82dvh);
  }

  #navkarshi-modal-close-arrow {
    top: 8px !important;
    right: 8px !important;
    padding: 2px !important;
    width: 28px;
    height: 28px;
  }

  #navkarshi-modal-close-arrow svg {
    width: 18px;
    height: 18px;
  }

  #navkarshi-modal .nav-timing-row {
    margin: 0 auto 8px;
    font-size: 14px;
    max-width: 200px;
  }

  #navkarshi-modal .nav-timing-row:last-child {
    margin-bottom: 0 !important;
  }
}

@media (max-width: 575px) {
  .panchang-modal-card {
    width: min(96vw, 360px);
    max-height: min(80vh, 80dvh);
    border-radius: 12px;
  }

  .panchang-modal-header {
    padding: 12px 14px;
    min-height: 48px;
  }

  .modal-header-title {
    font-size: 16px;
  }

  .modal-back-btn {
    right: 12px;
    top: 50%;
    bottom: auto;
    left: auto;
    width: 34px;
    height: 34px;
    margin: 0;
    margin-top: -17px;
    padding: 5px;
    transform: none;
  }

  .modal-back-btn svg {
    width: 20px;
    height: 20px;
  }

  .panchang-modal-nav {
    padding: 6px 10px;
  }

  .zodiac-info-bar {
    padding: 8px;
    margin: 0 8px 8px;
  }

  .zodiac-top-row {
    margin-bottom: 6px;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .sideways-grid-wrapper,
  .digital-view-container {
    padding: 0 8px 8px;
  }

  .calendar-cell {
    min-width: 42px;
    height: 48px;
  }

  .cell-tithi-num {
    font-size: 13px;
  }

  .cell-paksha {
    font-size: 9px;
  }

  .cell-gregorian-date {
    font-size: 8px;
  }

  #navkarshi-modal .panchang-modal-card {
    padding: 8px !important;
    max-width: 340px !important;
    max-height: min(78vh, 78dvh);
  }

  #navkarshi-modal .navkarshi-inner-card {
    padding: 10px !important;
  }

  #navkarshi-modal .nav-timing-row {
    font-size: 13px;
    margin-bottom: 6px;
  }
}

@media (max-width: 390px) {
  .panchang-modal-card {
    max-height: min(78vh, 78dvh);
  }

  #navkarshi-modal .panchang-modal-card {
    max-height: min(76vh, 76dvh);
  }
}
