/* Minimal Critical CSS */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Prevent whole page scroll */
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}
.container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}
main[role="main"] {
  flex: 1 1 auto;
  min-height: 0;
 overflow: auto;
  /* For smooth scrolling on mobile */
  -webkit-overflow-scrolling: touch;
  background: #f8f9fa;
  position: relative;
  padding-bottom: 4.5rem; /* Space for bottom bar */
  width: 97vw;
  max-width: 97vw;
  box-sizing: border-box;
  margin: 0 auto;
}

@media (min-width: 900px), (orientation: landscape) {
  main[role="main"] {
    overflow: auto;
    width: 97%;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 12px;
  }
}

/* Header Styles */
.header {
  z-index: 1000;
  text-align: center;
  padding: 1.3rem;
  /* Minimized padding */
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
  color: #fff;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    margin-bottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform, height, margin-bottom;
}

.header.hide {
  opacity: 0;
  transform: translateY(-60px) scaleY(0.7);
  pointer-events: none;
  height: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
}

.header h1 {
  font-size: 2rem;
  font-weight: 600;
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
}

/* Main Content Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  padding: 1rem 0;
  margin-bottom: 4rem;
}

.icon-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.2s ease;
  text-decoration: none;
  color: #1f2937;
  will-change: transform;
  border: 1px solid #e5e7eb;
}

.icon-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.icon-card:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #4f46e5;
  height: 40px;
}

/* Navigation Bar */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  padding: 1rem;
  display: flex;
  justify-content: space-around;
  border-top: 1px solid #e5e7eb;
  backdrop-filter: blur(10px);
}

.nav-icon {
  font-size: 1.25rem;
  color: #4b5563;
  padding: 0.75rem;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.nav-icon:hover {
  color: #764ba2;
}

/* Accessibility Improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
  .icon-card {
    transition: none;
  }
}

@media (min-width: 640px) {
  .header {
    padding: 1rem;
    z-index: 1000;
  }

  .header h1 {
    font-size: 2.5rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid {
  animation: fadeIn 0.5s ease-out;
}

/* Language Switcher */
.lang-switcher {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.5rem;
  border-radius: 8px;
  backdrop-filter: blur(5px);
}

.lang-switcher select {
  border: none;
  background: transparent;
  font-size: 0.9rem;
  padding: 0.3rem;
}

/* Prayer Times Bar Styles */
#prayerTimesBar {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  position: absolute;
  top: 0.7rem;
  right: 0.1rem;
  min-width: 120px;
  background: none !important;
  box-shadow: none !important;
  border-radius: 0;
  padding: 0;
  z-index: 10;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

#prayerTimesBar:hover {
  background: rgba(67, 160, 71, 0.07);
  border-radius: 8px;
}

#prayerTimesPopup {
  display: none;
  position: absolute;
  top: 2.5rem;
  right: 0;
  background: #fff;
  color: #222;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(67, 160, 71, 0.13);
  padding: 1rem 1.2rem;
  z-index: 100;
  min-width: 180px;
  font-size: 1rem;
  text-align: right;
  animation: fadeIn 0.2s;
}

#prayerTimesPopup .prayer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.18rem;
}

#prayerTimesPopup .prayer-row:last-child {
  margin-bottom: 0;
}

#prayerTimesPopup .prayer-name {
  font-weight: 700;
}

#prayerTimesPopup .prayer-time {
  font-family: monospace;
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
}

#prayerTimesPopup .current {
  background: #43a047;
  color: #fff;
  font-weight: 900;
}

#islamicDateBar {
  position: absolute;
  top: 0rem;
  font-size: 1.05rem;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.07);
  display: flex;
  align-items: center;
  min-width: 120px;
  justify-content: flex-start;
}

@media (max-width: 700px) {
  .header {
    flex-direction: column;
    padding: 0rem 1rem 1rem 1rem;
    z-index: 1000;
  }
 #prayerTimesBar{
  position: absolute !important;
  top: 0.1rem !important;
 }
  #prayerTimesBar,
  #islamicDateBar {
    position: static;
    left: unset;
    right: unset;
    top: unset;
    min-width: unset;
    width: 100%;
    text-align: center;
    margin-left: 19px;
  }

  .header h1 {
    font-size: 1.4rem;
  }

  .grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 0.4rem !important;
    padding: 0.5rem 0 !important;
    margin-bottom: 2rem !important;
  }

  .icon-card {
    padding: 0.7rem 0.2rem !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
  }

  .icon {
    font-size: 1.2rem !important;
    margin-bottom: 0.4rem !important;
    height: 28px !important;
  }
}

#quranAudioBar span {
  display: inline;
}

@media (max-width: 700px) and (orientation: portrait) {
  #quranAudioBar span {
    /* display: none !important; */
  }
}

#dailyHadithBar {
  position: absolute;
  top: 0.7rem;
  left: 0.1rem;
  max-width: 360px;
  /* background: rgba(255,255,255,0.13); */
  color: #fff;
  padding: 0.1rem 0.1rem;
  border-radius: 8px;
  font-size: 1.02rem;
  font-weight: bold;
  text-align: justify;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.07);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: max-width 0.5s, background 0.5s;
}

