/* ==========================================================================
   PORTAL DIREKTORI BERSEPADU INSTITUSI SYARIAH MALAYSIA (PWA & MOBILE PRO)
   Tema Korporat Kehakiman: Navy (#12385b) & Gold (#d4af37)
   ========================================================================== */

:root {
  --navy: #12385b;
  --navy-dark: #0a2239;
  --navy-light: #1e4f7d;
  --navy-soft: #e8eff6;
  --gold: #d4af37;
  --gold-dark: #b59024;
  --gold-light: #f9f1d2;
  --gold-border: #e5c865;

  --cat-kehakiman: #12385b;
  --cat-kehakiman-bg: #e8eff6;
  --cat-jbg: #0f766e;
  --cat-jbg-bg: #ccfbf1;
  --cat-pendakwaan: #881337;
  --cat-pendakwaan-bg: #ffe4e6;

  --bg-main: #f3f6fa;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-subtle: #e2e8f0;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(18, 56, 91, 0.08);
  --shadow-lg: 0 10px 25px rgba(18, 56, 91, 0.16);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* ==========================================================================
   HEADER KORPORAT
   ========================================================================== */
.app-header {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%);
  color: #ffffff;
  padding: 0.7rem 1.25rem;
  border-bottom: 3px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  z-index: 20;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-crest {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.16);
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 10px rgba(212, 175, 55, 0.25);
}

.brand-crest svg {
  width: 24px;
  height: 24px;
  color: var(--gold);
}

.brand-titles {
  min-width: 0;
}

.brand-eyebrow {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  font-weight: 700;
  display: block;
}

.brand-title {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 0.73rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.stats-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
  transition: var(--transition);
}

.stat-pill.highlight {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold);
}

.stat-value {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.61rem;
  color: #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
  white-space: nowrap;
}

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

.btn-header {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.42rem 0.72rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.btn-header:hover {
  background: var(--gold);
  color: var(--navy-dark);
  border-color: var(--gold);
}

.btn-header.btn-gold {
  background: var(--gold);
  color: var(--navy-dark);
  border-color: var(--gold);
  font-weight: 700;
}

.btn-header.btn-gold:hover {
  background: #e5c349;
}

.btn-header.btn-install-app {
  background: rgba(15, 118, 110, 0.85);
  border-color: #2dd4bf;
  color: #ffffff;
}

.btn-header.btn-install-app:hover {
  background: #14b8a6;
  color: var(--navy-dark);
}

/* ==========================================================================
   WORKSPACE (2-PANE SPLIT VIEW)
   ========================================================================== */
.app-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
}

/* ==========================================================================
   LEFT SIDEBAR (SEARCH, GEOLOCATION, FILTERS & DIRECTORY CARDS)
   ========================================================================== */
.sidebar {
  width: 420px;
  min-width: 340px;
  max-width: 460px;
  background: var(--surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.04);
}

.filter-panel {
  padding: 0.85rem 0.95rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex-shrink: 0;
}

