/* ===================================
   Netflix-Style Video Explorer
   =================================== */

/* Explore Header */
/* Explore toolbar sits under/shared within light navbar */
.explore-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--primary-100);
    backdrop-filter: saturate(180%) blur(8px);
}

/* Inline toolbar inside shared navbar */
.jh-navbar .explore-toolbar {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
    margin: 0;
    /* align with container padding for perfect symmetry */
    flex-wrap: nowrap;
    min-width: 0;
}

.jh-navbar .explore-toolbar .explore-search {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.jh-navbar .explore-toolbar .explore-create {
    white-space: nowrap;
    height: 44px;
    display: inline-flex;
    align-items: center;
}

.explore-nav-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 10px 0;
}

.explore-brand {
    color: var(--primary-800);
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.explore-brand .logo-mask {
    width: 2em;
    height: 2em;
    color: var(--primary-500);
    margin-right: 10px;
}

.explore-search {
    flex: 1;
    max-width: 760px;
    position: relative;
}

.explore-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.explore-search input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border-radius: 10px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-900);
    height: 44px;
    min-width: 0;
}

.explore-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.explore-create {
    white-space: nowrap;
}

.explore-navbar.is-condensed .explore-nav-inner {
    padding: 6px 0;
}

/* Old Search Section (kept for safety but unused) */
.search-bar-section {
    display: none;
}

.search-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-box {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    z-index: 1;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 2px solid #333;
    border-radius: 8px;
    font-size: 15px;
    background: #0d0d0d;
    color: #fff;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: #e50914;
    outline: none;
    background: #000;
}

.search-box input::placeholder {
    color: #666;
}

.btn-text {
    display: inline;
}

/* Rails Container */
.rails-container {
    background: var(--gray-50);
    min-height: 60vh;
    padding-bottom: 4rem;
}

/* Hero Section */
.hero-section {
    position: relative;
    height: 66vh;
    min-height: 450px;
    max-height: 800px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to top, #141414, transparent);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    color: #fff;
}

.hero-category {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--primary-700);
    border-radius: 6px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.1;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    color: var(--gray-100);
}

.hero-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 16px;
    color: var(--gray-200);
}

.hero-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hero-description {
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

/* Rail Sections */
.rail {
    margin-bottom: 3rem;
    position: relative;
}

.rail-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    padding: 0 4%;
}

.rail-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    flex: 1;
}

.rail-view-all {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.rail-view-all:hover {
    color: var(--primary-700);
    transform: translateX(2px);
}

.rail-view-all i {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.rail-view-all:hover i {
    transform: translateX(2px);
}

.rail-viewport {
    position: relative;
    overflow: hidden;
    padding: 0 4%;
}

.rail-scroll {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
}

.rail-scroll-left {
    left: 8px;
}

.rail-scroll-right {
    right: 8px;
}

.rail-scroll:hover:not(:disabled) {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.rail-scroll:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
}

.rail-scroll:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.rail-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.rail-track::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* Rail Cards */
.rail-card {
    flex: 0 0 300px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.rail-card:hover {
    transform: scale(1.08);
    z-index: 5;
}

.rail-card-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 */
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.rail-card-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.rail-card:hover .rail-card-thumb img {
    transform: scale(1.1);
}

.rail-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0.2) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    color: #fff;
}

.rail-card:hover .rail-card-overlay {
    opacity: 1;
}

.overlay-content {
    width: 100%;
}

.overlay-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
    line-height: 1.3;
}

.overlay-category {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--primary-600);
    margin-bottom: 6px;
    font-weight: 600;
}

.overlay-meta {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 10px;
}

