/* ======================================================
   MONITORING.CSS — FINAL FULL FIXED
   Kompatibel dengan global.css + modul UI + modul API
   Namespace utama: .monitoring-page
   ====================================================== */


/* ------------------------------------------------------
   1) VARIABLES DASAR
   ------------------------------------------------------ */
.monitoring-page {
  /* layout */
  --bg: #0d1b2a;
  --left-grad: linear-gradient(180deg,#2d6a4f,#40916c);
  --right-grad: linear-gradient(180deg,#95d5b2,#74c69d);
  --card: #ffffff;
  --text: #1b4332;
  --accent: #007e33;
  --muted: rgba(27,67,50,0.7);
  --shadow: 0 8px 26px rgba(0,0,0,0.14);
  --soft-shadow: 0 6px 18px rgba(0,0,0,0.10);
  --radius: 12px;
  --gutter: 14px;
  --max-width: 100%; /* ⬅️ penuh lebar, tidak dibatasi 1500px lagi */

  /* font size */
  --fz-sm: 13px;
  --fz-base: 15px;
  --fz-lg: 18px;
  --fz-title: 20px;
}


/* ------------------------------------------------------
   2) DARK MODE SUPPORT
   ------------------------------------------------------ */
body.dark-theme.monitoring-page {
  --bg: #071126;
  --left-grad: linear-gradient(180deg,#10303c,#0f5132);
  --right-grad: linear-gradient(180deg,#0f3b2b,#0a6b5b);
  --card: #0a1720;
  --text: #c7ede0;
  --accent: #52ffbc;
  --soft-shadow: 0 8px 22px rgba(0,0,0,0.30);
}


/* ------------------------------------------------------
   3) BASE STRUCTURE
   ------------------------------------------------------ */
.monitoring-page {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.monitoring-page * {
  box-sizing: border-box;
}


/* ------------------------------------------------------
   4) HEADER FIXED
   ------------------------------------------------------ */
.monitoring-page header {
  background: linear-gradient(90deg,#1b4332,#52b788);
  color: #fff;
  padding: 6px 0;                 /* lebih tipis, biar compact */
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  position: relative;
  height: 48px;                   /* tinggi fix untuk stabil */
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--soft-shadow);
}

.monitoring-page header .header-inner {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.monitoring-page header .title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  width: 100%;
  pointer-events: none; /* biar nggak kegeser oleh klik */
}

/* Tombol fullscreen di kanan */
.monitoring-page #fullscreen-btn {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
}


/* ------------------------------------------------------
   5) RUNNING TEXT
   ------------------------------------------------------ */
.monitoring-page .running-text {
  background: linear-gradient(90deg,#d8f3dc,#b7e4c7);
  color: #0d1b2a;
  padding: 6px 8px;
  border-top: 2px solid #40916c;
  border-bottom: 2px solid #40916c;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
}

.monitoring-page .running-text span {
  display: inline-block;
  padding-left: 100%;
  animation: marq 26s linear infinite;
}

@keyframes marq {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}


/* ------------------------------------------------------
   6) MAIN LAYOUT
   ------------------------------------------------------ */
.monitoring-page .main {
  flex: 1;
  display: flex;
  justify-content: center;  /* child cuma satu: .main-inner */
  align-items: stretch;
  padding: var(--gutter) 0; /* atas–bawah, kiri–kanan diatur di .main-inner */
}

.monitoring-page .main-inner {
  width: 100%;
  max-width: var(--max-width); /* ⬅️ sekarang 100% dari viewport */
  display: flex;
  gap: var(--gutter);
  padding: 0 20px;             /* jarak dari tepi layar */
}



/* ------------------------------------------------------
   7) SIDEBAR LEFT — SUMBER DAYA / KEUANGAN / HIJRIAH
   ------------------------------------------------------ */
.monitoring-page .sidebar-left {
  flex: 0 0 240px;
  background: var(--left-grad);
  padding: 16px;
  border-radius: var(--radius);
  color: #fff;
  box-shadow: var(--shadow);
}

.monitoring-page .sidebar-left h3 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  border-bottom: 2px solid rgba(255,255,255,0.25);
  padding-bottom: 6px;
}


/* ------------------------------------------------------
   8) SUMBER DAYA (2x2 GRID)
   ------------------------------------------------------ */
.monitoring-page #data-sumberdaya {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.monitoring-page .sumber-item {
  background: transparent !important;
  padding: 6px 4px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  color: #fff;
}

.monitoring-page .sumber-item .icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.monitoring-page .sumber-item .label {
  font-size: var(--fz-sm);
  font-weight: 600;
  margin-bottom: 2px;
}

.monitoring-page .sumber-item .value {
  font-size: var(--fz-base);
  font-weight: 700;
  color: #90ffbf !important;
}


/* ======================================================
   9) KEUANGAN (FLAT STYLE)
   ====================================================== */
.monitoring-page .info-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

/* Hilangkan box — rata dengan sumberdaya */
.monitoring-page .info-box {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  color: #fff !important;
  text-align: left;
}

.monitoring-page .info-box h5 {
  font-size: 14px;
  margin-bottom: 3px;
}

.monitoring-page .info-box .value {
  font-size: 15px;
  font-weight: 700;
}

/* Dynamic Color Class */
.value-black { color: #000 !important; }
.value-red   { color: #ff5252 !important; }
.value-green { color: #00ff96 !important; }



/* ======================================================
   10) TANGGAL HIJRIAH
   ====================================================== */
.monitoring-page #tanggal-hijriah {
  font-size: 15px;
  font-weight: 600;
  color: #e8fff7;
}



/* ======================================================
   11) CONTENT TENGAH (Carousel + Jamaah)
   ====================================================== */
.monitoring-page .content {
  flex: 1;
  background: var(--card);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}


/* ---------------- CAROUSEL ---------------- */
.monitoring-page #carouselMasjid {
  width: 100%;
  height: 280px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  margin-bottom: 18px;
}

.monitoring-page #carouselMasjid img {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.monitoring-page .carousel-caption {
  background: rgba(0,0,0,0.45);
  padding: 10px;
  border-radius: 8px;
}



/* ======================================================
   12) JAMAAH GRID (9 CARD)
   ====================================================== */
.monitoring-page .jamaah-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.monitoring-page .jamaah-card {
  background: var(--card);
  border-radius: 12px;
  padding: 18px 12px;
  text-align: center;
  box-shadow: var(--soft-shadow);
  transition: transform 0.18s ease;
}

.monitoring-page .jamaah-card:hover {
  transform: translateY(-5px);
}

.monitoring-page .jamaah-card h4 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.monitoring-page .jamaah-card p {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}



/* ======================================================
   13) SIDEBAR KANAN
   ====================================================== */
.monitoring-page .sidebar-right {
  flex: 0 0 300px;
  background: var(--right-grad);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
}

.monitoring-page .info-box-right {
  background: var(--card);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  box-shadow: var(--soft-shadow);
}

.monitoring-page .sidebar-right table td {
  padding: 8px 4px;
}



/* ======================================================
   14) FOOTER
   ====================================================== */
.monitoring-page footer {
  text-align: center;
  padding: 10px 0;
  background: #1b263b;
  color: white;
}



/* ======================================================
   15) RESPONSIVE
   ====================================================== */
@media (max-width: 1100px) {
  .monitoring-page .jamaah-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .monitoring-page #carouselMasjid,
  .monitoring-page #carouselMasjid img {
    height: 240px;
  }
}

@media (max-width: 850px) {
  .monitoring-page .main-inner {
    flex-direction: column;
  }
  .monitoring-page .sidebar-left,
  .monitoring-page .sidebar-right {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .monitoring-page .jamaah-container {
    grid-template-columns: 1fr;
  }
  .monitoring-page #carouselMasjid,
  .monitoring-page #carouselMasjid img {
    height: 160px;
  }
}



/* ---------------- ICON STATUS KEUANGAN ---------------- */
.saldo-icon {
  margin-right: 6px;
  font-size: 15px;
}

.icon-red   { color:#ff4d4d !important; }
.icon-green { color:#00cc66 !important; }
.icon-black { color:#000000 !important; }

.value-red   { color:#ff4d4d !important; }
.value-green { color:#00ff99 !important; }
.value-black { color:#dcdcdc !important; }


/* ==========================================================
   ICON STATUS KEUANGAN — glowing + animasi naik–turun
   ========================================================== */

/* Ukuran icon lebih besar */
.saldo-icon {
  font-size: 22px;
  margin-right: 6px;
  display: inline-block;
  transition: transform 0.4s ease, filter 0.4s ease;
}

/* Warna dasar untuk icon */
.icon-green { color: #00ff9d !important; }
.icon-red   { color: #ff4d4d !important; }
.icon-black { color: #c7c7c7 !important; }

/* Glowing effect */
.icon-green {
  filter: drop-shadow(0 0 6px #00ff9d);
}
.icon-red {
  filter: drop-shadow(0 0 6px #ff4d4d);
}

/* Animasi naik untuk saldo positif */
@keyframes iconFloatUp {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

/* Animasi turun untuk saldo negatif */
@keyframes iconFloatDown {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(4px); }
  100% { transform: translateY(0); }
}

/* Terapkan animasi ketika kelas ditambahkan */
.icon-anim-up {
  animation: iconFloatUp 1.8s ease-in-out infinite;
}

.icon-anim-down {
  animation: iconFloatDown 1.8s ease-in-out infinite;
}

/* Warna nilai saldo */
.value-green { color:#00ff9d !important; font-weight:700; }
.value-red   { color:#ff4d4d !important; font-weight:700; }
.value-black { color:#eeeeee !important; font-weight:700; }



/* ============================
   CENTERING WAKTU & TANGGAL
   ============================ */

/* Box Waktu Sekarang */
.sidebar-right .info-box-right {
  padding: 10px !important;
  margin-bottom: 10px !important;
  text-align: center !important;
}

/* Jam utama */
#realTimeClock {
  font-size: 1.65rem;
  font-weight: 600;
  text-align: center !important;
  display: block;
}

/* Tanggal hari ini */
#realTimeDate {
  text-align: center !important;
  margin-top: 4px;
}

#userLocation {
    font-size: 0.7rem !important;
    margin-top: -4px !important;
}

/* Tabel waktu sholat — header tetap rata kiri */
.sidebar-right h5 {
  font-size: 0.9rem !important;
  margin-bottom: 4px !important;
  text-align: center;
}

/* Lokasi & countdown */
#userLocation,
#nextPrayerLabel,
#countdownNextPrayer {
  text-align: center !important;
}

/* Perataan untuk bagian lokasi */
.info-box-right div {
  width: 100%;
  text-align: center !important;
}



/* =====================
   WAKTU SHOLAT ICON + ALIGN
   ===================== */
.waktu-sholat-table td {
  font-size: 0.8rem !important;
  padding: 4px 2px !important;
}

.waktu-sholat-icon {
  font-size: 15px !important;
  margin-right: 4px;
}

.waktu-sholat-label {
  display: flex;
  align-items: center;
  font-size: 13px !important;
  font-weight: 600;
  color: var(--text);
}

.waktu-sholat-time {
  text-align: right;
  font-size: 14px !important;
  font-weight: 600;
  color: var(--text);
}

/* efek hover halus */
.waktu-sholat-row {
  transition: background 0.2s ease;
  padding: 4px 0 !important;
}
.waktu-sholat-row:hover {
  background: rgba(0,0,0,0.05);
  border-radius: 6px;
}
/* FOOTER */
.dashboard-footer {
    background: #0b1a2e;
    border-top: 3px solid rgba(255,255,255,0.08);
    padding: 12px 0;
    width: 100%;
    text-align: center;
}

/* Footer baris horizontal */
.footer-inline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 36px;
    flex-wrap: nowrap;
}

/* Masing-masing grup logo + teks */
.footer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 600;
}

/* Ukuran logo */
.footer-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

/* Pemisah antar institusi */
.footer-divider {
    width: 2px;
    height: 30px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
}

/* Responsive: ukuran turun sedikit */
@media (max-width: 480px) {
    .footer-logo { height: 30px; }
    .footer-inline { gap: 20px; }
    .footer-divider { height: 24px; }
}
.clock-display {
    font-size: 1.4rem !important;
    margin: 3px 0 !important;
}
.clock-date {
    font-size: 0.75rem !important;
}
.big-countdown .countdown-big {
    font-size: 1.4rem !important;
}
.next-label {
    font-size: 0.75rem !important;
}
.iqomah-timer {
    font-size: 1rem !important;
}
/* QR Box lebih ringkas */
.qr-kritik-box {
    padding: 8px !important;
}

.qr-kritik-box h5 {
    font-size: 0.85rem !important;
}

.qr-image {
    width: 120px !important;
    padding: 5px !important;
}

.qr-kritik-box p {
    font-size: 0.7rem !important;
    margin-bottom: 4px !important;
}

/* Sholat sedang berlangsung */
.active-prayer {
    background: rgba(255, 215, 0, 0.25) !important;
    font-weight: bold;
    animation: pulse-green 1.4s infinite;
}

@keyframes pulse-green {
    0% { background-color: rgba(0, 150, 0, .3); }
    50% { background-color: rgba(0, 200, 0, .6); }
    100% { background-color: rgba(0, 150, 0, .3); }
}

/* Flash critical 1 menit terakhir */
.flash-critical {
    animation: flashRed .75s infinite alternate;
}

@keyframes flashRed {
    from { color: #ff0000; font-weight:900; }
    to { color: #fff; background-color:#ff0000; font-weight:700; }
}

/* ======================================================
   MOBILE FIX TOTAL (FINAL)
   ====================================================== */
@media (max-width: 768px) {

  /* Ubah layout jadi 1 kolom */
  .monitoring-page .main-inner {
    display: flex !important;
    flex-direction: column !important;
    padding: 10px !important;
  }

  /* Sidebar & content full width */
  .monitoring-page .sidebar-left,
  .monitoring-page .sidebar-right,
  .monitoring-page .content {
    flex: unset !important;
    width: 100% !important;
  }

  /* Urutan biar enak dibaca */
  .sidebar-right { order: 1; }
  .content       { order: 2; }
  .sidebar-left  { order: 3; }

  /* Carousel lebih kecil */
  .monitoring-page #carouselMasjid,
  .monitoring-page #carouselMasjid img {
    height: 180px !important;
  }

  /* Grid jamaah jadi 2 kolom */
  .monitoring-page .jamaah-container {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* Card lebih compact */
  .monitoring-page .jamaah-card {
    padding: 10px !important;
  }

  .monitoring-page .jamaah-card p {
    font-size: 1.1rem !important;
  }

  /* Sidebar padding diperkecil */
  .monitoring-page .sidebar-left,
  .monitoring-page .sidebar-right {
    padding: 12px !important;
  }

  /* QR diperkecil */
  .qr-image {
    width: 90px !important;
  }

  /* Font lebih kecil */
  .clock-display {
    font-size: 1.3rem !important;
  }

  .countdown-big {
    font-size: 1.1rem !important;
  }

  /* Running text jangan kepanjangan */
  .monitoring-page .running-text span {
    animation: marq 18s linear infinite;
  }
}