/* Butang Jejak Agensi Terdekat (GPS) */
.nearest-bar {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.btn-locate-me {
  flex: 1;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #ffffff;
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 0.54rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  box-shadow: 0 3px 10px rgba(18, 56, 91, 0.18);
  transition: var(--transition);
  font-family: inherit;
}

.btn-locate-me:hover {
  background: var(--gold);
  color: var(--navy-dark);
}

.btn-locate-me.active {
  background: #0f766e;
  border-color: #5eead4;
  color: #ffffff;
}

.btn-locate-me svg {
  width: 16px;
  height: 16px;
  color: var(--gold);
  flex-shrink: 0;
}

.btn-locate-me:hover svg {
  color: var(--navy-dark);
}

/* Kad Status Lokasi Semasa & Agensi Terdekat */
.nearest-status-banner {
  display: none;
  background: linear-gradient(135deg, #fdfbf3 0%, #f7f1d5 100%);
  border: 1px solid var(--gold);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-size: 0.74rem;
  color: var(--navy-dark);
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.nearest-status-banner.visible {
  display: flex;
}

.nearest-status-info {
  min-width: 0;
  line-height: 1.35;
}

.nearest-status-info strong {
  display: block;
  color: var(--navy);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-clear-location {
  background: rgba(18, 56, 91, 0.1);
  border: none;
  color: var(--navy-dark);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.55rem 2.2rem 0.55rem 2.25rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  color: var(--text-main);
  background: var(--surface);
  transition: var(--transition);
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(18, 56, 91, 0.12);
}

.clear-search-btn {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85rem;
  display: none;
}

.clear-search-btn.visible {
  display: inline-flex;
}

.clear-search-btn:hover {
  background: var(--border-subtle);
  color: var(--text-main);
}

/* Category Quick Tabs */
.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.cat-tab {
  padding: 0.42rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
}

.cat-tab:hover {
  border-color: var(--navy);
  color: var(--navy);
}

.cat-tab.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
  box-shadow: 0 2px 6px rgba(18, 56, 91, 0.2);
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.filter-select {
  width: 100%;
  padding: 0.46rem 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.77rem;
  color: var(--text-main);
  background: var(--surface);
  font-family: inherit;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--navy);
}

.directory-toolbar {
  padding: 0.5rem 0.95rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.directory-count strong {
  color: var(--navy);
  font-weight: 700;
}

.btn-reset-link {
  background: none;
  border: none;
  color: var(--navy);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: inherit;
}

.btn-reset-link:hover {
  color: var(--gold-dark);
}

/* Directory Card List */
.directory-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg-main);
}

.dir-item {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius-md);
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  position: relative;
}

.dir-item[data-category="kehakiman"] { border-left-color: var(--cat-kehakiman); }
.dir-item[data-category="jbg"] { border-left-color: var(--cat-jbg); }
.dir-item[data-category="pendakwaan"] { border-left-color: var(--cat-pendakwaan); }

.dir-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--gold-border);
}

.dir-item.active {
  background: #fdfbf3;
  border-color: var(--gold);
  border-left-width: 5px;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.22);
}

.dir-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.badge-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.48rem;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-kehakiman { background: var(--cat-kehakiman-bg); color: var(--cat-kehakiman); }
.badge-jbg { background: var(--cat-jbg-bg); color: var(--cat-jbg); }
.badge-pendakwaan { background: var(--cat-pendakwaan-bg); color: var(--cat-pendakwaan); }

.badge-level {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-weight: 600;
}

