/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #e8e0d4;
  --card:      #ffffff;
  --accent:    #ff6b35;
  --accent2:   #4ecdc4;
  --accent3:   #ffe66d;
  --accent4:   #a855f7;
  --accent5:   #ff85a1;
  --dark:      #1a1a2e;
  --border:    #1a1a2e;
  --shadow:    #1a1a2e;
  --radius:    12px;
  --border-w:  3px;
  --shadow-sm: 4px 4px 0 var(--shadow);
  --shadow-md: 6px 6px 0 var(--shadow);
  --shadow-lg: 8px 8px 0 var(--shadow);
  --font:      'Space Grotesk', sans-serif;
  --mono:      'Space Mono', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--dark);
  min-height: 100vh;
  padding: 1.5rem;
  background-image:
    radial-gradient(circle, #c8c0b4 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ── Layout ────────────────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
}

/* ── Header ────────────────────────────────────────────── */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.header h1 .highlight {
  background: var(--accent3);
  padding: 0.05em 0.25em;
  border: var(--border-w) solid var(--border);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--shadow);
  display: inline-block;
}

.header p {
  font-size: 1rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

/* ── Card base ─────────────────────────────────────────── */
.card {
  background: var(--card);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
}

/* ── Search Section ────────────────────────────────────── */
.search-section {
  margin-bottom: 1.5rem;
}

.search-section .card {
  position: relative;
}

.search-label {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-label .icon {
  font-size: 1.1rem;
}

.search-wrapper {
  display: flex;
  gap: 0.75rem;
}

.search-input {
  flex: 1;
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: var(--border-w) solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  outline: none;
  transition: box-shadow 0.15s;
}

.search-input:focus {
  box-shadow: var(--shadow-sm);
}

.search-input::placeholder { color: #999; }

.btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border: var(--border-w) solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #e85d2c;
}

/* ── Dropdown Results ──────────────────────────────────── */
.dropdown {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  top: calc(100% - 0.5rem);
  z-index: 50;
  background: var(--card);
  border: var(--border-w) solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow-y: auto;
  display: none;
}

.dropdown.active { display: block; }

.dropdown-item {
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 1px solid #eee;
  transition: background 0.1s;
}

.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--accent3); }

/* ── Info Bar ──────────────────────────────────────────── */
.info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: var(--border-w) solid var(--border);
  border-radius: 50px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.info-chip.date-chip  { background: var(--accent3); }
.info-chip.city-chip  { background: var(--accent2); }
.info-chip.prov-chip  { background: var(--accent5); }

/* ── Schedule Grid ─────────────────────────────────────── */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.prayer-card {
  background: var(--card);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.prayer-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
}

.prayer-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 var(--shadow);
}

.prayer-card.imsak   { --card-color: #94a3b8; }
.prayer-card.subuh   { --card-color: #6366f1; }
.prayer-card.terbit  { --card-color: #f59e0b; }
.prayer-card.dhuha   { --card-color: #eab308; }
.prayer-card.dzuhur  { --card-color: #ff6b35; }
.prayer-card.ashar   { --card-color: #4ecdc4; }
.prayer-card.maghrib { --card-color: #a855f7; }
.prayer-card.isya    { --card-color: #1a1a2e; }

.prayer-card::before { background: var(--card-color); }

.prayer-card .prayer-icon {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.prayer-card .prayer-name {
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.5rem;
  color: #555;
}

.prayer-card .prayer-time {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: 2px;
}

.prayer-card.active-prayer {
  background: var(--card-color);
  color: #fff;
}

.prayer-card.active-prayer .prayer-name,
.prayer-card.active-prayer .prayer-time {
  color: #fff;
}

.prayer-card.active-prayer .badge-now {
  display: inline-block;
}

.badge-now {
  display: none;
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  border: 2px solid #fff;
  background: rgba(255,255,255,0.25);
  color: #fff;
  margin-bottom: 0.4rem;
}

/* ── Clock ─────────────────────────────────────────────── */
.clock-section {
  margin-bottom: 1.5rem;
}

.clock-card {
  text-align: center;
  background: var(--dark);
  color: #fff;
}

.clock-time {
  font-family: var(--mono);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  letter-spacing: 4px;
}

.clock-date {
  font-size: 0.95rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

.next-prayer-info {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.next-prayer-label {
  font-size: 0.8rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.next-prayer-name {
  font-weight: 700;
  font-size: 1.1rem;
  background: var(--accent);
  padding: 0.15em 0.6em;
  border-radius: 6px;
  display: inline-block;
}

.next-prayer-countdown {
  font-family: var(--mono);
  font-size: 1.1rem;
  background: rgba(255,255,255,0.1);
  padding: 0.15em 0.6em;
  border-radius: 6px;
}

/* ── Empty / Loading States ────────────────────────────── */
.state-message {
  text-align: center;
  padding: 3rem 1rem;
}

.state-message .state-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.state-message h3 {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.state-message p {
  opacity: 0.6;
  font-size: 0.9rem;
}

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

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

/* ── Footer ────────────────────────────────────────────── */
.footer {
  text-align: center;
  margin-top: 2rem;
  padding: 1rem;
  font-size: 0.8rem;
  opacity: 0.5;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 600px) {
  body { padding: 1rem; }

  .search-wrapper {
    flex-direction: column;
  }

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

  .prayer-card .prayer-time {
    font-size: 1.5rem;
  }

  .info-bar {
    justify-content: center;
  }
}

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

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.35s ease-out both;
}

.schedule-grid .prayer-card:nth-child(1) { animation-delay: 0.03s; }
.schedule-grid .prayer-card:nth-child(2) { animation-delay: 0.06s; }
.schedule-grid .prayer-card:nth-child(3) { animation-delay: 0.09s; }
.schedule-grid .prayer-card:nth-child(4) { animation-delay: 0.12s; }
.schedule-grid .prayer-card:nth-child(5) { animation-delay: 0.15s; }
.schedule-grid .prayer-card:nth-child(6) { animation-delay: 0.18s; }
.schedule-grid .prayer-card:nth-child(7) { animation-delay: 0.21s; }
.schedule-grid .prayer-card:nth-child(8) { animation-delay: 0.24s; }

/* ── Scrollbar ─────────────────────────────────────────── */
.dropdown::-webkit-scrollbar { width: 8px; }
.dropdown::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 0 8px 8px 0; }
.dropdown::-webkit-scrollbar-thumb { background: var(--dark); border-radius: 8px; }
