/* ==========================================================================
   DAWAT-E-ISLAMI PRAYER SYSTEM - DESIGN SYSTEM & STYLESHEET
   Aesthetic: Dark Gradient & Glassmorphism Interface
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-obsidian: #0B0F17;
  --bg-slate: #0F172A;
  --bg-indigo: #1E1B4B;
  --bg-gradient: radial-gradient(circle at 50% 0%, var(--bg-indigo) 0%, var(--bg-slate) 50%, var(--bg-obsidian) 100%);

  /* Glassmorphism Surfaces */
  --surface-glass: rgba(30, 41, 59, 0.65);
  --surface-glass-border: rgba(255, 255, 255, 0.08);
  --surface-card: rgba(15, 23, 42, 0.75);
  --surface-modal: rgba(11, 15, 23, 0.88);

  /* Accents & Badges */
  --accent-emerald: #10B981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.35);
  --accent-amber: #F59E0B;
  --accent-amber-glow: rgba(245, 158, 11, 0.3);
  --accent-cyan: #06B6D4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-indigo: #6366F1;
  --accent-danger: #EF4444;

  /* Typography Colors */
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dark: #0F172A;

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Border Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   1. RESET & BASE LAYOUT
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: 4rem;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-obsidian);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Glassmorphic Base Surfaces */
.glass-card {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   2. HEADER & BRANDING BAR
   -------------------------------------------------------------------------- */
.app-header {
  padding: 1.25rem 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--surface-glass-border);
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-emerald), var(--accent-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 0 20px var(--accent-emerald-glow);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.calendar-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(15, 23, 42, 0.65);
  padding: 0.5rem 1.25rem;
  border-radius: 99px;
  border: 1px solid var(--surface-glass-border);
  font-size: 0.875rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.date-gregorian { color: var(--text-main); font-weight: 600; }
.date-hijri { color: var(--accent-amber); font-weight: 600; }
.date-divider { color: var(--text-muted); opacity: 0.4; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Button Utilities */
.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-glass-border);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 1rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
}

.btn-admin {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(99, 102, 241, 0.15));
  border: 1px solid var(--accent-cyan);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-admin:hover {
  background: var(--accent-cyan);
  color: var(--text-dark);
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

/* --------------------------------------------------------------------------
   3. HERO DISPLAY: CLOCK & COUNTDOWN
   -------------------------------------------------------------------------- */
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

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

.hero-card {
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  border: 1px solid var(--surface-glass-border);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 1rem;
  width: fit-content;
  letter-spacing: 0.05em;
}

.clock-display {
  font-family: var(--font-mono);
  font-size: 3.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  text-shadow: 0 0 25px rgba(255, 255, 255, 0.12);
}

.clock-foot {
  display: flex;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.countdown-card {
  align-items: center;
  text-align: center;
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.95));
}

.countdown-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.next-prayer-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-amber);
  margin-bottom: 0.5rem;
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.5rem 1.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-glass-border);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
  margin-bottom: 1rem;
  width: 100%;
}

.suhoor-iftar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}

.fasting-box {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-glass-border);
}

.fasting-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
}

.fasting-time {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   4. SECTION CONTROLS & JURISTIC TOGGLES
   -------------------------------------------------------------------------- */
.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.method-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.juristic-toggle-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.85);
  padding: 0.3rem 0.4rem;
  border-radius: 99px;
  border: 1px solid var(--surface-glass-border);
}

.toggle-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  padding-left: 0.75rem;
  letter-spacing: 0.05em;
}

.toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.45rem 1.1rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition-fast);
}

.toggle-btn.active {
  background: var(--accent-cyan);
  color: var(--text-dark);
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.3);
}

/* --------------------------------------------------------------------------
   5. DAILY PRAYER CARDS GRID & HIGHLIGHT STATES
   -------------------------------------------------------------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.prayer-card {
  padding: 1.5rem;
  position: relative;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
}

.prayer-card:hover {
  transform: translateY(-4px);
}

.prayer-card.filtered-out {
  opacity: 0.3;
  filter: grayscale(0.85);
  pointer-events: none;
}

/* Glowing Current Active Card */
.prayer-card.current {
  border-color: var(--accent-emerald);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.22) 0%, rgba(15, 23, 42, 0.9) 100%);
  box-shadow: 0 0 30px var(--accent-emerald-glow);
  animation: pulseGlow 2.5s infinite alternate;
}