.distance-badge {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.distance-badge.nearest-rank-1 {
  background: var(--navy);
  color: var(--gold);
  border-color: var(--gold);
}

.state-tag {
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--gold-light);
  padding: 0.14rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.dir-item-title {
  font-size: 0.89rem;
  font-weight: 700;
  color: var(--navy-dark);
  line-height: 1.3;
}

.dir-item-address {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dir-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.15rem;
  padding-top: 0.38rem;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.dir-item-phone {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.dir-item-fly {
  color: var(--navy);
  font-weight: 700;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.dir-item.active .dir-item-fly {
  color: var(--gold-dark);
}

.empty-state {
  text-align: center;
  padding: 2.2rem 1rem;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.empty-state h4 {
  color: var(--navy);
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.empty-state p {
  font-size: 0.8rem;
  margin-bottom: 0.85rem;
}

/* ==========================================================================
   MAIN PANE (MAP + BOTTOM DETAIL PANEL)
   ========================================================================== */
.main-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  position: relative;
}

.map-wrapper {
  flex: 1;
  position: relative;
  min-height: 240px;
  width: 100%;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Map Floating Overlays */
.map-overlay-top {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  gap: 0.38rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-map-region {
  background: rgba(255, 255, 255, 0.95);
  color: var(--navy-dark);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.68rem;
  border-radius: var(--radius-sm);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  font-family: inherit;
}

.btn-map-region:hover,
.btn-map-region.active {
  background: var(--navy);
  color: var(--gold);
  border-color: var(--gold);
}

.btn-map-gps {
  background: var(--navy);
  color: var(--gold);
  border: 1.5px solid var(--gold);
}

.map-legend {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 500;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  display: inline-block;
}

.legend-dot.kehakiman { background: var(--cat-kehakiman); }
.legend-dot.jbg { background: var(--cat-jbg); }
.legend-dot.pendakwaan { background: var(--cat-pendakwaan); }

/* Custom Leaflet Marker Styling */
.custom-syariah-pin {
  background: transparent;
  border: none;
}

.pin-bubble {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--gold);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.pin-bubble.kehakiman { background: var(--cat-kehakiman); }
.pin-bubble.jbg { background: var(--cat-jbg); }
.pin-bubble.pendakwaan { background: var(--cat-pendakwaan); }

.pin-inner {
  transform: rotate(45deg);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
}

/* Pin Lokasi Pengguna (User GPS Pulse Marker) */
.user-gps-marker {
  background: transparent;
  border: none;
}

.gps-pulse-wrap {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gps-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2563eb;
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 0 2px #12385b, 0 2px 6px rgba(0,0,0,0.4);
  z-index: 2;
}

.gps-ring {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.32);
  border: 1.5px solid #2563eb;
  animation: gpsPulse 1.8s infinite ease-out;
}

@keyframes gpsPulse {
  0% { transform: scale(0.7); opacity: 1; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* ==========================================================================
   BOTTOM RECORD DETAIL PANEL
   ========================================================================== */
.detail-panel {
  background: var(--surface);
  border-top: 3px solid var(--gold);
  padding: 0.9rem 1.25rem;
  min-height: 185px;
  max-height: 245px;
  overflow-y: auto;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
  transition: max-height 0.25s ease;
}

.detail-sheet-handle {
  display: none;
  width: 42px;
  height: 5px;
  background: #cbd5e1;
  border-radius: 999px;
  margin: 0 auto 0.25rem auto;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.detail-title-wrap {
  min-width: 0;
  flex: 1;
}

.detail-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.detail-title {
  font-size: 1.04rem;
  font-weight: 800;
  color: var(--navy-dark);
  line-height: 1.25;
}

.btn-toggle-sheet {
  display: none;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  color: var(--navy);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.75rem;
  background: var(--surface-alt);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.detail-label {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}

.detail-value {
  font-size: 0.79rem;
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.detail-value a {
  color: var(--navy);
  text-decoration: underline;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.action-btn-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-action {
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid transparent;
  font-family: inherit;
}

.btn-primary {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.btn-primary:hover {
  background: var(--navy-light);
}

.btn-gold-action {
  background: var(--gold);
  color: var(--navy-dark);
  border-color: var(--gold-dark);
}

.btn-gold-action:hover {
  background: #e3be42;
}

.btn-outline {
  background: var(--surface);
  color: var(--navy);
  border-color: var(--border-color);
}

.btn-outline:hover {
  border-color: var(--navy);
  background: var(--navy-soft);
}

/* ==========================================================================
   PWA INSTALL POPUP BANNER (ANDROID & iOS HOMESCREEN)
   ========================================================================== */
.pwa-install-banner {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  width: calc(100% - 24px);
  max-width: 480px;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  color: #ffffff;
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  box-shadow: 0 14px 34px rgba(10, 34, 57, 0.45);
  z-index: 2500;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-install-banner.visible {
  transform: translateX(-50%) translateY(0);
}

.pwa-banner-top {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.pwa-app-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.18);
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-app-icon svg {
  width: 26px;
  height: 26px;
  color: var(--gold);
}

.pwa-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-banner-text h4 {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 0.15rem;
}

.pwa-banner-text p {
  font-size: 0.75rem;
  color: #e2e8f0;
  line-height: 1.35;
}

.pwa-ios-steps {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed rgba(212, 175, 55, 0.5);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.74rem;
  color: #f8fafc;
  line-height: 1.45;
}

.pwa-ios-steps.visible {
  display: block;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn-pwa-later {
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.42rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-pwa-install {
  background: var(--gold);
  color: var(--navy-dark);
  border: 1px solid var(--gold);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

/* ==========================================================================
   MODAL RINGKASAN INISIATIF
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 34, 57, 0.72);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--surface);
  width: 100%;
  max-width: 880px;
  max-height: 88vh;
  border-radius: var(--radius-lg);
  border: 2px solid var(--gold);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  background: var(--navy);
  color: #ffffff;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--gold);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold);
}

.modal-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
}

.modal-close:hover {
  background: var(--gold);
  color: var(--navy-dark);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pitch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}

.pitch-card {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--navy);
  border-radius: var(--radius-md);
  padding: 0.95rem;
}

.pitch-card.gold-top {
  border-top-color: var(--gold);
}

.pitch-card h4 {
  font-size: 0.88rem;
  color: var(--navy-dark);
  margin-bottom: 0.45rem;
}

.pitch-card p, .pitch-card li {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pitch-card ul {
  padding-left: 1.1rem;
  margin-top: 0.35rem;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy-dark);
  color: #ffffff;
  border-left: 4px solid var(--gold);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: var(--transition);
}

.toast-notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile View Switcher (Bottom App Tab Bar on Smartphone) */
.mobile-view-bar {
  display: none;
  background: var(--navy-dark);
  padding: 0.35rem 0.65rem;
  gap: 0.4rem;
  border-top: 2px solid var(--gold);
  z-index: 30;
  flex-shrink: 0;
}

.btn-mobile-pane {
  flex: 1;
  padding: 0.45rem 0.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: inherit;
  transition: var(--transition);
}

.btn-mobile-pane.active {
  background: var(--gold);
  color: var(--navy-dark);
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.35);
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (TABLET & TELEFON PINTAR)
   ========================================================================== */
@media (max-width: 1024px) {
  .sidebar {
    width: 350px;
    min-width: 300px;
  }
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
  .pitch-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 0.55rem 0.8rem;
    gap: 0.45rem;
    flex-direction: column;
    align-items: stretch;
  }
  .brand-crest {
    width: 36px;
    height: 36px;
  }
  .brand-eyebrow {
    font-size: 0.58rem;
  }
  .brand-title {
    font-size: 0.94rem;
  }
  .brand-subtitle {
    display: none;
  }
  .header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .stats-bar {
    gap: 0.3rem;
    flex-shrink: 0;
  }
  .stat-pill {
    min-width: 54px;
    padding: 0.2rem 0.38rem;
  }
  .stat-value {
    font-size: 0.8rem;
  }
  .stat-label {
    font-size: 0.54rem;
  }
  .header-actions {
    gap: 0.3rem;
    flex-shrink: 0;
  }
  .btn-header {
    padding: 0.34rem 0.52rem;
    font-size: 0.68rem;
  }

  /* Bottom Navigation Bar on Mobile */
  .mobile-view-bar {
    display: flex;
    order: 3;
  }
  .app-workspace {
    order: 2;
    position: relative;
  }
  .sidebar {
    width: 100%;
    max-width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    z-index: 15;
  }
  .sidebar.mobile-hidden {
    display: none;
  }
  .main-pane {
    width: 100%;
    height: 100%;
  }
  .map-overlay-top {
    top: 8px;
    right: 8px;
    max-width: calc(100% - 60px);
  }
  .btn-map-region {
    padding: 0.32rem 0.52rem;
    font-size: 0.68rem;
  }
  .map-legend {
    bottom: 8px;
    left: 8px;
    padding: 0.35rem 0.55rem;
    font-size: 0.64rem;
    gap: 0.5rem;
  }

  /* Collapsible Bottom Sheet for Detail Panel on Mobile */
  .detail-sheet-handle {
    display: block;
  }
  .btn-toggle-sheet {
    display: inline-flex;
  }
  .detail-panel {
    padding: 0.65rem 0.85rem 0.8rem 0.85rem;
    min-height: 0;
    max-height: 44vh;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
  }
  .detail-panel.collapsed {
    max-height: 76px;
    overflow: hidden;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
  }
  .detail-actions .action-btn-group {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.38rem;
  }
  .pwa-install-banner {
    bottom: 62px;
  }
  .toast-notification {
    bottom: 66px;
    left: 16px;
    right: 16px;
    text-align: center;
  }
}
