/* =========================================================
   RESET
========================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: Arial, sans-serif;
}

/* =========================================================
   VIDEO WRAPPER
========================================================= */
.video-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #000;
}

.video-wrapper video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    z-index: 1;
}

/* =========================================================
   TOP HEADER
========================================================= */
.watch-top-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top));

    z-index: 70;

    background: linear-gradient(to bottom, rgba(0,0,0,.75), transparent);

    transition: opacity .25s ease, transform .25s ease;
}

.watch-top-left {
    display: flex;
    flex-direction: column;
    color: #fff;
    max-width: 70%;
}

.watch-title {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.watch-episode {
    font-size: 12px;
    opacity: .8;
}

.watch-back-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* =========================================================
   RIGHT ACTIONS
========================================================= */
.watch-right-actions {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);

    display: flex;
    flex-direction: column;
    gap: 18px;

    z-index: 70;

    transition: opacity .25s ease, transform .25s ease;
}

.watch-action-btn {
    border: none;
    background: transparent;
    color: #fff;

    display: flex;
    flex-direction: column;
    align-items: center;

    font-size: 11px;
    cursor: pointer;
}

.watch-action-btn i {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 18px;
    margin-bottom: 4px;
}

/* =========================================================
   SUBTITLE
========================================================= */
.subtitle {
    position: absolute;
    left: 50%;
    bottom: 25%;
    transform: translateX(-50%);

    z-index: 20;

    width: 90%;
    text-align: center;

    color: #fff;
    font-size: clamp(20px, 4vw, 26px);
    font-weight: 800;

    text-shadow: 0 3px 8px rgba(0,0,0,.95);

    pointer-events: none;
}

/* =========================================================
   OVERLAY (SHOW SYSTEM FIX)
========================================================= */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    opacity: 0;
    pointer-events: none;
    transition: .25s ease;
    z-index: 90;
}

.overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* =========================================================
   DRAWER (SHOW SYSTEM FIX)
========================================================= */
.drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;

    width: 100%;
    height: 80vh;

    background: #0f0f0f;
    color: #fff;

    border-top-left-radius: 18px;
    border-top-right-radius: 18px;

    transform: translateY(100%);
    transition: transform .3s ease;

    z-index: 100;

    overflow: hidden;
}

.drawer.show {
    transform: translateY(0);
}

/* handle */
.drawer::before {
    content: "";
    display: block;
    width: 45px;
    height: 5px;
    background: rgba(255,255,255,.25);
    border-radius: 10px;
    margin: 10px auto;
}

/* =========================================================
   DRAWER CONTENT
========================================================= */
.drawer-header {
    position: sticky;
    top: 0;

    background: #0f0f0f;

    z-index: 6;
    padding: 12px 14px;

    border-bottom: 1px solid rgba(255,255,255,.05);
}

/* =========================================================
   DRAWER CONTENT FIX SCROLL STABLE
========================================================= */
.drawer-content {
    padding: 0 14px 14px;
    height: calc(85vh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* penting biar tab tidak “ketarik” scroll bug */
    overscroll-behavior: contain;
}



/* =========================================================
   DRAMA HEADER
========================================================= */
.drama-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.drama-cover {
    width: 80px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
}

.drama-info h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
    color:  #ff8a00;
}

.drama-tags {
    font-size: 11px;
    opacity: .8;
    margin-bottom: 4px;
}

.drama-episodes {
    font-size: 12px;
    opacity: .9;
}

/* =========================================================
   TABS
========================================================= */
.drawer-tabs {
    display: flex;
    gap: 10px;

    margin: 12px 0;

    position: sticky;
    top: 0;

    z-index: 5;

    background: #0f0f0f;
    padding: 10px 0;
}

.tab-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: rgba(255,255,255,.08);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.tab-btn.active {
    background: #ff8a00;
    color: #000;
}

/* =========================================================
   EPISODE GRID (MOBILE RANGE FRIENDLY)
========================================================= */
.episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
}

/* episode item */
.ep-item {
    padding: 10px 0;
    font-size: 12px;
    text-align: center;

    background: rgba(255,255,255,.08);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;

    transition: .15s ease;
    user-select: none;
}

.ep-item:active {
    transform: scale(0.95);
}

.ep-item:hover {
    background: rgba(255,255,255,.15);
}

