@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

/* ==========================================
   TEMA PIXEL / RETRO WINDOWS
   Palet: abu hangat, biru tua, merah, hijau, kuning
========================================== */
:root {
  --bg: #e9e7e0;
  --win: #d9d9d3;
  --hi: #ffffff;
  --lo: #86867f;
  --ink: #12121a;
  --sunk: #f6f5f0;
  --blue: #2a4fb8;
  --blue-d: #1c3680;
  --red: #d8403a;
  --green: #2fa84f;
  --yellow: #f6d34a;
  --tip: #fbeaa0;
  --px: 'Press Start 2P', 'Courier New', monospace;
  --body: 'VT323', 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

::selection { background: var(--blue); color: #fff; }

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(18, 18, 26, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 18, 26, 0.05) 1px, transparent 1px);
  background-size: 16px 16px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.2rem;
  line-height: 1.15;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 20px 12px 28px;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }

.linktree-container {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================
   KOMPONEN DASAR: JENDELA, BEVEL, TOMBOL
========================================== */
.win {
  background: var(--win);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--lo), 4px 4px 0 var(--ink);
  padding: 3px;
}

.win-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--blue);
  color: #fff;
  font-family: var(--px);
  font-size: 10px;
  line-height: 1;
  padding: 5px 6px;
  text-transform: uppercase;
}

.win-name { display: inline-flex; align-items: center; gap: 7px; }
.win-ctrls { display: inline-flex; gap: 3px; }

.win-ctrl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 16px;
  background: var(--win);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1;
  text-transform: none;
}

button.win-ctrl:active { box-shadow: inset 1px 1px 0 var(--lo), inset -1px -1px 0 var(--hi); translate: 1px 1px; }

/* Tombol bevel */
.btn, .music-btn, .playlist-btn {
  background: var(--win);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--lo);
  font-size: 1.15rem;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 0;
}

.btn:active, .music-btn:active, .playlist-btn:active {
  box-shadow: inset 2px 2px 0 var(--lo), inset -2px -2px 0 var(--hi);
  translate: 1px 1px;
}

