/* ============================================================
   SIMAS — Manajemen Sertifikasi — Module-specific styles
   Extends: shared/header.css + shared/sidebar.css
   ============================================================ */

/* ---- Table wrap with horizontal scroll ---- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- Masinis cell ---- */
.masinis-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.masinis-nip {
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.masinis-nama {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

/* ---- Certificate number ---- */
.cert-no {
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.cert-date {
  font-size: 0.75rem;
  white-space: nowrap;
}

/* ---- Document link ---- */
.doc-link {
  color: var(--accent);
  font-size: 1rem;
  text-decoration: none;
  transition: color 0.15s, transform 0.15s;
  display: inline-block;
}
.doc-link:hover {
  color: var(--accent2);
  transform: scale(1.15);
}

/* ---- Row highlight by criticality ---- */
.row-crit td {
  background: rgba(239, 68, 68, 0.025);
}
.row-crit:hover td {
  background: rgba(239, 68, 68, 0.06) !important;
}
.row-warn td {
  background: rgba(245, 158, 11, 0.025);
}
.row-warn:hover td {
  background: rgba(245, 158, 11, 0.06) !important;
}
.row-expired td {
  background: rgba(100, 116, 139, 0.04);
  opacity: 0.8;
}

/* ---- Expiry countdown animation (critical) ---- */
.sisa-crit {
  animation: critBlink 2.5s ease-in-out infinite;
}
@keyframes critBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---- Cert section ---- */
.cert-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ---- Result count ---- */
.cert-result-count {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

/* ---- Table footer & pagination ---- */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(27, 58, 107, 0.02);
}
.table-info {
  font-size: 0.6875rem;
  color: var(--muted);
}
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.pg-btn {
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: none;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.375rem;
}
.pg-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.pg-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 700;
}
.pg-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pg-sep {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 0.125rem;
}

/* ---- Sortable column ---- */
th.sortable:hover {
  color: var(--navy);
  background: rgba(27, 58, 107, 0.06);
}
th.sortable.sort-asc i::before { content: "\f0de"; }
th.sortable.sort-desc i::before { content: "\f0dd"; }

/* ============================================================
   Right Sidebar — Statistik per Dipo
   ============================================================ */
.dipo-stat-row {
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.dipo-stat-row:last-child {
  border-bottom: none;
}
.dipo-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
}
.dipo-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}
.dipo-ratio {
  font-size: 0.6875rem;
  color: var(--muted);
}
.dipo-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.dipo-bar-wrap .prog-bar-bg {
  flex: 1;
  height: 7px;
}
.dipo-pct {
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  min-width: 38px;
  text-align: right;
}
.dipo-alerts {
  display: flex;
  gap: 0.25rem;
}
.dipo-alert-tag {
  font-size: 0.5625rem;
  font-weight: 700;
  padding: 0.1rem 0.375rem;
  border-radius: 100px;
}
.dipo-alert-tag.crit {
  background: rgba(239, 68, 68, 0.12);
  color: #991B1B;
}
.dipo-alert-tag.warn {
  background: rgba(245, 158, 11, 0.12);
  color: #92400E;
}

/* ---- Quick stats card ---- */
.quick-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.quick-stat-row:last-child {
  border-bottom: none;
}
.quick-stat-lbl {
  font-size: 0.75rem;
  color: var(--muted);
}
.quick-stat-val {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
}

/* ---- Expiry timeline in sidebar ---- */
.expiry-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.expiry-tier {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.625rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
  position: relative;
}
.expiry-tier + .expiry-tier {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.tier-crit { border-left-color: var(--red); }
.tier-warn { border-left-color: var(--amber); }
.tier-ok { border-left-color: var(--accent); }

.expiry-tier-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 3px;
  flex-shrink: 0;
}
.tier-crit .expiry-tier-dot { background: var(--red); }
.tier-warn .expiry-tier-dot { background: var(--amber); }
.tier-ok .expiry-tier-dot { background: var(--accent); }

.expiry-tier-content { flex: 1; }
.expiry-tier-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}
.expiry-tier-count {
  font-size: 0.8125rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}
.expiry-tier-detail {
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 1px;
}

/* ============================================================
   Modal — Input Sertifikat
   ============================================================ */
.masinis-autocomplete-wrap {
  position: relative;
}
.masinis-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 300;
  max-height: 160px;
  overflow-y: auto;
}
.masinis-dropdown.open {
  display: block;
}
.masinis-option {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  transition: background 0.1s;
}
.masinis-option:hover {
  background: rgba(37, 99, 235, 0.07);
  color: var(--accent);
}

/* ---- File upload area ---- */
.file-upload-area {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
}
.file-upload-inner {
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.file-preview {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 6px;
  font-size: 0.75rem;
  color: #047857;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Form row spacing fix ---- */
.form-row .form-group {
  margin-bottom: 0;
}

/* ---- Toast notification ---- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--navy);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast.toast-success { background: var(--green); }
.toast.toast-error { background: var(--red); }
.toast.toast-warn { background: var(--amber); color: var(--text); }

/* ---- Responsive tweaks ---- */
@media (max-width: 1200px) {
  .row2 {
    grid-template-columns: 1fr;
  }
  .cert-result-count {
    display: none;
  }
}
