/* Imsakiyah Page Styling - Portal Integrated Edition */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;700;800;900&display=swap');

:root {
  --primary: #2d5a27;
  --secondary: #d4af37;
  --bg-color: #fffdd0;
  --text-dark: #333333;
  --text-muted: #4b5563;
  --border-light: rgba(45, 90, 39, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
}

.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: -30px;
  position: relative;
  z-index: 10;
}

/* Page Hero */
.page-hero {
  text-align: center;
  background: linear-gradient(rgba(45, 90, 39, 0.8), rgba(45, 90, 39, 1));
  color: white;
  position: relative;
}

.page-hero h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.2rem, 10vw, 3.2rem);
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}

.page-hero p {
  font-size: 1.1rem;
  opacity: 0.8;
  max-width: 500px;
  margin: 0 auto;
}

.page-hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30px;
  background: var(--bg-color);
  clip-path: polygon(0 100%, 100% 100%, 100% 0, 50% 100%, 0 0);
}

/* Selection Card */
.selection-card {
  background: white;
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

.dzikir-selector label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.select-trigger:hover {
  background: #f1f5f9;
}

.select-trigger:active {
  transform: scale(0.98);
  background: #e2e8f0;
}

.custom-options-container {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-top: 5px;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  z-index: 100;
  display: none;
  overflow: hidden;
}

.custom-select-wrapper.open .custom-options-container {
  display: block;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 1px solid var(--border-light);
  outline: none;
  font-size: 0.9rem;
}

.options-list {
  max-height: 250px;
  overflow-y: auto;
  list-style: none;
  padding: 0;
  margin: 0;
}

.options-list li {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.options-list li:hover {
  background: rgba(45, 90, 39, 0.05);
  color: var(--primary);
  font-weight: 600;
}

/* Schedule Section Cardified */
#schedule-content {
  background: white;
  padding: 2.5rem;
  border-radius: 24px;
  border: 1px solid var(--border-light);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.03);
  margin-top: 1rem;
}

.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.location-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-gold {
  color: var(--secondary);
}

.schedule-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.date-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.view-toggle {
  display: flex;
  background: var(--bg-light);
  padding: 2px;
  border-radius: 6px;
}

.toggle-btn {
  border: none;
  background: none;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-muted);
}

.toggle-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}

.toggle-btn:active {
  transform: scale(0.95);
}

/* Cards View Area */
/* View Areas - Removing individual bg since parent has it */
.view-container {
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.date-header-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .date-header-card {
    grid-template-columns: 1fr;
  }
}

.date-info {
  background: #fdfdfd;
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(45, 90, 39, 0.05);
}

.date-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.today-badge-mini {
  background: var(--primary);
  color: white;
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap; /* Prevent wrapping */
}

@media (max-width: 480px) {
  .date-info h3 {
    flex-direction: column;
    gap: 0.25rem;
  }
}

.hijri-date {
  color: var(--secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

.countdown-card {
  background: var(--primary);
  color: white;
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(45, 90, 39, 0.2);
}

.countdown-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.7;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.timer {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.8rem, 8vw, 2.5rem);
  font-weight: 800;
}

/* Progress Section */
.progress-section {
  margin-top: 1.25rem;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.6;
  margin-bottom: 0.4rem;
}

.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--secondary);
  width: 0%;
  transition: width 1s ease;
}

.progress-status {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--secondary);
  margin-top: 0.4rem;
}

/* Prayer Grid */
.prayer-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.prayer-card {
  background: white;
  padding: 0.75rem 0.5rem; /* Reduced for better fit in one row */
  border-radius: 12px;
  border: 1px solid var(--border-light);
  text-align: center;
  transition: transform 0.2s;
}

.prayer-card.highlight {
  border-color: var(--primary);
  background: rgba(45, 90, 39, 0.05);
}

.prayer-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.prayer-card.highlight .prayer-name {
  color: var(--primary);
}

.prayer-time {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.1rem, 4vw, 1.3rem);
  font-weight: 700;
}

@media (max-width: 768px) {
  .app-container {
    padding: 0 1rem 2rem;
    margin-top: -20px;
  }

  #schedule-content {
    padding: 1.5rem 1rem;
    border-radius: 16px;
  }

  .prayer-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .prayer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}

@media (max-width: 340px) {
  .prayer-grid {
    grid-template-columns: 1fr;
  }
}

/* Table View */
.table-responsive {
  border: none;
  border-radius: 16px;
  overflow: auto;
  max-height: 480px; /* Fits roughly 7-8 rows (one week) */
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.table-responsive::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome, Safari and Opera */
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #f8fafc;
  padding: 1rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  text-align: center;
  border-bottom: 2px solid #eef2f6;
  position: sticky;
  top: 0;
  z-index: 10;
}

td {
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 1px solid #f1f5f9;
}

tr.today {
  background: rgba(45, 90, 39, 0.08); /* Slightly darker */
  color: var(--primary);
  font-weight: 700;
  position: relative;
}

tr.today td:first-child::before {
  content: 'HARI INI';
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: white;
  font-size: 0.55rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 800;
}

tr.today td:first-child {
  padding-left: 3rem; /* Make room for badge */
}

/* States */
.status-message {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

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

.hidden { display: none !important; }