.btn-primary { background: var(--blue); color: #fff; box-shadow: inset 2px 2px 0 #6f8fe6, inset -2px -2px 0 var(--blue-d); }
.btn-primary:active { box-shadow: inset 2px 2px 0 var(--blue-d), inset -2px -2px 0 #6f8fe6; }
.btn-danger { background: var(--red); color: #fff; box-shadow: inset 2px 2px 0 #f08a85, inset -2px -2px 0 #8e211d; }
.btn-danger:active { box-shadow: inset 2px 2px 0 #8e211d, inset -2px -2px 0 #f08a85; }

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

/* Bilah progres bersegmen */
.px-bar {
  height: 16px;
  background: #c9c9c3;
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo);
  padding: 2px;
  overflow: hidden;
}

.px-bar-fill {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--blue) 0 8px, transparent 8px 10px);
}

/* ==========================================
   LOADING SCREEN
========================================== */
.page-loader {
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.loader-win { width: 100%; max-width: 280px; }
.loader-body { padding: 16px 12px 14px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.loader-icon { font-size: 1.8rem; animation: hourglass 1.2s steps(4) infinite; }
.loader-body .px-bar { width: 100%; }
.loader-fill { animation: loadFill 1.4s steps(10) infinite; }

@keyframes hourglass { to { transform: rotate(180deg); } }
@keyframes loadFill { from { width: 0; } to { width: 100%; } }

/* ==========================================
   HEADER PROFIL
========================================== */
.profile-body { padding: 12px 10px 10px; display: flex; flex-direction: column; gap: 12px; }
.profile-row { display: flex; align-items: center; gap: 14px; }

.avatar-wrapper {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo), inset -2px -2px 0 var(--hi);
  background: var(--sunk);
  padding: 4px;
}

.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-info { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }

.profile-name {
  font-family: var(--px);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}

.profile-star { color: #e0a800; font-size: 0.8em; }
.profile-tagline { font-size: 1.2rem; color: #3a3a44; }

.badge-status {
  background: var(--green);
  color: #fff;
  border: 2px solid var(--ink);
  font-family: var(--px);
  font-size: 8px;
  line-height: 1;
  padding: 4px 6px;
}

/* Gelembung ala tooltip retro */
.speech-bubble {
  position: relative;
  background: var(--tip);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 6px 10px;
  font-size: 1.15rem;
  align-self: flex-start;
}

.speech-bubble::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 28px;
  border: 5px solid transparent;
  border-bottom: 5px solid var(--ink);
  border-top-width: 0;
  border-bottom-width: 8px;
}

/* ==========================================
   WIDGET MUSIK
========================================== */
.music-body { display: flex; align-items: center; gap: 10px; padding: 10px 8px; }

.music-btn, .playlist-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.music-btn { background: var(--blue); color: #fff; box-shadow: inset 2px 2px 0 #6f8fe6, inset -2px -2px 0 var(--blue-d); }
.music-btn:active { box-shadow: inset 2px 2px 0 var(--blue-d), inset -2px -2px 0 #6f8fe6; }
.music-btn.is-playing { background: var(--green); box-shadow: inset 2px 2px 0 #7fd596, inset -2px -2px 0 #1b6b34; }

.music-info { display: flex; flex-direction: column; gap: 3px; overflow: hidden; flex-grow: 1; cursor: pointer; min-width: 0; }
.music-label { font-family: var(--px); font-size: 7px; line-height: 1.3; color: #555; }

.music-title-wrapper { overflow: hidden; }

.music-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1.25rem;
}

.music-bar { height: 12px; padding: 1px; }
.music-bar .px-bar-fill { background: repeating-linear-gradient(90deg, var(--blue) 0 6px, transparent 6px 8px); }

/* ==========================================
   JENDELA AKORDEON
========================================== */
.links-wrapper { display: flex; flex-direction: column; gap: 16px; }

.card-status .link-icon { background: var(--green); color: #fff; }
.card-social .link-icon { background: var(--blue); color: #fff; }
.card-absen  .link-icon { background: var(--yellow); color: var(--ink); }

.accordion-header {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}

.accordion-header .win-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
}

.accordion-header:hover .win-row { background: #e6e6e0; }
.accordion-header:active .win-row { translate: 1px 1px; }
.accordion-header:focus-visible { outline-offset: -3px; }

.link-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.45), inset -2px -2px 0 rgba(0, 0, 0, 0.25);
  font-size: 1.05rem;
}

.link-text { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; min-width: 0; }
.link-title { font-family: var(--px); font-size: 10px; line-height: 1.4; }
.link-subtitle { font-size: 1.1rem; color: #3a3a44; }

.accordion-arrow {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--win);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--lo);
  font-size: 0.7rem;
}

.accordion-card.active .accordion-arrow {
  box-shadow: inset 2px 2px 0 var(--lo), inset -2px -2px 0 var(--hi);
}
.accordion-card.active .accordion-arrow i { transform: rotate(180deg); }

.accordion-content { display: none; padding: 0 6px 6px; }
.accordion-card.active .accordion-content { display: block; }

/* ==========================================
   PANEL STATUS KELAS
========================================== */
.status-panel {
  background: var(--sunk);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ping-header { display: flex; align-items: center; gap: 8px; font-family: var(--px); font-size: 8px; }
.ping-live-label { flex-grow: 1; }
.ping-cursor { animation: blink 1s steps(1) infinite; }
.ping-clock { font-family: var(--body); font-size: 1.2rem; }

.ping-dot { width: 10px; height: 10px; border: 2px solid var(--ink); animation: blink 1.2s steps(1) infinite; }
.ping-dot.dot-green { background: var(--green); }

@keyframes blink { 50% { opacity: 0.25; } }

.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.status-stat {
  background: var(--win);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--lo);
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.status-number { font-family: var(--px); font-size: 16px; }
.status-label { font-size: 1.05rem; color: #3a3a44; }
.stat-active .status-number { color: #1b8a3b; }
.stat-inactive .status-number { color: var(--red); }

.status-bar-row { display: flex; align-items: center; gap: 8px; }
.status-bar-row .px-bar { flex-grow: 1; }
.status-bar-label { font-size: 1.1rem; white-space: nowrap; }

/* ==========================================
   MEDIA SOSIAL (gaya menu)
========================================== */
.social-list {
  background: var(--sunk);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo);
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.social-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  color: var(--ink);
  text-decoration: none;
}

.social-item + .social-item { border-top: 2px dotted var(--lo); }
.social-item:hover, .social-item:focus-visible { background: var(--blue); color: #fff; outline: 0; }
.social-item:active { translate: 1px 1px; }

.social-icon { width: 28px; text-align: center; font-size: 1.3rem; flex-shrink: 0; }
.social-info { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.social-name { font-family: var(--px); font-size: 10px; line-height: 1.3; }
.social-handle { font-size: 1.1rem; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; }
.social-action { font-size: 1.1rem; white-space: nowrap; }

/* ==========================================
   POPUP PLAYLIST
========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 26, 0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.playlist-card { width: 100%; max-width: 360px; }
.playlist-body { padding: 10px 8px 8px; display: flex; flex-direction: column; gap: 8px; }
.playlist-subtitle { font-size: 1.15rem; }

.playlist-container {
  background: var(--sunk);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 50vh;
  overflow-y: auto;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  cursor: pointer;
}

.playlist-item:hover { background: #dfe6f8; }
.playlist-item:active { translate: 1px 1px; }
.playlist-item.active { background: var(--blue); color: #fff; }

.song-icon { width: 22px; text-align: center; flex-shrink: 0; }
.song-info { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.song-title { font-family: var(--px); font-size: 9px; line-height: 1.4; }
.song-artist { font-size: 1.05rem; opacity: 0.85; }
.play-indicator { font-family: var(--px); font-size: 7px; white-space: nowrap; }

/* ==========================================
   FOOTER (bar status)
========================================== */
footer {
  background: var(--win);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo), inset -2px -2px 0 var(--hi);
  padding: 6px 10px;
  text-align: center;
  font-size: 1.05rem;
}

/* ==========================================
   ABSENSI KELAS
========================================== */
.absen-box { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.absen-fields { display: flex; flex-direction: column; gap: 8px; }

.absen-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 1.1rem;
}

/* Kolom isian cekung */
.absen-box select,
.absen-box input[type="date"],
.absen-box input[type="text"],
.absen-box input[type="search"] {
  width: 100%;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: inset 2px 2px 0 var(--lo);
  padding: 6px 8px;
  font-size: 1.15rem;
  line-height: 1.1;
}

.absen-box select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h10v2H8v2H6v2H4V4H2V2H0z' fill='%2312121a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.absen-box select:disabled { opacity: 0.5; }

.absen-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.absen-stat {
  background: var(--sunk);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo);
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.absen-stat b { font-family: var(--px); font-size: 14px; font-weight: normal; }
.absen-stat span { font-size: 1.05rem; color: #3a3a44; }
.absen-stat-ok b { color: #1b8a3b; }
.absen-stat-no b { color: var(--red); }

.absen-toolbar { display: flex; flex-wrap: wrap; gap: 6px; }

.absen-list {
  max-height: 300px;
  overflow-y: auto;
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo);
  padding: 2px 8px;
}

.absen-row {
  display: grid;
  grid-template-columns: 22px 1fr 100px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
}

.absen-row + .absen-row { border-top: 2px dotted #c9c9c3; }
.absen-row label { font-size: 1.15rem; line-height: 1.1; cursor: pointer; }
.absen-row.present label { color: #1b6b34; }
.absen-row select { padding: 3px 22px 3px 6px; font-size: 1rem; background-position: right 6px center; }

/* Kotak centang pixel */
.absen-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo);
  display: grid;
  place-content: center;
  cursor: pointer;
}

.absen-row input[type="checkbox"]:checked::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--ink);
  clip-path: polygon(0 55%, 15% 40%, 40% 62%, 85% 8%, 100% 22%, 40% 92%);
}

.absen-note { font-size: 1.05rem; line-height: 1.1; color: #3a3a44; }

.absen-results { display: grid; grid-template-columns: 1fr; gap: 8px; }

.absen-resultbox {
  background: var(--sunk);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--lo);
  padding: 10px 10px 10px 12px;
}

.absen-resultbox h3 { font-family: var(--px); font-size: 9px; font-weight: normal; line-height: 1.4; margin-bottom: 8px; }
.absen-resultbox h3.ok { color: #1b8a3b; }
.absen-resultbox h3.no { color: var(--red); }
.absen-resultbox ol { padding-left: 34px; font-size: 1.15rem; line-height: 1.25; }

.absen-copy { width: 100%; font-family: var(--px); font-size: 9px; padding: 12px 10px; }
.absen-status { font-size: 1.1rem; min-height: 1em; text-align: center; }
