/* ================= RESET ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* ================= BACKGROUND: SATU DOT GRID ================= */
/* Satu-satunya background halaman: pola titik abu-abu lembut di atas dasar
   krem. Tetap sama di seluruh halaman dan tidak berganti saat tab, hasil,
   player, atau platform berubah. */
html {
    background-color: #f4f4f0;
}
body {
    min-height: 100vh;
    background-color: #f4f4f0;
    background-image: radial-gradient(#c4c7cc 2px, transparent 2.5px);
    background-size: 24px 24px;
    background-attachment: fixed;
    background-repeat: repeat;
}

/* Aksen global: hanya dipakai untuk bayangan .card. Berubah mengikuti
   platform/lagu yang terdeteksi, bukan background halaman. */
:root { --accent: #ef4444; }

/* ================= LAYOUT HALAMAN ================= */
.page {
    min-height: 100vh;
    width: 100%;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* ================= MODE TABS ================= */
.mode-tabs {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 480px;
}
.mode-tab {
    flex: 1;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 900;
    font-family: inherit;
    border: 3px solid #000;
    border-radius: 12px;
    background: #fff;
    color: #000;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    transition: transform 0.1s, box-shadow 0.1s, background 0.2s, color 0.2s;
}
.mode-tab:active { transform: translate(4px, 4px); box-shadow: none; }
.mode-tab.is-active { background: #000; color: #fff; }

/* ================= PANEL MODE ================= */
.mode-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

/* ================= KOTAK CARD ================= */
.card {
    background: #ffffff;
    border: 4px solid #000000;
    border-radius: 20px;
    box-shadow: 8px 8px 0px var(--accent);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    transition: box-shadow 0.2s ease;
}

.card h1 {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: #000;
    line-height: 1.1;
}
.card h2 {
    font-size: 18px;
    font-weight: 900;
    color: #ef4444;
    text-transform: uppercase;
    line-height: 1.2;
    margin-top: 4px;
}
.card p {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.6;
    margin-top: 14px;
}

/* Badge Kuning */
.badge-yellow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #facc15;
    border: 3px solid #000;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    color: #000;
    margin-top: 16px;
    box-shadow: 2px 2px 0px #000;
}
.badge-yellow svg { width: 16px; height: 16px; }

/* Badge platform: gaya neo-brutalist sama seperti .badge-yellow, hanya warna
   isi yang mengikuti platform (di-set inline oleh app.js). */
.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 3px solid #000;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 800;
    color: #000;
    background: #e5e7eb;
    margin-top: 12px;
    box-shadow: 2px 2px 0px #000;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
/* TikTok: bayangan badge ganda cyan + pink */
.platform-badge.is-tiktok {
    box-shadow: -3px -3px 0 #25F4EE, 3px 3px 0 #FE2C55, 2px 2px 0 #000;
}

/* Nama platform di card hasil */
.result-platform {
    display: inline-flex;
    align-items: center;
    border: 3px solid #000;
    border-radius: 50px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 800;
    color: #000;
    background: #e5e7eb;
    margin-top: 14px;
    box-shadow: 2px 2px 0px #000;
    transition: background 0.2s ease, color 0.2s ease;
}

.dashed-line {
    border-top: 3px dashed #000;
    margin: 20px 0;
    width: 100%;
}

.bottom-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Badge Live */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #dcfce7;
    border: 3px solid #000;
    border-radius: 50px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 700;
    color: #000;
    box-shadow: 2px 2px 0px #000;
}
.live-dot {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 1.5px solid #000;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Tombol WhatsApp */
.wa-btn {
    background: #22c55e;
    border: 3px solid #000;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 2px 0px #000;
    transition: transform 0.1s, box-shadow 0.1s;
    padding: 0;
}
.wa-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.wa-btn svg { width: 24px; height: 24px; fill: #fff; }

/* ================= KUMPULAN TOMBOL ================= */
.buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    width: 100%;
    max-width: 480px;
}

.btn {
    background: #ef4444;
    color: #fff;
    border: 3px solid #000;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 800;
    font-size: 14px;
    box-shadow: 3px 3px 0px #000;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}
.btn:active { transform: translate(3px, 3px); box-shadow: none; }

/* Varian Warna */
.btn-white  { background: #fff; color: #000; }
.btn-black  { background: #111; color: #fff; }
.btn-yellow { background: #facc15; color: #000; }
.btn-green  { background: #22c55e; color: #fff; }
.btn-blue   { background: #3b82f6; color: #fff; }
.btn-purple { background: #a855f7; color: #fff; }
.btn-pink   { background: #ec4899; color: #fff; }
.btn-orange { background: #f97316; color: #fff; }

/* Varian Ukuran */
.btn-sm { padding: 6px 12px; font-size: 12px; box-shadow: 2px 2px 0px #000; border-radius: 8px; }
.btn-sm:active { transform: translate(2px, 2px); }

.btn-lg { padding: 14px 28px; font-size: 16px; box-shadow: 4px 4px 0px #000; border-radius: 14px; }
.btn-lg:active { transform: translate(4px, 4px); }

.btn-block { width: 100%; padding: 16px; font-size: 16px; box-shadow: 5px 5px 0px #000; border-radius: 14px; }
.btn-block:active { transform: translate(5px, 5px); }

.btn-pill  { border-radius: 50px; }
.btn-round { border-radius: 50%; width: 52px; height: 52px; padding: 0; font-size: 20px; }

/* ================= TAMBAHAN APLIKASI ================= */
/* Kelas di bawah hanya untuk kebutuhan fungsional (input, player, dsb).
   Tidak mengubah tampilan kelas dasar TestUI. */
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: 3px 3px 0px #000; }

.url-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.url-input {
    flex: 1 1 200px;
    min-width: 0;
    border: 3px solid #000;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    box-shadow: 2px 2px 0px #000 inset;
    background: #fff;
}
.url-input:focus { outline: none; }

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 16px;
    margin-bottom: 6px;
    color: #000;
}
.field-hint {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    margin-top: 10px;
}
.format-select {
    width: 100%;
    border: 3px solid #000;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    background: #fff;
    box-shadow: 2px 2px 0px #000;
    cursor: pointer;
}

.thumb {
    width: 100%;
    border: 3px solid #000;
    border-radius: 14px;
    margin-top: 16px;
    display: block;
    background: #000;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.player {
    width: 100%;
    border: 3px solid #000;
    border-radius: 14px;
    margin-top: 16px;
    display: block;
    background: #000;
}

.meta-title { font-size: 16px; font-weight: 900; color: #000; margin-top: 12px; line-height: 1.3; }
.meta-sub { font-size: 13px; color: #4b5563; margin-top: 4px; }

.error-box {
    background: #fee2e2;
    border: 3px solid #000;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: #991b1b;
    margin-top: 16px;
    box-shadow: 2px 2px 0px #000;
}
.hidden { display: none !important; }

/* ================= GERBANG PIN ================= */
.pin-input {
    text-align: center;
    letter-spacing: 8px;
    font-size: 20px;
    font-weight: 900;
}

/* ================= FITUR MUSIK ================= */
/* Segmented button sumber: YouTube / Spotify */
.segmented {
    display: flex;
    gap: 0;
    margin-top: 16px;
    border: 3px solid #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 3px 3px 0px #000;
}
.seg-btn {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 800;
    font-family: inherit;
    border: none;
    background: #fff;
    color: #000;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.seg-btn + .seg-btn { border-left: 3px solid #000; }
.seg-btn.is-active { background: #000; color: #fff; }
.seg-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Grid hasil pencarian */
.results-meta {
    font-size: 13px;
    font-weight: 800;
    color: #000;
    margin-bottom: 12px;
    text-align: center;
}
.music-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 960px;
}
.song-card {
    background: #fff;
    border: 3px solid #000;
    border-radius: 14px;
    box-shadow: 5px 5px 0px var(--accent);
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
}
.song-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 3px solid #000;
    border-radius: 10px;
    background: #000;
}
.song-title { font-size: 14px; font-weight: 900; color: #000; margin-top: 10px; line-height: 1.3; }
.song-sub { font-size: 12px; color: #4b5563; margin-top: 4px; }
.song-card audio { width: 100%; margin-top: 10px; }
.song-actions { display: flex; gap: 8px; margin-top: 10px; }
.song-actions .btn { flex: 1; }

@media (max-width: 480px) {
    .page { padding: 24px 14px; }
    .card { padding: 18px; box-shadow: 6px 6px 0px var(--accent); }
    .card h1 { font-size: 22px; }
    .mode-tab { padding: 12px 10px; font-size: 14px; }
}
