/* ==========================================================================
   EnjunPilem — Request Film / Series
   Tema gelap ala Jellyfin. Tanpa framework, tanpa CDN.
   ========================================================================== */

:root {
  --bg: #000000;
  --surface: #101010;
  --surface-2: #161616;
  --surface-3: #1c1c1c;
  --border: #242424;
  --border-soft: #1b1b1b;
  --text: #f2f2f2;
  --text-dim: #b9b9b9;
  --muted: #8a8a8a;
  --accent: #00a4dc;
  --accent-hover: #29b8e8;
  --accent-soft: rgba(0, 164, 220, 0.12);
  --danger: #e5484d;
  --danger-hover: #f2555a;
  --ok: #3fb950;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.required {
  color: var(--accent);
}

/* ---------------------------------------------------------------- brand -- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  color: var(--accent);
  flex: 0 0 auto;
}

.brand-name {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------------- login -- */

.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background:
    radial-gradient(760px 420px at 50% -8%, rgba(0, 164, 220, 0.14), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 26px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-top: 22px;
  font-size: 21px;
}

.login-card .muted {
  margin: 6px 0 22px;
  font-size: 13.5px;
}

/* ----------------------------------------------------------------- form -- */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.field label .muted {
  font-size: 12px;
}

input[type="text"],
input[type="password"],
input[type="search"],
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.35;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  appearance: none;
}

input::placeholder {
  color: #6a6a6a;
}

input:hover:not(:disabled),
select:hover:not(:disabled) {
  border-color: #303030;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 164, 220, 0.16);
}

input:disabled {
  color: var(--text-dim);
  background: #0d0d0d;
  border-color: var(--border-soft);
  cursor: not-allowed;
}

select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238a8a8a' d='M6 8 0 1.4 1.4 0 6 5.2 10.6 0 12 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

select option {
  background: #161616;
  color: var(--text);
}

