/* ── Auth: halaman /login, /register, /profile ──
   Dimuat web.html lewat <link rel="stylesheet" href="/css/auth.css">.
   Halaman auth memakai layout sendiri (body.auth-mode) — baris provider &
   search disembunyikan, konten dipusatkan. */

/* Avatar profil di header (kanan) */
.profile-btn {
  flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.profile-btn:hover { border-color: var(--purple); }
.profile-btn.logged { background: var(--purple); border-color: var(--purple); color: #fff; }
/* Donatur: avatar emas di header */
.profile-btn.donor {
  background: linear-gradient(140deg, #FFD166, #FF9F1C);
  border-color: #FFD166; color: #3a2708;
  box-shadow: 0 0 0 2px rgba(255,209,102,.25);
}

/* Hati favorit di kartu drama */
.card-heart {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  background: rgba(11,11,16,.72); border: 1px solid var(--border);
  color: #fff; font-size: 13px; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.card-heart.on { color: var(--red); }

/* Badge episode pada kartu riwayat */
.hist-ep {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  background: rgba(11,11,16,.78); border: 1px solid var(--border);
  color: var(--text); font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
}

/* Badge progres tontonan di kartu katalog (EP.x + bar tipis) */
.hist-badge {
  position: absolute; bottom: 6px; left: 6px; z-index: 2;
  background: rgba(11,11,16,.78); border: 1px solid var(--border);
  color: var(--text); font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
}
.hist-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  height: 3px; background: rgba(255,255,255,.18);
}
.hist-bar i { display: block; height: 100%; background: var(--red); }

/* ─── Layout khusus halaman auth ─────────────────────────────────────────── */

body.auth-mode .prov-row,
body.auth-mode .search-box { display: none !important; }
body.auth-mode #grid,
body.auth-mode #loadMore { display: none !important; }
body.auth-mode main { padding: 10px 12px 60px; }

.auth-wrap {
  display: block;
  max-width: 460px;
  margin: 0 auto;
}
body:not(.auth-mode) .auth-wrap { display: none !important; }

/* Kartu terang dengan glow ungu di belakang */
.auth-hero {
  text-align: center;
  padding: 26px 10px 18px;
}
.auth-hero .bolt {
  width: 64px; height: 64px; margin: 0 auto 12px;
  border-radius: 20px;
  background: linear-gradient(140deg, #8B5CF6, #6D28D9);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: #fff;
  box-shadow: 0 12px 32px rgba(139,92,246,.45);
}
.auth-hero h2 {
  margin: 0 0 6px; font-size: 22px; color: var(--text); letter-spacing: -.3px;
}
.auth-hero h2 em { font-style: normal; color: var(--purple); }
.auth-hero p { margin: 0; font-size: 13px; color: var(--dim); line-height: 1.5; }

.auth-card {
  background: linear-gradient(180deg, var(--surface2), var(--surface));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 18px 46px rgba(0,0,0,.45);
}

/* Tab Masuk | Daftar */
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px; margin-bottom: 18px;
}
.auth-tab {
  background: none; border: none; color: var(--dim);
  font: inherit; font-size: 13px; font-weight: 700;
  padding: 9px 0; border-radius: 9px; cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--purple); color: #fff; }

/* Field dengan label + ikon */
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--dim); letter-spacing: .4px; text-transform: uppercase;
  margin-bottom: 6px;
}
.field .inp {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 0 12px;
  transition: border-color .15s, box-shadow .15s;
}
.field .inp:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139,92,246,.18);
}
.field .inp i { font-style: normal; font-size: 15px; opacity: .75; }
.field input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 14px;
  padding: 13px 0;
}
.field input::placeholder { color: #6E6E7E; }
.field .eye {
  background: none; border: none; cursor: pointer;
  color: var(--dim); font-size: 15px; padding: 4px;
}

.auth-err {
  color: var(--red); font-size: 12px; line-height: 1.4;
  margin: 0 0 10px; min-height: 0;
}
.auth-err:empty { display: none; }

.auth-btn {
  width: 100%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #8B5CF6, #6D28D9);
  color: #fff; font: inherit; font-weight: 700; font-size: 14px;
  padding: 14px; border-radius: 12px;
  box-shadow: 0 10px 24px rgba(109,40,217,.35);
  transition: transform .12s, opacity .15s;
}
.auth-btn:active { transform: scale(.985); }
.auth-btn:disabled { opacity: .6; cursor: default; }

.auth-foot {
  margin-top: 16px; text-align: center;
  font-size: 12.5px; color: var(--dim);
}
.auth-foot a { color: var(--purple); font-weight: 700; text-decoration: none; }
.auth-note {
  margin-top: 14px; font-size: 11.5px; color: var(--dim);
  text-align: center; line-height: 1.5;
}
.auth-back {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: fit-content; max-width: 100%;
  margin: 22px auto 0;
  padding: 13px 24px;
  font-size: 15px; font-weight: 700;
  color: var(--purple); text-decoration: none;
  background: rgba(139,92,246,.12);
  border: 1.5px solid rgba(139,92,246,.55);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(109,40,217,.18);
  transition: background .15s, color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.auth-back:hover, .auth-back:active {
  background: var(--purple); color: #fff; border-color: var(--purple);
  transform: translateY(-1px); box-shadow: 0 10px 26px rgba(109,40,217,.35);
}

/* ─── Halaman /profile ────────────────────────────────────────────────────── */

.prof-card {
  background: linear-gradient(180deg, var(--surface2), var(--surface));
  border: 1px solid var(--border);
  border-radius: 20px; padding: 20px;
  box-shadow: 0 18px 46px rgba(0,0,0,.45);
}
.prof-head { display: flex; align-items: center; gap: 14px; }
.prof-avatar {
  width: 62px; height: 62px; flex: none; border-radius: 50%;
  background: linear-gradient(140deg, #8B5CF6, #6D28D9);
  color: #fff; font-size: 26px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(139,92,246,.4);
}
.prof-meta { min-width: 0; flex: 1; }
.prof-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 17px; font-weight: 800; color: var(--text);
}
.prof-name button {
  background: none; border: none; cursor: pointer; padding: 2px;
  font-size: 13px; opacity: .7;
}
.prof-name button:hover { opacity: 1; }
.prof-email {
  font-size: 12.5px; color: var(--dim); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.prof-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 18px 0;
}
.prof-stats .st {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px; text-align: center;
}
.prof-stats .st b { display: block; font-size: 19px; color: var(--text); }
.prof-stats .st span { font-size: 11px; color: var(--dim); }

/* Badge Donatur di sebelah nama */
.prof-badge {
  flex: none;
  font-size: 10px; font-weight: 800; letter-spacing: .3px;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.prof-badge.donor {
  color: #FFD166;
  background: linear-gradient(140deg, rgba(255,209,102,.18), rgba(255,159,28,.14));
  border-color: rgba(255,209,102,.55);
}

/* Kotak Donatur di kartu profil */
.donor-box {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 14px;
  border-radius: 16px;
  background: linear-gradient(140deg, rgba(139,92,246,.16), rgba(109,40,217,.10));
  border: 1px solid rgba(139,92,246,.4);
}
.donor-box.on {
  background: linear-gradient(140deg, rgba(255,209,102,.18), rgba(255,159,28,.10));
  border-color: rgba(255,209,102,.5);
  box-shadow: 0 10px 26px rgba(255,159,28,.16);
}
.donor-box .donor-ico { font-size: 22px; flex: none; }
.donor-box .donor-txt { flex: 1 1 150px; min-width: 0; }
.donor-box .donor-txt b { display: block; font-size: 13.5px; color: var(--text); }
.donor-box .donor-txt span { font-size: 11.5px; color: var(--dim); line-height: 1.45; }
.donor-btn {
  flex: none; margin-left: auto;
  background: var(--purple); color: #fff;
  border: 1px solid var(--purple); border-radius: 999px;
  padding: 9px 15px;
  font: inherit; font-size: 12.5px; font-weight: 700;
  cursor: pointer; transition: opacity .15s, transform .15s, border-color .15s, color .15s;
}
.donor-btn:hover { transform: translateY(-1px); }
.donor-btn:disabled { opacity: .6; cursor: default; transform: none; }
.donor-btn.ghost {
  background: transparent; color: var(--dim); border-color: var(--border);
}
.donor-btn.ghost:hover { color: var(--text); border-color: var(--dim); }

.prof-menu { display: flex; flex-direction: column; gap: 8px; }
.menu-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px;
  color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.menu-row:hover { border-color: var(--purple); background: var(--surface2); }
.menu-row .mi { font-size: 17px; }
.menu-row .mt { flex: 1; }
.menu-row .mc { color: var(--dim); font-size: 18px; }
.menu-row.danger .mt { color: var(--red); }

/* Form ganti nama (inline di profil) */
.prof-edit { margin-top: 10px; }
.prof-edit input {
  width: 100%; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px; padding: 13px;
  font: inherit; font-size: 14px; margin-bottom: 8px;
}
.prof-edit input:focus {
  outline: none; border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139,92,246,.18);
}

/* Daftar favorit/riwayat di bawah kartu profil */
#profList { margin-top: 20px; }
#profList .grid, #profList {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
#profList .card { cursor: pointer; }
#profList .card img {
  width: 100%; aspect-ratio: 2/3; object-fit: cover;
  border-radius: 8px; background: var(--surface2); display: block;
}
#profList .card .title {
  font-size: 11.5px; margin-top: 4px; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; padding: 0 2px;
}
#profList .card-cover { position: relative; }

