html {
  font-size: 14px;
  height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  margin: 0;
}

/* Custom Navbar Styles */
.custom-navbar {
  background-color: #122845 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 0.75rem 0;
}

.navbar-logo {
  height: 50px;
  width: 50px;
  object-fit: contain;
}

.brand-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
}

.custom-navbar .nav-link {
  color: rgba(255, 255, 255, 0.85) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  transition: all 0.3s ease;
  border-radius: 4px;
  margin: 0 0.25rem;
}

.custom-navbar .nav-link:hover {
  color: #fff !important;
  background-color: rgba(255, 255, 255, 0.1);
}

.custom-navbar .nav-link.active {
  color: #fff !important;
  background-color: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1 0 auto;
  padding: 2rem 0;
}

/* Panchang Page Styles */
.panchang-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Combined Date Card Styles */
.date-card {
  background: linear-gradient(135deg, #122845 0%, #1e3a5f 100%);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-bottom: 2rem;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.date-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.date-card-header {
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
  color: white;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.date-title {
  font-size: 2.0rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: white;
}

.week-name {
  font-size: 1.5rem;
  margin: 0.5rem 0;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

.festival-name {
  font-size: 1.5rem;
  color: #ffd700;
  font-weight: 600;
  margin: 0.75rem 0 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.date-card-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.95);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, #122845 0%, #1e3a5f 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-btn:hover {
  background: linear-gradient(135deg, #1e3a5f 0%, #2a4a7a 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  color: white;
}

.nav-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.nav-text {
  font-size: 0.95rem;
}

.date-picker-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 180px;
  position: relative;
}

.calendar-icon-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: #122845;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  padding: 0.5rem;
  border-radius: 6px;
}

.calendar-icon-label:hover {
  background-color: rgba(18, 40, 69, 0.05);
  color: #1e3a5f;
}

.calendar-icon-label svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.calendar-label {
  font-size: 0.95rem;
}

.date-picker {
  padding: 0.75rem 1rem;
  border: 2px solid #122845;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  color: #122845;
  background-color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 220px;
}

.date-picker:hover {
  background-color: #f8f9fa;
  border-color: #1e3a5f;
}

.date-picker:focus {
  outline: none;
  border-color: #1e3a5f;
  background-color: white;
  box-shadow: 0 0 0 3px rgba(18, 40, 69, 0.1);
}

/* Calendar icon for date input */
.date-picker::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.date-picker::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.panchang-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: center;
}

.panchang-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.panchang-card h3 {
  color: #122845;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #122845;
  font-weight: 600;
  text-align: center;
}

.panchang-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e9ecef;
  text-align: center;
}

.panchang-item:last-child {
  border-bottom: none;
}

.panchang-label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.25rem;
  text-align: center;
  font-size: 1.15rem;
}

.panchang-value {
  color: #212529;
  font-weight: 500;
  text-align: center;
  font-size: 1.15rem;
}

/* Responsive Grid for Cards */
.panchang-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 2rem;
}

/* Loading and Error States */
.loading-spinner {
  text-align: center;
  padding: 3rem;
}

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  padding: 1rem;
  border-radius: 5px;
  border: 1px solid #f5c6cb;
  margin: 1rem 0;
}

/* Footer */
.footer {
  background-color: #122845;
  color: rgba(255, 255, 255, 0.7);
  padding: 1.5rem 0;
  flex-shrink: 0;
  margin-top: auto;
}

