/* =====================================================================
   EDC ENTERPRISE - Tema "Andon Board"
   Bahasa visual diambil dari panel kendali mesin produksi:
   rail status berwarna, angka bergaya instrumen, label kondensasi.
   ===================================================================== */

:root {
  --edc-base:      #0A1017;
  --edc-base-alt:  #0D141D;
  --edc-panel:     #111A24;
  --edc-panel-2:   #16212D;
  --edc-line:      #1E2A38;
  --edc-text:      #E8EEF6;
  --edc-muted:     #7D91A8;
  --edc-accent:    #FFB020;   /* amber sinyal mesin */
  --edc-good:      #22C58B;
  --edc-warn:      #F5A524;
  --edc-bad:       #F04A5C;
  --edc-info:      #3DA5F4;
  --edc-shadow:    0 8px 28px rgba(0,0,0,.45);
  --edc-radius:    10px;

  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body:    "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "JetBrains Mono", "Consolas", "Courier New", monospace;
}

[data-theme="light"] {
  --edc-base:      #EDF1F6;
  --edc-base-alt:  #E4EAF2;
  --edc-panel:     #FFFFFF;
  --edc-panel-2:   #F5F8FB;
  --edc-line:      #D9E1EB;
  --edc-text:      #16202B;
  --edc-muted:     #5D6E82;
  --edc-shadow:    0 6px 20px rgba(19,35,54,.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--edc-base);
  color: var(--edc-text);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .display-font {
  font-family: var(--font-display);
  letter-spacing: .02em;
  font-weight: 600;
}

a { color: var(--edc-info); text-decoration: none; }
a:hover { color: var(--edc-accent); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--edc-line); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--edc-muted); }

/* ---------------- Layout ---------------- */
.edc-shell { display: flex; min-height: 100vh; }

.edc-sidebar {
  width: 250px; flex: 0 0 250px;
  background: var(--edc-base-alt);
  border-right: 1px solid var(--edc-line);
  position: fixed; inset: 0 auto 0 0; z-index: 1040;
  display: flex; flex-direction: column;
  transition: transform .22s ease;
}
.edc-sidebar__brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--edc-line);
  display: flex; align-items: center; gap: 11px;
}
.edc-sidebar__mark {
  width: 38px; height: 38px; border-radius: 9px; flex: 0 0 38px;
  background: linear-gradient(150deg, var(--edc-accent), #E0730C);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 17px; font-weight: 700; color: #10161D;
}
.edc-sidebar__title { font-family: var(--font-display); font-size: 19px; line-height: 1; letter-spacing: .06em; }
.edc-sidebar__sub { font-size: 10.5px; color: var(--edc-muted); letter-spacing: .08em; text-transform: uppercase; }

.edc-nav { flex: 1; overflow-y: auto; padding: 10px 10px 24px; }
.edc-nav__group {
  font-family: var(--font-display); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--edc-muted);
  padding: 16px 10px 7px;
}
.edc-nav__link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; margin-bottom: 2px;
  border-radius: 8px; color: var(--edc-text); opacity: .82;
  font-size: 13.5px; position: relative;
}
.edc-nav__link i { font-size: 15px; width: 18px; text-align: center; color: var(--edc-muted); }
.edc-nav__link:hover { background: var(--edc-panel); opacity: 1; color: var(--edc-text); }
.edc-nav__link.active { background: var(--edc-panel-2); opacity: 1; color: var(--edc-accent); font-weight: 500; }
.edc-nav__link.active i { color: var(--edc-accent); }
.edc-nav__link.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--edc-accent);
}

.edc-main { flex: 1; margin-left: 250px; min-width: 0; display: flex; flex-direction: column; }

/* ---------------- Topbar ---------------- */
.edc-topbar {
  height: 60px; position: sticky; top: 0; z-index: 1030;
  background: color-mix(in srgb, var(--edc-base) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--edc-line);
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
}
.edc-topbar__title { font-family: var(--font-display); font-size: 21px; line-height: 1.1; }
.edc-topbar__meta { font-size: 11.5px; color: var(--edc-muted); }
.edc-icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--edc-line);
  background: var(--edc-panel); color: var(--edc-text);
  display: grid; place-items: center; position: relative; cursor: pointer;
}
.edc-icon-btn:hover { border-color: var(--edc-accent); color: var(--edc-accent); }
.edc-badge-dot {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--edc-bad); color: #fff;
  font-size: 10px; font-weight: 700; display: grid; place-items: center;
}

