/**
 * BMN SISFO – Frontend Dashboard Styles
 *
 * Semua selector diawali dengan #bmn-dashboard atau .bmn-fe-*
 * agar tidak konflik dengan CSS theme (Astra, dll.).
 * ----------------------------------------------------------------- */

/* ── CSS variables (scoped) ─────────────────────────────────────── */
#bmn-dashboard {
  --bmn-blue:   #0d6efd;
  --bmn-green:  #28a745;
  --bmn-orange: #e07c00;
  --bmn-red:    #dc3545;
  --bmn-gray:   #6c757d;
  --bmn-light:  #f8f9fa;
  --bmn-border: #dee2e6;
  --bmn-radius: 8px;
  --bmn-shadow: 0 1px 3px rgba(0,0,0,.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: #212529;
  line-height: 1.5;
}

/* ── Login prompt ───────────────────────────────────────────────── */
.bmn-fe-login-prompt {
  text-align: center;
  padding: 56px 24px;
  background: var(--bmn-light);
  border: 1px solid var(--bmn-border);
  border-radius: var(--bmn-radius);
}

.bmn-fe-login-icon {
  font-size: 44px;
  margin-bottom: 12px;
  line-height: 1;
}

.bmn-fe-login-prompt h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
  color: #212529;
}

.bmn-fe-login-prompt p {
  color: var(--bmn-gray);
  margin: 0 0 20px;
}

/* ── Header ─────────────────────────────────────────────────────── */
.bmn-fe-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--bmn-border);
}

.bmn-fe-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  color: #1d2327;
}

.bmn-fe-subtitle {
  font-size: 13px;
  color: var(--bmn-gray);
  margin: 0;
}

/* ── Stat cards ─────────────────────────────────────────────────── */
.bmn-fe-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.bmn-fe-stat-card {
  background: #eef4fc;
  border: 1px solid #c3d9f0;
  border-radius: var(--bmn-radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--bmn-shadow);
}

.bmn-fe-stat-card.bmn-fe-stat--aktif  { background: #edf7f0; border-color: #a3d9b1; }
.bmn-fe-stat-card.bmn-fe-stat--rusak  { background: #fef8ec; border-color: #f5c842; }
.bmn-fe-stat-card.bmn-fe-stat--hilang { background: #fdf0f0; border-color: #f5a8a8; }

.bmn-fe-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
}

.bmn-fe-stat-val {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: #1d2327;
}

/* ── Toolbar ────────────────────────────────────────────────────── */
.bmn-fe-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}

.bmn-fe-search-wrap {
  flex: 1 1 220px;
}

.bmn-fe-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Form controls ──────────────────────────────────────────────── */
.bmn-fe-input,
.bmn-fe-select {
  padding: 7px 10px;
  border: 1px solid var(--bmn-border);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: #212529;
  height: 36px;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}

.bmn-fe-search-wrap .bmn-fe-input { width: 100%; }
.bmn-fe-input--sm { width: 90px; }

.bmn-fe-input:focus,
.bmn-fe-select:focus {
  outline: none;
  border-color: var(--bmn-blue);
  box-shadow: 0 0 0 3px rgba(13,110,253,.2);
}

/* ── Buttons ────────────────────────────────────────────────────── */
.bmn-fe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border: 1px solid var(--bmn-border);
  border-radius: 6px;
  background: #fff;
  color: #212529;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  height: 36px;
  line-height: 1;
  text-decoration: none;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}

.bmn-fe-btn:hover { background: var(--bmn-light); }

.bmn-fe-btn--primary {
  background: var(--bmn-blue);
  border-color: var(--bmn-blue);
  color: #fff;
}

.bmn-fe-btn--primary:hover { background: #0b5ed7; border-color: #0a58ca; }

.bmn-fe-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Table ──────────────────────────────────────────────────────── */
.bmn-fe-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bmn-border);
  border-radius: var(--bmn-radius);
  box-shadow: var(--bmn-shadow);
  margin-bottom: 16px;
}

.bmn-fe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  /* Fixed layout prevents column-width drift when cell content varies. */
  table-layout: fixed;
}

.bmn-fe-table th,
.bmn-fe-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--bmn-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bmn-fe-table thead th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  position: sticky;
  top: 0;
  z-index: 1;
}

.bmn-fe-table tbody tr:last-child td { border-bottom: none; }
.bmn-fe-table tbody tr:hover { background: #f8f9fa; }

/* Column: # (row number) */
.bmn-fe-th-num,
.bmn-fe-td-num {
  text-align: right;
  width: 48px;
  color: var(--bmn-gray);
}

/* Column: Nama Barang */
.bmn-fe-td-name {
  font-weight: 600;
  white-space: normal;
  min-width: 160px;
  width: 220px;
}

/* Column: Foto — fixed width so the column never collapses or drifts.
   Always rendered regardless of whether a photo exists. */
.bmn-fe-th-foto,
.bmn-fe-td-foto {
  width: 84px;
  min-width: 84px;
  text-align: center;
  vertical-align: middle;
  padding: 6px 8px;
}

/* Thumbnail image rendered by JS renderRows(). */
.bmn-fe-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

/* Placeholder shown when foto_url is absent or image fails to load. */
.bmn-fe-no-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: #f3f4f6;
  border-radius: 4px;
  color: #9ca3af;
  font-size: 9px;
  line-height: 1.3;
  text-align: center;
}

.bmn-fe-table code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #333;
}

/* ── Kondisi badges ─────────────────────────────────────────────── */
.bmn-fe-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.bmn-fe-badge--aktif  { background: #d4edda; color: #155724; }
.bmn-fe-badge--rusak  { background: #fff3cd; color: #7d5a00; }
.bmn-fe-badge--hilang { background: #f8d7da; color: #721c24; }

/* ── Notices ────────────────────────────────────────────────────── */
.bmn-fe-notice {
  text-align: center;
  padding: 28px !important;
  color: var(--bmn-gray);
  font-size: 14px;
  white-space: normal;
}

.bmn-fe-notice--error { color: var(--bmn-red); }

.bmn-fe-loading-row td {
  color: var(--bmn-gray);
  font-style: italic;
  text-align: center;
}

.bmn-fe-link { color: var(--bmn-blue); }
.bmn-fe-link:hover { text-decoration: underline; }

/* ── Pagination ─────────────────────────────────────────────────── */
.bmn-fe-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.bmn-fe-page-info {
  font-size: 13px;
  color: var(--bmn-gray);
}

.bmn-fe-page-btns {
  display: flex;
  gap: 8px;
}

/* ── Responsive – tablet ────────────────────────────────────────── */
@media (max-width: 900px) {
  .bmn-fe-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .bmn-fe-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .bmn-fe-filters {
    flex-wrap: wrap;
  }

  .bmn-fe-input--sm {
    width: 100%;
  }

  .bmn-fe-stat-val {
    font-size: 26px;
  }
}

@media (max-width: 400px) {
  .bmn-fe-stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Print ──────────────────────────────────────────────────────── */
@media print {
  .bmn-fe-toolbar,
  .bmn-fe-pagination {
    display: none !important;
  }

  .bmn-fe-table-wrap {
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  .bmn-fe-table th,
  .bmn-fe-table td {
    padding: 6px 8px;
    white-space: normal;
  }

  .bmn-fe-stats {
    display: grid;
  }
}