/* input yang gagal validasi */
input.invalid,
select.invalid {
  border-color: rgba(229, 72, 77, 0.75);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.12);
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.field-error {
  margin: 0;
  font-size: 12.5px;
  color: #ff8f93;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-2 .field {
  margin-bottom: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.form-status {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.form-status-error {
  color: #ffb4b6;
  background: rgba(229, 72, 77, 0.1);
  border-color: rgba(229, 72, 77, 0.35);
}

.form-status-success {
  color: #9ae6a8;
  background: rgba(63, 185, 80, 0.1);
  border-color: rgba(63, 185, 80, 0.32);
}

#login-error {
  margin: 4px 0 14px;
}

/* --------------------------------------------------------------- button -- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 550;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: #222222;
  border-color: #333333;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  color: #04181f;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 650;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #04181f;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}

.btn-danger {
  color: #ffd3d4;
  background: rgba(229, 72, 77, 0.14);
  border-color: rgba(229, 72, 77, 0.45);
}

.btn-danger:hover:not(:disabled) {
  color: #fff;
  background: rgba(229, 72, 77, 0.26);
  border-color: var(--danger-hover);
}

.btn-sm {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

/* --------------------------------------------------------------- topbar -- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-name {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(0, 164, 220, 0.35);
  border-radius: 999px;
}

/* -------------------------------------------------------------- layout --- */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card > h2,
.card-head h2 {
  font-size: 16px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.count {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.card > h2 {
  margin-bottom: 18px;
}

/* --------------------------------------------------------------- filter -- */

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.filters .field {
  margin-bottom: 0;
}

.filters input,
.filters select {
  min-height: 38px;
  font-size: 13.5px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.btn-reset {
  min-height: 38px;
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- table -- */

.list-status {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.req-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 720px;
}

.req-table thead th {
  padding: 0 12px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.req-table tbody td {
  padding: 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
}

.req-table tbody tr:last-child td {
  border-bottom: 0;
}

.req-table tbody tr {
  transition: background 0.12s ease;
}

.req-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

/* baris milik sendiri */
.req-table tbody tr.own {
  background: rgba(0, 164, 220, 0.055);
}

.req-table tbody tr.own:hover {
  background: rgba(0, 164, 220, 0.085);
}

.req-table tbody tr.own td:first-child {
  box-shadow: inset 2px 0 0 rgba(0, 164, 220, 0.75);
}

.cell-date {
  color: var(--text-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cell-name {
  color: var(--text-dim);
  white-space: nowrap;
}

.cell-title {
  color: var(--text);
  font-weight: 500;
  min-width: 180px;
  overflow-wrap: anywhere;
}

.cell-type {
  color: var(--text-dim);
  white-space: nowrap;
}

.cell-imdb a {
  color: var(--accent);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(0, 164, 220, 0.35);
}

.cell-imdb a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.cell-empty {
  color: #666;
}

/* --------------------------------------------------------------- badges -- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-baru {
  color: #6fd3f5;
  background: rgba(0, 164, 220, 0.14);
  border-color: rgba(0, 164, 220, 0.4);
}

.badge-diproses {
  color: #f2be62;
  background: rgba(245, 165, 36, 0.13);
  border-color: rgba(245, 165, 36, 0.38);
}

.badge-selesai {
  color: #86dfa0;
  background: rgba(63, 185, 80, 0.13);
  border-color: rgba(63, 185, 80, 0.38);
}

.badge-ditolak {
  color: #ff9a9d;
  background: rgba(229, 72, 77, 0.13);
  border-color: rgba(229, 72, 77, 0.38);
}

.badge-sudahada {
  color: #c3a6ff;
  background: rgba(163, 113, 247, 0.13);
  border-color: rgba(163, 113, 247, 0.38);
}

.badge-default {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

/* ---------------------------------------------------------------- aksi --- */

.cell-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-select {
  width: auto;
  min-width: 116px;
  min-height: 32px;
  padding: 4px 28px 4px 9px;
  font-size: 12.5px;
  background-position: right 9px center;
}

/* ----------------------------------------------------------------- empty - */

.empty {
  padding: 34px 16px;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* ----------------------------------------------------------------- toast - */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  transform: translateX(-50%);
  max-width: min(92vw, 460px);
  padding: 11px 16px;
  font-size: 13.5px;
  color: var(--text);
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.toast-error {
  color: #ffc9cb;
  border-color: rgba(229, 72, 77, 0.5);
  background: #2a1214;
}

.toast-success {
  color: #b6f0c3;
  border-color: rgba(63, 185, 80, 0.45);
  background: #10231a;
}

.noscript {
  padding: 24px;
  color: var(--text);
  text-align: center;
}

/* ------------------------------------------------------------ responsive - */

@media (max-width: 860px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .field-search {
    grid-column: 1 / -1;
  }

  .btn-reset {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14.5px;
  }

  .container {
    padding: 16px 14px 56px;
    gap: 16px;
  }

  .card {
    padding: 16px;
    border-radius: 8px;
  }

  .topbar-inner {
    padding: 10px 14px;
  }

  .user-name {
    max-width: 120px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-actions .btn {
    width: 100%;
  }

  /* tabel jadi kartu */
  .table-wrap {
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  .req-table {
    min-width: 0;
    display: block;
  }

  .req-table thead {
    display: none;
  }

  .req-table tbody,
  .req-table tr {
    display: block;
  }

  .req-table tbody tr {
    margin-bottom: 10px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .req-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .req-table tbody tr.own {
    border-color: rgba(0, 164, 220, 0.4);
    box-shadow: inset 2px 0 0 rgba(0, 164, 220, 0.75);
  }

  .req-table tbody tr.own td:first-child {
    box-shadow: none;
  }

  .req-table tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border-bottom: 0;
    font-size: 13.5px;
    text-align: right;
  }

  .req-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 3px;
    text-align: left;
  }

  .req-table tbody td.cell-title {
    padding-top: 2px;
  }

  .req-table tbody td.cell-title .cell-title-text {
    font-weight: 600;
    overflow-wrap: anywhere;
  }

  .req-table tbody td.cell-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }

  .req-table tbody td.cell-actions::before {
    content: none;
  }

  .status-select {
    width: 100%;
    min-height: 38px;
    font-size: 13px;
  }

  .cell-actions .btn {
    width: 100%;
    min-height: 38px;
    font-size: 13px;
  }
}

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