/* active episode */
/* =========================================================
   ACTIVE EPISODE (ORANGE STYLE)
========================================================= */
.ep-item.active-ep {
    background: #ff8a00;
    color: #111;
    font-weight: 700;

    border: 1px solid rgba(255,138,0,.6);

    box-shadow: 0 0 10px rgba(255,138,0,.4);
}



/* =========================================================
   BOOKMARK ACTIVE
========================================================= */

.watch-action-btn.active {
    color: #ff8a00;
}

.watch-action-btn.active i {
    background: #ff8a00;
    color: #111;
    box-shadow: 0 0 10px rgba(255,138,0,.4);
}

.watch-action-btn.active span {
    color: #ff8a00;
}



/* =========================================================
   MOBILE FIX: 5 ITEMS PER ROW
========================================================= */
@media (max-width: 768px) {

    .episode-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }

}


/* =========================================================
   RANGE NAV BUTTON (Prev / Next)
========================================================= */
.episode-nav {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    gap: 10px;
}

.range-btn {
    flex: 1;
    padding: 10px 12px;

    border: none;
    border-radius: 10px;

    background: rgba(255,255,255,.10);
    color: #fff;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;
    transition: .2s ease;
}

.range-btn:active {
    transform: scale(0.97);
}

.range-btn:disabled {
    opacity: .3;
    cursor: not-allowed;
}

/* =========================================================
   DESCRIPTION
========================================================= */
.drama-description {
    font-size: 13px;
    line-height: 1.5;
    opacity: .9;
}

/* =========================================================
   SHARE GRID (2 COLUMN LAYOUT)
========================================================= */
.share-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* =========================================================
   SHARE BUTTON CARD (MODERN)
========================================================= */
.share-btn {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 12px;
    border-radius: 12px;

    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);

    cursor: pointer;
    transition: .2s ease;

    user-select: none;
}

.share-btn:hover {
    background: rgba(255,255,255,.12);
    transform: translateY(-1px);
}

.share-btn:active {
    transform: scale(0.98);
}

/* =========================================================
   ICON STYLE (LEFT SIDE)
========================================================= */
.share-btn i {
    width: 42px;
    height: 42px;

    border-radius: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255,255,255,.10);

    font-size: 16px;
    flex-shrink: 0;
}

/* =========================================================
   TEXT AREA (RIGHT SIDE)
========================================================= */
.share-btn span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* judul */
.share-btn span::first-line {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

/* keterangan (optional via small text) */
.share-btn small {
    font-size: 11px;
    opacity: .7;
}

/* =========================================================
   UI HIDE
========================================================= */
.ui-hide {
    opacity: 0;
    pointer-events: none;
}

/* =========================================================
   VIDEO FOOTER
========================================================= */
.video-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 12px 14px;

    z-index: 70;

    background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
}



#toastContainer{
    position:fixed;
    top:20px;
    right:20px;
    display:flex;
    flex-direction:column;
    gap:10px;
    z-index:99999;
    pointer-events:none;
}

.toast{
    min-width:220px;
    max-width:320px;
    padding:12px 16px;
    border-radius:10px;
    background:#222;
    color:#fff;
    font-size:12px;
    line-height:1.4;
    opacity:0;
    transform:translateX(30px);
    transition:.25s;
}

.toast.show{
    opacity:1;
    transform:translateX(0);
}

.toast.success{background:#16a34a;}
.toast.error{background:#dc2626;}
.toast.warning{background:#f59e0b;color:#111;}
.toast.info{background:#2563eb;}


.range-item{
    flex:0 0 auto;
    min-width:72px;
    height:38px;
    padding:10 16px;
    border:1px solid #303030;
    border-radius:999px;
    background:#181818;
    color:#d0d0d0;
    font-size:13px;
    font-weight:600;
    cursor:pointer;
    transition:.2s;
    margin-bottom: 10px;
    margin-right: 8px;
}

.range-item:hover{
    border-color:#666;
    color:#fff;
}

.range-item.active{
    background:#fff;
    border-color:#fff;
    color:#111;
}


.watch-top-header,
.watch-right-actions {
    transition: opacity .3s ease, transform .3s ease;
}

.hide {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}



.video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-wrapper {
    touch-action: pan-y;
}

.overlay {
    pointer-events: none;
}

.video-wrapper {
    position: relative;
    overflow: hidden;
}

.video-cover {
    position: absolute;
    inset: 0;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: opacity .25s ease;
}

.video-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-cover.hide {
    opacity: 0;
    pointer-events: none;
}