@media (max-width: 700px) and (orientation: portrait) {
  #dailyHadithBar {
    left: 0.1rem;
    right: auto;
    top: 0.7rem;
    /* max-width: 120px; */
    /* background: rgba(67,70,229,0.13); */
    text-align: left;
  }
}

/* Quran Modal Styles */
#quranModal {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
}

#quranModal .modal-content {
  background: #fff;
  color: #222;
  max-width: 95vw;
  width: 480px;
  max-height: 90vh;
  overflow: auto;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(67, 70, 229, 0.18);
  position: relative;
  padding: 1rem;
}

#quranModal button.close,
#closeSunnatModal,
#closeTvModal {
  background: #fff !important;
  border: none;
  font-size: 1.5rem;
  color: #4f46e5;
  cursor: pointer;
  border-radius: 50%;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(67, 70, 229, 0.1);
  transition: background 0.2s;
}

#quranModal button.close {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
}

#quranModal iframe {
  width: 100%;
  height: 70vh;
  border: none;
  border-radius: 0 0 14px 14px;
}

#quranAudioBar #quranPopupBtn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0 0 0 0.2rem;
}

#quranAudioBar #quranPopupBtn i {
  color: #fff;
  font-size: 1.1rem;
}

#dailyHadithBar button {
  border: none;
  border-radius: 50%;
  width: 2.3rem;
  height: 2.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(67, 160, 71, 0.13);
}

/* Add this inside your .header div, before #islamicDateBar */
button#newsPopupBtn,
button#meetBtn {
  background: #fff;
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(67, 70, 229, 0.1);
  cursor: pointer;
  margin-left: 1rem;
  margin-top: 1rem;
}

button#newsPopupBtn i {
  color: #4f46e5;
  font-size: 1.2rem;
}

@media (max-width: 700px) and (orientation: portrait) {
  button#newsPopupBtn,
  button#meetBtn {
    margin-top: 0;
  }
}

/* Responsive Meet Icon and Popup Example */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

nav {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f5f5f5;
}

.popup-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-content {
  background: #fff;
  border-radius: 12px;
  width: 95vw;
  max-width: 900px;
  height: 90vh;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: #eee;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
}

.popup-iframe {
  width: 100%;
  height: 100%;
  border: none;
  flex: 1;
}

/* End of Demographics Section Styles */

.top-tab-bar {
  background: white;
  padding: 0.3rem 0.5rem;
  margin-bottom: 1rem;
  min-height: 44px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.04);
  margin-top: 0;
  border-radius: 10px 10px 0 0;
  border-bottom-width: 1px;
  border-bottom-style: outset;
  border-bottom-color: #e5ebfd;
  transition: opacity 0.2s;
  position: relative;
}
.top-tab-btn {
  background: none;
  border: none;
  color: #4f46e5;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.5rem 1.1rem 0.3rem 1.1rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  position: relative;
  outline: none;
}
.top-tab-btn.active,
.top-tab-btn:focus {
  background: #fff;
  color: #4f46e5;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.09);
  z-index: 2;
}
.top-tab-btn.active::after {
  content: "";
  display: block;
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #544be6;
  z-index: 3;
}
.top-tab-btn .tab-text {
  display: inline;
}
/* Hide top bar text on mobile portrait */
@media (max-width: 700px) and (orientation: portrait) {
  .top-tab-bar {
    font-size: 0.98rem;
    gap: 0.5rem;
    margin-top: 0;
  }
  .top-tab-btn .tab-text {
    display: none !important;
  }
  .top-tab-btn {
    padding: 0.4rem 0.7rem 0.2rem 0.7rem;
    font-size: 0.97rem;
    gap: 0;
  }
}
.bt-tab {
  background: none;
  border: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: #4f46e5;
  padding: 0.2rem 0;
  min-width: 60px;
  transition: background 0.15s;
  border-radius: 8px 8px 0 0;
  position: relative;
  outline: none;
}
.bt-tab i {
  font-size: 1.5rem;
  margin-bottom: 0.1em;
  transition: color 0.15s;
}
.bt-tab .bt-label {
  display: none;
  font-size: 0.92rem;
  margin-top: 0.1em;
  color: #4f46e5;
  font-weight: 500;
  letter-spacing: 0.01em;
}
@media (min-width: 701px), (orientation: landscape) {
  .bt-tab .bt-label {
    display: block;
  }
}
.bt-tab.active {
  background: #f3f4f6;
  box-shadow: 0 -2px 8px rgba(79, 70, 229, 0.09);
  z-index: 2;
}
.bt-tab.active i {
  color: #fff !important;
  background: #4f46e5;
  width: 90%;
  border-radius: 10px 10px 0 0;
  padding: 0.3em;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.13);
}
.bt-tab.active .bt-label {
  color: #4f46e5;
  font-weight: 700;
}
.bt-tab.active::before {
  content: "";
  display: block;
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #f3f4f6;
  z-index: 3;
}
.bottom-tab-bar {
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}
main[role="main"] {
  min-height: 300px;
  width: 97%;
  overflow: auto;
  position: relative;
  transition: box-shadow 0.2s;
  box-shadow: 0 0 0 0 transparent;
}
main[role="main"].highlighted {
  box-shadow: 0 0 0 3px #4f46e5;
  border-radius: 12px;
  transition: box-shadow 0.2s;
}
