body { 
    font-family: Arial, sans-serif; 
    background:#f3f3f3; 
    margin:0; padding:0; 
  }
body.dark .card { background:#222; }
body.dark { 
    background:#111; 
    color:#fff; 
  }
body:not(.dark) .card {
  background: #ffffff;
  color: #000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
body:not(.dark) .title-box {
  color: #000 !important;
}
body:not(.dark) .category-box {
  color: #555;
}
body:not(.dark) header {
  background: #e9e9e9;
  color: #000;
  border-bottom: 1px solid #ddd;
}
body:not(.dark) header button {
  background: #eee;
  color: #000;
  border: 1px solid #ccc;
}
body:not(.dark) .cat-btn {
  background: #e9e9e9;
  color: #000;
  border: 1px solid #ccc;
}
body:not(.dark) .cat-btn:hover {
  background: #d9d9d9;
}
body:not(.dark) .cat-btn.active {
  background: #0099cc;
  color: #fff;
  border-color: #0099cc;
}
body:not(.dark) .popup {
  background: #fff;
  color: #000;
  border: 1px solid #ccc;
}
body:not(.dark) .popup input {
  background: #f8f8f8;
  color: #000;
}

/* HEADER */
.sss-header {
  display: flex;
  align-items: center;
  gap: 12px;          /* jarak antara logo dan text */
}
.sss-logoo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: purple;        /* BACKGROUND UNGU */
  padding: 4px;              /* supaya ungunya kelihatan */
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0px 20px;
  background: #1c1c20;
  border-bottom: 1px solid #222;
  color: white;
}
.mode-wrapper {
  position:relative;
  display:flex;
  gap:10px;    
}

header button {
  padding:10px 16px;
  background:#333;
  color:white;
  border:none;
  border-radius:10px;
  cursor:pointer;
}
.rainbow span {
  display: inline-block;
  animation: rainbow 3s infinite linear;
}
footer.rainbow span {
  display: inline-block;
  animation: rainbow 3s infinite linear;
}
@keyframes rainbow {
  0%   { color: red; }
  25%  { color: yellow; }
  50%  { color: lime; }
  75%  { color: cyan; }
  100% { color: red; }
}
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #111; 
  color: white;
  text-align: center;
  padding: 10px 0;
  z-index: 99999;
  border-top: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 -2px 6px rgba(0,0,0,0.4);
}
.footer-sss {
  display: flex;
  align-items: center;
  justify-content: center;  
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  color: white;
  font-size: 16px;
}
.sss-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}
.footer-text {
  margin-left: 4px;
}

.user-info {
  margin-bottom: 10px;
  font-size: 14px;
  opacity: 0.8;
}

.popup {
  position:absolute;
  top:50px;     
  right:0;
  background:#222;
  padding:15px;
  width:260px;
  border-radius:10px;
  display:none;
  flex-direction:column;
  gap:10px;
  box-shadow:0 4px 12px rgba(0,0,0,0.45);
  z-index:999;
}

.popup.show {
  display:flex;
}
.popup #form {
  width:93%;
}

.popup #form input {
  width:100%;
  padding:10px;
  border-radius:8px;
  border:none;
  outline:none;
  font-size:14px;
}

.popup button {
  background:#444;
  padding:10px;
  width:100%;
  border-radius:8px;
  font-weight:bold;
}

.container { 
    max-width:100%;
    padding:10px 20px;
    margin:auto; 
  }
h2 { 
 text-align:center;
 color:#fff;   
}
#form button { 
    padding:12px 20px; 
    border:none; border-radius:8px; 
    cursor:pointer; 
    font-weight:bold; 
  }
.toggle-mode {
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    background:#333; 
    color:#fff; 
  }

  /* Card */
.card {
  position: relative;
  background: #1a1a2e;
  border-radius: 16px;
  padding:2px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
  transition: transform 0.2s ease;
  width: 220px;
}
#list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  justify-items: center;
  margin-top: 20px;
}

.thumb-box {
  width: 100%;
  height: 180px;
  overflow: hidden;
  cursor: pointer;  
  border-radius:10px;  
}
.thumb-box img { 
    width:100%; 
    height:100%;
    object-fit:cover; 
  }
.category-box {
  gap:10px;  
  color: #ccc;
  font-size: 14px;
  margin-bottom: 10px;
}

.actions {
  position:absolute;
  top:12px;
  left:12px;
  z-index:20; 
  padding:6px 10px;
  border-radius:10px;
  display:flex;
  gap:8px;  
}
.actions {
  opacity:0;
  transition:0.25s;
}
.card:hover .actions {
  opacity:1;
}
.actions span { 
    color:#fff; 
    padding:6px 12px; 
    border-radius:6px; 
    font-size:16px; 
    cursor:pointer; 
  }

.actions span.mini {
  background: none;
  color: red;
  font-size:22px;  
}

.title-box {
  margin-bottom: 8px;  
  color: #fff !important;
  margin-top: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: bold;
  line-height: 1.3;
  max-height: 45px;     
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2; 
  -webkit-box-orient: vertical;
}

#filterCategory {
  margin: 16px auto;
  display: block;
  padding: 5px 10px;
  font-size: 14px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #222;
  color: #fff;
}

/* POPUP PLAYER */
.popup-player {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 20px);
  bottom: 20px;  
  background: rgba(0,0,0,0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2999;
}

