/* Movie detail drawer - slides in from right (desktop) or bottom (mobile) */

.drawer {
    position: fixed;
    color: #fff;
    z-index: 99;
    overflow-y: auto;
    transition: transform 0.3s ease;

    /* Solid fallback for browsers without backdrop-filter */
    background: rgba(32, 34, 52, 0.92);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.5);

    --content-top: 76px;  /* space reserved for search box on desktop */

    /* Desktop: slide from left, padding reserves space for search box above */
    box-sizing: border-box;
    top: 0;
    left: 0;
    width: 360px;
    height: 100%;
    padding-top: var(--content-top);
    transform: translateX(-100%);
}

/* Blur effect where supported - slightly more transparent to let blur show */
@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
    .drawer {
        background: rgba(32, 34, 52, 0.75);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

.drawer.open {
    transform: translateX(0);
}

/* Drag handle - mobile only, hidden on desktop */
.drawer-handle {
    display: none;
}

/* Mobile and narrow windows: slide from bottom */
@media (max-width: 800px) {
    .drawer {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: calc(100dvh - 76px);
        --content-top: 0px;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        will-change: transform;
        overflow-y: hidden;
        display: flex;
        flex-direction: column;
    }

    .drawer .drawer-content {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .drawer.open {
        transform: translateY(50%);
    }

    .drawer.expanded {
        transform: translateY(0);
    }

    .drawer-handle {
        display: flex;
        justify-content: center;
        padding: 10px 0 6px;
        cursor: grab;
        touch-action: none;
    }

    .drawer-handle::after {
        content: '';
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .drawer-nav-btn {
        width: 36px;
        height: 36px;
    }

    .drawer-nav-btn svg {
        width: 22px;
        height: 22px;
    }

    .drawer-close {
        width: 36px;
        height: 36px;
    }

    .drawer-close svg {
        width: 22px;
        height: 22px;
    }
}


/* Loading state */
.drawer-loading {
    padding: 40px 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.drawer-retry {
    cursor: pointer;
}

/* Navigation and close buttons - top-right row */
.drawer-controls {
    position: absolute;
    top: calc(var(--content-top) + 12px);
    right: 12px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.drawer-nav-btn {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.drawer-nav-btn.visible {
    display: flex;
}

.drawer-nav-btn:disabled {
    color: rgba(255, 255, 255, 0.15);
    cursor: default;
}

.drawer-nav-btn:not(:disabled):hover {
    color: rgba(255, 255, 255, 1);
}

.drawer-nav-btn svg {
    width: 18px;
    height: 18px;
}

.drawer-close {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.drawer-close svg {
    width: 18px;
    height: 18px;
}

.drawer-close:hover {
    color: rgba(255, 255, 255, 1);
}

/* Content area */
.drawer-content {
    padding: 20px;
}

/* Header with poster and title */
.drawer-header {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.drawer-poster {
    width: 100px;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.drawer-title-block {
    display: flex;
    flex-direction: column;
    padding-top: 36px;  /* start below nav/close buttons */
}

.drawer-title {
    margin: 0 0 4px 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
}

.drawer-meta {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.drawer-genre {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Score display */
.drawer-scores {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Remove gap when trailer follows (flush join) */
.drawer-scores:has(+ .drawer-trailer) {
    margin-bottom: 0;
}

/* When scores and trailer are adjacent, flatten touching edges */
.drawer-scores + .drawer-trailer {
    border-radius: 0 0 8px 8px;
}

.drawer-scores:has(+ .drawer-trailer) {
    border-radius: 8px 8px 0 0;
}

.score-item {
    flex: 1;
    text-align: center;
}

.score-value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.score-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Trailer embed */
.drawer-trailer {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;  /* 16:9 aspect ratio */
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.drawer-trailer iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.trailer-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.trailer-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: none;
}

.trailer-play::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 54%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #fff;
}

/* Content sections */
.drawer-section {
    margin-bottom: 16px;
}

.drawer-plot {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

.drawer-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.drawer-value {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

/* Where to Watch */
.drawer-watch {
    margin-bottom: 16px;
}

.watch-providers {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.watch-icon {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
    cursor: pointer;
}

.watch-icon:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.12);
}

.watch-more {
    margin-top: 4px;
}

.watch-loading {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
}

.watch-notice {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.2);
    font-style: italic;
}