/* ---------------- Andon ticker (signature) ---------------- */
.edc-andon {
  display: flex; align-items: center; gap: 0;
  background: var(--edc-panel); border-bottom: 1px solid var(--edc-line);
  height: 34px; overflow: hidden;
}
.edc-andon__label {
  flex: 0 0 auto; height: 100%; display: flex; align-items: center; gap: 7px;
  padding: 0 14px; background: var(--edc-bad); color: #fff;
  font-family: var(--font-display); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase;
}
.edc-andon__track { flex: 1; overflow: hidden; white-space: nowrap; }
.edc-andon__items {
  display: inline-block; padding-left: 100%;
  animation: edc-marquee 46s linear infinite;
  font-size: 12.5px; color: var(--edc-text);
}
.edc-andon__items:hover { animation-play-state: paused; }
.edc-andon__items span { margin-right: 46px; }
.edc-andon__items b { color: var(--edc-accent); font-weight: 600; }
@keyframes edc-marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

.edc-content { padding: 20px 18px 40px; flex: 1; }

/* ---------------- Panel & kartu ---------------- */
.edc-panel {
  background: var(--edc-panel);
  border: 1px solid var(--edc-line);
  border-radius: var(--edc-radius);
  margin-bottom: 18px;
}
.edc-panel__head {
  padding: 13px 16px; border-bottom: 1px solid var(--edc-line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.edc-panel__title { font-family: var(--font-display); font-size: 16px; margin: 0; letter-spacing: .03em; }
.edc-panel__sub { font-size: 11.5px; color: var(--edc-muted); }
.edc-panel__body { padding: 16px; }

/* KPI card dengan rail status - elemen khas cockpit */
.kpi-card {
  position: relative; background: var(--edc-panel);
  border: 1px solid var(--edc-line); border-radius: var(--edc-radius);
  padding: 14px 16px 13px 19px; height: 100%;
  overflow: hidden; transition: transform .16s ease, border-color .16s ease;
}
.kpi-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--edc-muted);
}
.kpi-card.is-good::before    { background: var(--edc-good); }
.kpi-card.is-warning::before { background: var(--edc-warn); }
.kpi-card.is-bad::before     { background: var(--edc-bad); animation: edc-pulse 1.9s ease-in-out infinite; }
@keyframes edc-pulse { 0%,100% { opacity: 1; } 50% { opacity: .28; } }
.kpi-card:hover { transform: translateY(-2px); border-color: var(--edc-muted); }
.kpi-card__label {
  font-family: var(--font-display); font-size: 12.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--edc-muted); margin-bottom: 7px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.kpi-card__value { font-family: var(--font-mono); font-size: 27px; font-weight: 600; line-height: 1.05; }
.kpi-card__unit  { font-size: 12px; color: var(--edc-muted); font-family: var(--font-body); margin-left: 4px; }
.kpi-card__foot  { margin-top: 9px; display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; }
.kpi-card__target{ color: var(--edc-muted); font-family: var(--font-mono); }
.kpi-card__delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }

.txt-good { color: var(--edc-good) !important; }
.txt-warn { color: var(--edc-warn) !important; }
.txt-bad  { color: var(--edc-bad)  !important; }
.txt-muted{ color: var(--edc-muted) !important; }
.txt-accent{ color: var(--edc-accent) !important; }
.mono { font-family: var(--font-mono); }

.edc-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1px solid transparent; letter-spacing: .02em;
}
.chip-good { background: rgba(34,197,139,.13); color: var(--edc-good); border-color: rgba(34,197,139,.3); }
.chip-warn { background: rgba(245,165,36,.13); color: var(--edc-warn); border-color: rgba(245,165,36,.3); }
.chip-bad  { background: rgba(240,74,92,.13);  color: var(--edc-bad);  border-color: rgba(240,74,92,.3); }
.chip-info { background: rgba(61,165,244,.13); color: var(--edc-info); border-color: rgba(61,165,244,.3); }
.chip-muted{ background: rgba(125,145,168,.13);color: var(--edc-muted);border-color: rgba(125,145,168,.28); }

/* LED status mesin */
.led { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.led-running     { background: var(--edc-good); box-shadow: 0 0 8px var(--edc-good); }
.led-idle        { background: var(--edc-muted); }
.led-breakdown   { background: var(--edc-bad); box-shadow: 0 0 8px var(--edc-bad); animation: edc-pulse 1.2s infinite; }
.led-maintenance { background: var(--edc-info); }
.led-setup       { background: var(--edc-warn); }

/* Progress */
.edc-progress { height: 6px; border-radius: 4px; background: var(--edc-line); overflow: hidden; }
.edc-progress > span { display: block; height: 100%; border-radius: 4px; transition: width .5s ease; }

/* Tabel */
.table.edc-table { color: var(--edc-text); margin: 0; font-size: 13px; }
.edc-table > :not(caption) > * > * { background: transparent; border-bottom-color: var(--edc-line); padding: 9px 12px; }
.edc-table thead th {
  font-family: var(--font-display); font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--edc-muted); font-weight: 600; border-bottom: 1px solid var(--edc-line); white-space: nowrap;
}
.edc-table tbody tr:hover > * { background: var(--edc-panel-2); }