.popup-content {
  background: #111;
  padding: 20px;
  border-radius: 10px;
  width: 95%;
  height: 90%;
  max-width: none;         
  max-height: none;      
  position: relative;
  display: flex;
  flex-direction: column;
}
#popupToMiniBtn,
#popupTheaterBtn,
#popupNormalBtn {
  font-size: 28px; 
  font-weight: bold; 
  line-height: 1;  
  color: white;
}

#popupClose {
  position: absolute;
  top: -10px;
  right: -10px;
  background: none;
  color: white;
  border: none;
  font-size: 35px;
  font-weight: bold;
  line-height: 1;  
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
}

.popup-top-buttons {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 10px;
  z-index: 30;
}
.popup-top-buttons button {
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  padding: 8px 12px;
  font-size: 20px;
  border-radius: 8px;
  cursor: pointer;
}

#popupPlayerContainer iframe {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}
.popup-layout {
  display: flex;
  flex: 1;
  gap: 20px;
}
#popupPlayerContainer {
  flex: 3;
}
#popupSidebar {
  flex: 1;
  overflow-y: auto;
}

.reco-card {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  background: #222;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}

.reco-card img {
  width: 120px;
  height: 70px;
  border-radius: 6px;
  object-fit: cover;
}

.reco-title {
  font-size: 14px;
  color: #fff;
}

  /* Mini Player Floating */
#miniBox { 
  width:360px; 
  height:250px; 
  position:fixed; 
  top: 50%;
  left: 50%;
  background:#000; 
  border-radius:10px; 
  overflow:hidden; 
  display:none; 
  z-index:9999; 
  cursor: grab;
}
#miniBox.dragging {
  cursor: grabbing;
}

#miniBox iframe {
  pointer-events: none !important;
}

  #miniClose { 
    position:absolute; 
    top:4px; 
    right:4px; 
    background:none; 
    border:none; 
    color:white;
    cursor:pointer; 
    font-size:22px; 
    z-index:20; 
  }
#miniToPopup {
  position: absolute;
  top: 4px;
  right: 32px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 20px;
  z-index: 20;
}

.popup-content.theater .popup-layout {
  flex-direction: column;
}
.popup-content.theater #popupPlayerContainer {
  flex: none;
  height: 80%;
}
.popup-content.theater #popupSidebar {
  flex: none;
  height: 20%;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
}

.popup-content.theater .reco-card {
  min-width: 180px;
  display: inline-flex;
}

/* NAVBAR CATEGORY */
.category-nav {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 30px 0 20px 0;
}
.cat-btn {
  padding: 8px 16px;
  background: #222;
  color: white;
  border: 1px solid #444;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.2s;
  font-size: 14px;
}
.cat-btn:hover {
  background: #333;
}
.cat-btn.active {
  background: #0099cc;
  border-color: #0099cc;
  color: #fff;
  font-weight: bold;
}

.history-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f3f3f3;
  display: none;
  justify-content: center;
  align-items: flex-start;
  z-index: 9999;
}
.history-content {
  background: #111;
  width: 100%;
  height: 100%;
  max-width: none; 
  max-height: none;
  border-radius: 0;
  padding: 20px 0;
  overflow-y: auto;
  position: relative;
  color: #000;
  box-sizing: border-box;
}
  /* Card */
#historyList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  justify-items: center;
  margin-top: 20px;
}
.history-row {
  background:#1a1a2e;
  border-radius:12px;
  padding: 2px 10px;                /* padding hilangkan agar gambar full width */
  display:flex;
  flex-direction:column;      /* ⬅ gambar atas, teks bawah */
  cursor:pointer;
  transition:0.2s;
  width: 100%;
  color:white;
  overflow: hidden;           /* biar sudut radius rapi */
}
.history-row:hover {
  background:#333;
}

.history-thumb {
  width: 100%;
  height: 180px;
  overflow: hidden;
  cursor: pointer;
  border-radius:10px;  
}
.history-thumb img {
  width:100%; 
  height:100%; 
  object-fit:cover;
}

/* Bagian teks di bawah */
.history-info {
  padding:12px 14px;
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
}
.history-title {
  margin:0 0 8px 0;
  color:#fff !important;
  font-size:14px;
  font-weight:bold;
  line-height:1.3;
  max-height:45px;
  overflow:hidden;
  text-overflow:ellipsis;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}
.history-time {
  font-size:12px;
  color:#ccc;
}

.closeHistory {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  background: none;
  color:white;  
}
/* ============================
   RESPONSIVE MODE (MOBILE)
   ============================ */
@media (max-width: 600px) {
  #list {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
  .card {
    width: 150px;
    padding: 10px;
  }
  .thumb-box {
    height: 110px;
  }
  .title-box {
    font-size: 12px;
    max-height: 38px;
    padding: 8px;
  }
  .popup-content {
    width: 100%;
    height: 100%;
    border-radius: 0;
    padding: 10px;
  }
  .popup-layout {
    flex-direction: column;
    gap: 10px;
  }
  #popupPlayerContainer {
    flex: none;
    height: 55vh; 
  }
  #popupSidebar {
    height: 40vh;
    overflow-y: auto;
  }
  .reco-card {
    gap: 8px;
    padding: 6px;
  }
  .reco-card img {
    width: 100px;
    height: 60px;
  }
  .popup-top-buttons {
    top: 6px;
    left: 6px;
    gap: 6px;
  }
  .popup-top-buttons button {
    font-size: 16px;
    padding: 6px 10px;
  }
  #miniBox {
    width: 200px;
    height: 120px;
    bottom: 10px;
    right: 10px;
  }
  #miniClose, #miniToPopup {
    font-size: 18px;
  }
}