.footer .text-muted {
  color: rgba(255, 255, 255, 0.7) !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.footer .container {
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar-logo {
    height: 40px;
    width: 40px;
  }

  .brand-text {
    font-size: 1.2rem;
  }

  .date-card-header {
    padding: 1.5rem 1rem 1rem;
  }

  .date-title {
    font-size: 1.8rem;
  }

  .week-name {
    font-size: 1.3rem;
  }

  .festival-name {
    font-size: 1.2rem;
  }

  .date-card-navigation {
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
  }

  .nav-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
  }

  .nav-text {
    font-size: 1rem;
  }

  .date-picker-wrapper {
    width: 100%;
    max-width: 100%;
    order: -1; /* Move calendar to top on mobile */
  }

  .calendar-icon-label {
    font-size: 1rem;
    display: flex !important;
    justify-content: center;
  }

  .calendar-icon-label svg {
    width: 28px;
    height: 28px;
    display: block;
  }

  .date-picker {
    max-width: 100%;
    font-size: 1.05rem;
    padding: 0.85rem 1rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23122845' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 24px;
    padding-right: 44px;
    appearance: none;
    -webkit-appearance: none;
  }

  /* Hide native indicator but keep it clickable over the whole input */
  .date-picker::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    color: transparent;
    background: transparent;
    opacity: 0;
    cursor: pointer;
  }

  .panchang-item {
    flex-direction: column;
    gap: 0.25rem;
  }

  /* Increase font size for labels and values on mobile */
  .panchang-label {
    flex: 1 1 100%;
    text-align: center;
    font-size: 1.3rem;
  }

  .panchang-value {
    flex: 1 1 100%;
    text-align: center;
    font-size: 1.3rem;
  }

  .panchang-container {
    padding: 0 1rem;
  }

  .panchang-grid {
    grid-template-columns: 1fr;
  }

  .custom-navbar .nav-link {
    margin: 0.25rem 0;
  }

  .footer {
    padding: 1.25rem 0;
  }

  .footer .text-muted {
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 0 0.5rem;
  }
}

@media (max-width: 576px) {
  .date-card-header {
    padding: 1.25rem 0.75rem 0.75rem;
  }

  .date-title {
    font-size: 1.5rem;
  }

  .week-name {
    font-size: 1.15rem;
  }

  .festival-name {
    font-size: 1.1rem;
  }

  .date-card-navigation {
    padding: 1rem;
  }

  .nav-btn {
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
  }

  .nav-icon {
    font-size: 1.1rem;
  }

  .calendar-icon-label {
    font-size: 0.95rem;
    display: flex !important;
    justify-content: center;
    padding: 0.75rem;
  }

  .calendar-icon-label svg {
    width: 26px;
    height: 26px;
    display: block;
  }

  .calendar-label {
    display: inline-block;
  }

  /* Adjust background icon size for small screens */
  .date-picker {
    background-size: 22px;
    background-position: right 10px center;
    padding-right: 40px;
  }

  .panchang-card {
    padding: 1rem;
  }

  .main-content {
    padding: 1rem 0;
  }

  .footer {
    padding: 1rem 0;
  }

  .footer .text-muted {
    font-size: 0.8rem;
    line-height: 1.6;
    padding: 0 0.25rem;
  }
}

/* Accessibility */
.btn:focus, 
.btn:active:focus, 
.btn-link.nav-link:focus, 
.form-control:focus, 
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Print Styles */
@media print {
  .custom-navbar,
  .footer {
    display: none;
  }

  .panchang-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Horoscope Styles */
.horoscope-card {
  border-bottom: 3px solid #e9ecef;
  margin-bottom: 1.5rem !important;
}

.horoscope-card:last-child {
  border-bottom: none;
}

.horoscope-header {
  border-bottom: 2px solid #dee2e6;
}

.horoscope-content {
  text-align: left;
  line-height: 1.8;
}

.horoscope-content p {
  font-size: 1.05rem;
  color: #212529;
  text-align: justify;
  margin-bottom: 1rem;
}

.hover-shadow {
  transition: all 0.3s ease;
}

.hover-shadow:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

/* Horoscope Header */
.panchang-header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.5rem 0;
}

.panchang-header h1 {
  color: #122845;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.panchang-header p {
  color: #495057;
  font-size: 1.2rem;
}

/* Responsive adjustments for horoscope */
@media (max-width: 768px) {
  .horoscope-content p {
    font-size: 1.2rem;
  }
  
  .panchang-header h1 {
    font-size: 2rem;
  }
  
  .panchang-header p {
    font-size: 1.1rem;
  }
}

@media (max-width: 576px) {
  .horoscope-content p {
    font-size: 1.15rem;
  }
  
  .panchang-header h1 {
    font-size: 1.75rem;
  }
  
  .panchang-header p {
    font-size: 1rem;
  }
}