/* DataTables override */
.dataTables_wrapper { color: var(--edc-muted); font-size: 12.5px; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--edc-panel-2); border: 1px solid var(--edc-line);
  color: var(--edc-text); border-radius: 7px; padding: 4px 9px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--edc-text) !important; border-radius: 6px; border: 1px solid transparent;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--edc-accent) !important; color: #10161D !important; border: 0;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--edc-panel-2) !important; border-color: var(--edc-line);
}

/* Form & tombol */
.form-control, .form-select {
  background: var(--edc-panel-2); border: 1px solid var(--edc-line); color: var(--edc-text);
  border-radius: 8px; font-size: 13.5px;
}
.form-control:focus, .form-select:focus {
  background: var(--edc-panel-2); color: var(--edc-text);
  border-color: var(--edc-accent); box-shadow: 0 0 0 .18rem rgba(255,176,32,.16);
}
.form-label { font-size: 12px; color: var(--edc-muted); text-transform: uppercase; letter-spacing: .07em; }
.btn-edc {
  background: var(--edc-accent); color: #10161D; border: 0; font-weight: 600;
  border-radius: 8px; padding: 8px 17px; font-size: 13.5px;
}
.btn-edc:hover { background: #FFC048; color: #10161D; }
.btn-ghost {
  background: transparent; color: var(--edc-text); border: 1px solid var(--edc-line);
  border-radius: 8px; padding: 7px 14px; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--edc-accent); color: var(--edc-accent); }

.dropdown-menu {
  background: var(--edc-panel); border: 1px solid var(--edc-line); border-radius: 10px;
  box-shadow: var(--edc-shadow); font-size: 13.5px;
}
.dropdown-item { color: var(--edc-text); }
.dropdown-item:hover { background: var(--edc-panel-2); color: var(--edc-accent); }
.dropdown-divider { border-color: var(--edc-line); }

.modal-content { background: var(--edc-panel); color: var(--edc-text); border: 1px solid var(--edc-line); border-radius: 12px; }
.modal-header, .modal-footer { border-color: var(--edc-line); }
.nav-tabs { border-bottom-color: var(--edc-line); }
.nav-tabs .nav-link { color: var(--edc-muted); border: 0; border-bottom: 2px solid transparent; font-size: 13.5px; }
.nav-tabs .nav-link.active { color: var(--edc-accent); background: transparent; border-bottom-color: var(--edc-accent); }

/* Daftar notifikasi & highlight */
.edc-list-item {
  display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--edc-line);
}
.edc-list-item:last-child { border-bottom: 0; }
.edc-list-item__icon {
  width: 32px; height: 32px; border-radius: 8px; flex: 0 0 32px;
  display: grid; place-items: center; font-size: 15px;
}
.edc-list-item__title { font-size: 13.5px; font-weight: 500; }
.edc-list-item__meta  { font-size: 11.5px; color: var(--edc-muted); }

/* Rank list untuk Top 10 */
.rank-no {
  font-family: var(--font-mono); font-size: 12px; color: var(--edc-muted);
  width: 24px; flex: 0 0 24px; text-align: right;
}

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-visual {
  background:
    radial-gradient(900px 480px at 18% 12%, rgba(255,176,32,.14), transparent 62%),
    linear-gradient(160deg, #0A1017, #101C27 55%, #0A1017);
  padding: 54px; display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--edc-line);
}
.login-visual__grid {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 26px;
}
.login-stat {
  border: 1px solid rgba(255,255,255,.09); border-radius: 10px; padding: 12px 13px;
  background: rgba(255,255,255,.025);
}
.login-stat__v { font-family: var(--font-mono); font-size: 20px; color: #E8EEF6; }
.login-stat__l { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #7D91A8; }
.login-form { display: grid; place-items: center; padding: 40px; background: var(--edc-base); }
.login-card { width: 100%; max-width: 372px; }

/* War room */
.warroom { background: #06090D; color: #E8EEF6; }
.warroom .kpi-card { padding: 18px 20px 16px 22px; }
.warroom .kpi-card__value { font-size: 40px; }
.warroom .kpi-card__label { font-size: 14px; }

@media (max-width: 992px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .edc-sidebar { transform: translateX(-100%); box-shadow: var(--edc-shadow); }
  .edc-sidebar.is-open { transform: translateX(0); }
  .edc-main { margin-left: 0; }
  .edc-content { padding: 14px 12px 34px; }
  .kpi-card__value { font-size: 23px; }
  .edc-topbar__title { font-size: 17px; }
}

.edc-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1035; display: none;
}
.edc-backdrop.is-open { display: block; }

@media print {
  .edc-sidebar, .edc-topbar, .edc-andon, .no-print { display: none !important; }
  .edc-main { margin-left: 0; }
  body { background: #fff; color: #000; }
  .edc-panel, .kpi-card { border-color: #ccc; background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

:focus-visible { outline: 2px solid var(--edc-accent); outline-offset: 2px; }