@media (min-width: 700px) {
  #profList { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
  .profile-btn { width: 30px; height: 30px; font-size: 13px; }
  .auth-hero { padding: 12px 6px 14px; }
  .auth-hero h2 { font-size: 19px; }
  .auth-card, .prof-card { padding: 16px; border-radius: 16px; }
  .donor-box { padding: 12px; gap: 10px; }
  .donor-btn { padding: 8px 13px; font-size: 12px; }
}

/* ─── Modal auth lama (tetap dipakai untuk sheet kecil) ───────────────────── */
.auth-sheet { width: min(380px, 92vw); }
.auth-sheet input {
  width: 100%; box-sizing: border-box;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 12px;
  margin-bottom: 10px; font-size: 14px;
}
.auth-sheet input:focus { outline: none; border-color: var(--purple); }
.auth-submit {
  width: 100%; background: var(--purple); color: #fff; border: none;
  border-radius: 10px; padding: 12px; font-weight: 700; font-size: 14px;
  cursor: pointer;
}
.auth-submit:disabled { opacity: .6; }
.auth-submit.ghost { background: var(--surface2); border: 1px solid var(--border); }
.auth-submit.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.auth-alt { margin-top: 12px; font-size: 12px; color: var(--dim); text-align: center; }
.auth-alt a { color: var(--purple); cursor: pointer; text-decoration: none; }
.auth-user { margin-bottom: 12px; font-size: 14px; color: var(--text); word-break: break-all; }
.auth-menu { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

/* ─── Halaman Admin (/admin) ─────────────────────────────────────────────── */
.adm-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px; margin: 0 auto; max-width: 920px;
}
.adm-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.adm-title { font-weight: 800; font-size: 16px; flex: 1; min-width: 180px; }
.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.adm-actions input[type=search] {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px;
}
.adm-stats { color: var(--dim); font-size: 12.5px; margin-bottom: 10px; }
.adm-stats b { color: var(--text); }
.adm-list { display: flex; flex-direction: column; gap: 8px; }
.adm-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
}
.adm-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; }
.adm-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #8B5CF6, #6D28D9); color: #fff;
  font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.adm-meta { min-width: 0; }
.adm-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-mail { font-size: 12px; color: var(--dim); word-break: break-all; }
.adm-nums { display: flex; gap: 12px; color: var(--dim); font-size: 12px; white-space: nowrap; }
.adm-date { color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.adm-btns { display: flex; gap: 6px; }
.adm-btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 12.5px;
}
.adm-btn:hover { border-color: var(--purple); }
.adm-btn.ok { border-color: var(--green); color: var(--green); }
.adm-btn.danger { color: var(--red); }
.adm-btn:disabled { opacity: .55; cursor: default; }
.adm-edit { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; width: 100%; }
.adm-edit input[type=text], .adm-edit input[type=email], .adm-edit input[type=password] {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px;
  flex: 1; min-width: 130px;
}
.adm-donor { display: flex; align-items: center; gap: 5px; color: var(--text); font-size: 13px; white-space: nowrap; }
.adm-err { color: var(--red); font-size: 12px; }

/* Chip status fitur dalam pengembangan (donor-box) */
.donor-dev {
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  background: rgba(245,166,35,.15); color: var(--amber);
  border: 1px solid rgba(245,166,35,.35);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
@media (max-width: 600px) {
  .adm-card { padding: 12px; }
  .adm-btns { width: 100%; justify-content: flex-end; }
}
