/* =====================================================
   DASHBOARD PAGE STYLES
   ===================================================== */

/* Override common.css container for full-width dashboard */
body { background: #f0f2f5; margin: 0; }
.container { max-width: none; padding: 0; }

/* ── Header Bar ───────────────────────────────────── */
.dash-header {
  background: #2d2d2d;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.dash-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.dash-home-link {
  color: #90caf9;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}
.dash-home-link:hover { text-decoration: underline; }
.dash-sep { color: #666; font-size: 13px; }
.dash-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-select {
  background: #444;
  color: white;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  max-width: 280px;
}
.dash-select option { background: #333; }
.dash-header-right { white-space: nowrap; }
.dash-brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #ccc;
}

/* ── Loading ──────────────────────────────────────── */
.dash-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px;
  font-size: 15px;
  color: #555;
}

/* ── Views ────────────────────────────────────────── */
.dash-view { padding: 20px 24px; }

/* ── Cards Row ────────────────────────────────────── */
.dash-cards-row {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}
.top-row { grid-template-columns: 1fr 1fr 1fr; }
.detail-top-row { grid-template-columns: 1fr 1fr 1fr; }
.detail-bottom-row { grid-template-columns: 1fr 1fr 1fr; }

.dash-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}
.dash-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

/* Description card */
.desc-text {
  font-size: 13px;
  line-height: 1.6;
  color: #555;
  max-height: 200px;
  overflow-y: auto;
}

/* ── Charts ───────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 200px;
}
.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-wrap canvas { max-width: 220px; max-height: 220px; }
.donut-summary {
  text-align: center;
  margin-top: 8px;
}
.donut-count { font-size: 28px; font-weight: 700; color: #333; margin-right: 6px; }
.donut-label { font-size: 14px; color: #888; }

/* ── Stats Banner ─────────────────────────────────── */
.stats-banner {
  display: flex;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 12px 0;
  margin-bottom: 20px;
  overflow-x: auto;
}
.stat-item {
  flex: 1;
  text-align: center;
  padding: 0 16px;
  border-right: 1px solid #ddd;
  min-width: 120px;
}
.stat-item:last-child { border-right: none; }
.stat-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

/* ── CI Badges ────────────────────────────────────── */
.ci-badge {
  display: inline-block;
  min-width: 36px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: white;
}
.ci-green  { background: #4CAF50; }
.ci-yellow { background: #FFC107; color: #333; }
.ci-orange { background: #FF9800; }
.ci-red    { background: #f44336; }
.ci-tbd    { background: #9E9E9E; }

/* ── Tabs ─────────────────────────────────────────── */
.dash-table-section {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 20px;
  overflow: hidden;
}
.dash-tabs {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  padding: 0 16px;
}
.dash-tab {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
}
.dash-tab:hover { color: #333; }
.dash-tab.active {
  color: #1976D2;
  border-bottom-color: #1976D2;
  font-weight: 600;
}
.dash-tab-panel { display: none; padding: 0; }
.dash-tab-panel.active { display: block; }

/* ── Tables ───────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
}
.table-scroll.compact { max-height: 300px; }
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.dash-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.dash-table th {
  background: #37474F;
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
  cursor: default;
  border-bottom: none;
}
.dash-table th.sortable { cursor: pointer; }
.dash-table th.sortable:hover { background: #455A64; }
.dash-table th .sort-arrow { margin-left: 4px; font-size: 10px; }
.dash-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  color: #333;
  vertical-align: top;
}
.dash-table tbody tr:hover { background: #f5f8ff; }
.dash-table tbody tr { cursor: pointer; }
.dash-table.compact td { padding: 8px 12px; }

/* Clickable facility row */
.facility-row:hover { background: #e8f0fe !important; }

/* ── Photo Carousel ───────────────────────────────── */
.photo-card { padding: 0; }
.photo-carousel {
  position: relative;
  width: 100%;
  height: 280px;
  background: #1a1a1a;
  overflow: hidden;
}
.carousel-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.carousel-counter {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  z-index: 2;
}
.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 13px;
  padding: 6px 12px;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  color: white;
  border: none;
  font-size: 28px;
  padding: 8px 12px;
  cursor: pointer;
  z-index: 2;
  border-radius: 4px;
}
.carousel-btn:hover { background: rgba(0,0,0,0.7); }
.carousel-btn.prev { left: 4px; }
.carousel-btn.next { right: 4px; }
.carousel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #888;
  font-size: 14px;
}

/* ── Map ──────────────────────────────────────────── */
.map-card { padding: 0; display: flex; flex-direction: column; }
.map-address {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  background: white;
}
#leafletMap {
  flex: 1;
  min-height: 230px;
}

/* ── Intro Card ───────────────────────────────────── */
.intro-card p {
  font-size: 13px;
  line-height: 1.6;
  color: #555;
  max-height: 240px;
  overflow-y: auto;
}

/* ── Photos Grid ──────────────────────────────────── */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px;
}
.photo-thumb {
  border-radius: 6px;
  overflow: hidden;
  background: #f5f5f5;
  cursor: pointer;
}
.photo-thumb img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.photo-thumb-caption {
  padding: 6px 8px;
  font-size: 12px;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1100px) {
  .top-row,
  .detail-top-row,
  .detail-bottom-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .top-row,
  .detail-top-row,
  .detail-bottom-row { grid-template-columns: 1fr; }
  .dash-header { padding: 0 12px; }
  .dash-view { padding: 12px; }
  .stats-banner { flex-wrap: wrap; }
  .stat-item { min-width: 100px; }
}