.overlay-play {
    background: var(--primary-600);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.overlay-play:hover {
    background: var(--primary-700);
    transform: scale(1.03);
}

.card-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.rail-card-info {
    padding: 0.75rem 0.5rem;
}

.card-title {
    color: var(--gray-900);
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 4px;
}

.card-channel {
    color: var(--gray-500);
    font-size: 12px;
}

/* Search Results (Grid View) */
.search-results {
    background: var(--gray-50);
    padding: 2rem 0 4rem;
    min-height: 60vh;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.search-header h2 {
    color: var(--gray-900);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.btn-clear {
    background: #fff;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.btn-clear:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.video-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
}

.video-card .thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    background: #000;
}

.video-card .thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .thumb img {
    transform: scale(1.05);
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.video-card .info {
    padding: 1rem;
}

.video-card .title {
    font-weight: 600;
    color: #e5e5e5;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    font-size: 15px;
}

.video-card .meta {
    color: #999;
    font-size: 13px;
}

.empty {
    padding: 4rem 0;
    text-align: center;
    color: #999;
}

.empty i {
    font-size: 3rem;
    color: #444;
    margin-bottom: 1rem;
}

.empty p {
    font-size: 16px;
    margin: 0;
}

.pager {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin-top: 3rem;
}

.pager .btn {
    padding: 12px 24px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #1f1f1f;
    color: #e5e5e5;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pager .btn:hover:not(:disabled) {
    background: #2a2a2a;
    border-color: #666;
}

.pager .btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pager span {
    color: #999;
    font-size: 14px;
}

/* Loading & Error States */
.loading-state,
.error-state {
    text-align: center;
    padding: 6rem 2rem;
    color: #999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.05);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-state i {
    font-size: 3rem;
    color: #e50914;
    margin-bottom: 1rem;
}

.error-state p {
    font-size: 16px;
    margin-bottom: 1.5rem;
}

.no-content {
    text-align: center;
    padding: 6rem 2rem;
    color: #999;
}

.no-content p {
    font-size: 18px;
}

/* Skeleton Loading */
.skeleton-grid {
    height: 200px;
    border: 2px dashed #333;
    border-radius: 8px;
    background: repeating-linear-gradient(90deg,
            #1f1f1f 0,
            #1f1f1f 8px,
            #141414 8px,
            #141414 16px);
}

/* Floating Action Button */
.fab-cta {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;
    background: var(--primary-600);
    color: #fff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px var(--primary-600);
    transition: all 0.3s ease;
}

.fab-cta:hover {
    background: var(--primary-700);
    transform: scale(1.1);
}

/* Ensure FAB plus icon remains white */
.fab-cta i {
    color: #fff;
    font-size: 20px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .rail-card {
        flex: 0 0 260px;
    }

    .hero-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .explore-create {
        display: none;
    }

    /* Ensure navbar CTA is hidden on mobile; FAB handles creation */
    .jh-navbar .explore-create {
        display: none !important;
    }

    /* Hide avatar dropdown at mobile for explore header */
    .explore-navbar .jh-user-menu {
        display: none;
    }

    /* Place hamburger at extreme right; add padding so search doesn't sit under it */
    .explore-page .jh-navbar .jh-container {
        padding-right: 56px;
    }

    .explore-page .jh-mobile-menu-toggle {
        display: flex;
        position: absolute;
        right: var(--spacing-sm);
        top: 50%;
        transform: translateY(-50%);
        margin-left: 0;
    }

    .search-controls {
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-box {
        max-width: 100%;
    }

    .btn-text {
        display: none;
    }

    .hero-section {
        height: 50vh;
        min-height: 350px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 14px;
    }

    .btn-hero-primary {
        padding: 12px 24px;
        font-size: 16px;
    }

    .rail-title {
        font-size: 1.4rem;
    }

    .rail-card {
        flex: 0 0 220px;
    }

    .rail-viewport {
        padding: 0 3%;
    }

    .rail-header {
        padding: 0 3%;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .rail-view-all {
        font-size: 0.875rem;
        padding: 0.375rem 0.5rem;
        min-height: 44px; /* Better touch target */
        display: flex;
        align-items: center;
    }

    .rail-scroll {
        width: 44px;
        height: 44px;
    }

    .rail-scroll-left {
        left: 4px;
    }

    .rail-scroll-right {
        right: 4px;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }

    /* Show FAB on mobile */
    .fab-cta {
        display: flex;
    }
}

/* Mobile drawer header (logo + close) */
.jh-mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
}

.jh-mobile-menu-close {
    background: none;
    border: none;
    color: var(--gray-100);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Reduce top padding for explore drawer to match base_public when header is present */
.explore-navbar~.jh-mobile-user-menu {
    padding-top: 20px;
}

/* Use compact header spacing for logged-in Explore drawer (match logged-out feel) */
.explore-page .jh-mobile-user-menu {
    padding-top: var(--spacing-sm);
}

.explore-page .jh-mobile-menu-header {
    padding: var(--spacing-sm) 0;
}

@media (max-width: 520px) {
    .hero-section {
        height: 40vh;
        min-height: 300px;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-meta {
        font-size: 13px;
        gap: 1rem;
    }

    .rail-title {
        font-size: 1.2rem;
    }

    .rail-header {
        padding: 0 2%;
        gap: 0.5rem;
    }

    .rail-view-all {
        font-size: 0.8125rem;
        padding: 0.375rem;
        gap: 0.375rem;
    }

    .rail-view-all i {
        font-size: 0.75rem;
    }

    .rail-card {
        flex: 0 0 180px;
    }

    .rail-viewport {
        padding: 0 2%;
    }

    .rail-scroll {
        width: 40px;
        height: 40px;
    }

    .rail-scroll-left {
        left: 2px;
    }

    .rail-scroll-right {
        right: 2px;
    }

    .fab-cta {
        width: 56px;
        height: 56px;
        right: 16px;
        bottom: 16px;
    }

    .hero-description {
        display: none;
    }
}