/* Upcoming Alert Card */
.prayer-card.upcoming {
  border-color: var(--accent-amber);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.18) 0%, rgba(15, 23, 42, 0.9) 100%);
  box-shadow: 0 0 25px var(--accent-amber-glow);
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 15px rgba(16, 185, 129, 0.2); }
  100% { box-shadow: 0 0 35px rgba(16, 185, 129, 0.55); }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.prayer-name {
  font-size: 1.15rem;
  font-weight: 700;
  display: block;
}

.prayer-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-current { background: var(--accent-emerald); color: var(--text-dark); }
.badge-upcoming { background: var(--accent-amber); color: var(--text-dark); }

.time-val {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   6. MONTHLY TIMETABLE TABLE
   -------------------------------------------------------------------------- */
.monthly-card {
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.monthly-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.monthly-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-glass-border);
}

.monthly-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.monthly-table th, .monthly-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.monthly-table th {
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.monthly-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.monthly-table tr.current-day-row {
  background: rgba(6, 182, 212, 0.15);
  border-left: 4px solid var(--accent-cyan);
}

.monthly-table tr.current-day-row td {
  font-weight: 700;
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   7. ADMIN MODAL & CONTROLS
   -------------------------------------------------------------------------- */
.admin-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface-modal);
  backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  overflow-y: auto;
  transition: opacity 0.3s ease;
}

.admin-overlay.hidden {
  display: none !important;
}

.admin-panel-card {
  width: 100%;
  max-width: 950px;
  padding: 2.25rem;
  background: var(--surface-card);
  max-height: 90vh;
  overflow-y: auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--surface-glass-border);
  padding-bottom: 1rem;
}

.admin-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
}

.admin-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.close-btn:hover { color: var(--accent-amber); }

.admin-section {
  margin-bottom: 2rem;
}

.admin-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed rgba(6, 182, 212, 0.4);
  border-radius: var(--radius-md);
  padding: 2.25rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.4);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  box-shadow: 0 0 25px var(--accent-cyan-glow);
}

.drop-zone-icon {
  font-size: 2.25rem;
  display: block;
  margin-bottom: 0.5rem;
}

.drop-zone-text { font-weight: 600; font-size: 0.95rem; }
.drop-zone-text .highlight { color: var(--accent-cyan); }
.drop-zone-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }

/* Override Form */
.override-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.form-control {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.55rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-glow);
}

/* Action Buttons */
.actions-bar {
  display: flex;
  gap: 0.85rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  border-top: 1px solid var(--surface-glass-border);
  padding-top: 1.25rem;
}

.btn {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary { background: var(--accent-cyan); color: var(--text-dark); }
.btn-primary:hover { box-shadow: 0 0 15px var(--accent-cyan-glow); }

.btn-accent { background: var(--accent-indigo); color: #fff; }
.btn-accent:hover { opacity: 0.9; }

.btn-secondary { background: rgba(255, 255, 255, 0.08); color: var(--text-main); border: 1px solid var(--surface-glass-border); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.15); }

.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.3); }

/* Toast Notifications */
#toastContainer {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--surface-card);
  border: 1px solid var(--accent-cyan);
  color: var(--text-main);
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  font-size: 0.875rem;
  font-weight: 600;
  animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --------------------------------------------------------------------------
   8. HIGH DENSITY PRINT STYLESHEET
   -------------------------------------------------------------------------- */
.printable-sheet { display: none; }

@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  
  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .printable-sheet {
    background: #fff;
    color: #000;
    padding: 1rem;
  }

  .printable-header {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
  }

  .printable-header h1 {
    font-size: 1.6rem;
    color: #000;
  }

  .printable-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
  }

  .printable-table th, .printable-table td {
    border: 1px solid #333;
    padding: 5px 8px;
    text-align: center;
    font-size: 0.8rem;
  }

  .printable-table th {
    background: #f0f0f0;
    font-weight: bold;
  }
}