/* Mobile Responsive Navigation */
.mobile-header {
    display: none;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.hamburger-btn:hover {
    color: var(--primary);
}

.search-icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s;
}

.search-icon-btn:hover {
    color: var(--primary);
}

/* Full Screen Search Modal */
.search-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    z-index: 9999;
    padding: 2rem;
    overflow-y: auto;
}

.search-modal.active {
    display: block;
}

.search-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-modal-input {
    flex: 1;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.search-modal-input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s;
}

.search-modal-close:hover {
    color: var(--text-primary);
}

.search-results-live {
    margin-top: 2rem;
}

.search-results-live h3 {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

/* Mobile Sidebar - Hidden on desktop */
.mobile-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    z-index: 1001;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.mobile-sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.sidebar-close:hover {
    color: var(--primary);
}

.sidebar-content {
    padding: 1rem;
}

/* Sidebar Profile Section */
.sidebar-profile {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.sidebar-profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-profile-info {
    flex: 1;
    min-width: 0;
}

.sidebar-profile-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-settings-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.sidebar-settings-btn:hover {
    color: var(--primary);
}

/* Profile Dropdown for Mobile */
.user-profile {
    position: relative;
}

.user-avatar {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.3s ease;
}

.user-avatar:hover {
    color: var(--primary);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.dropdown-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.dropdown-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.dropdown-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.dropdown-item i {
    font-size: 1.1rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: var(--primary);
    color: white;
}

.sidebar-item i {
    margin-right: 1rem;
    font-size: 1.1rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {

    /* Enable sidebar and overlay on mobile */
    .mobile-sidebar,
    .sidebar-overlay {
        display: block;
    }

    .navbar {
        padding: 0.6rem 0.8rem;
    }

    .nav-container {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 0.5rem;
        width: 100%;
    }

    /* Hide desktop elements */
    .nav-search,
    .nav-links {
        display: none !important;
    }

    /* Hamburger button - leftmost, outside nav-links */
    .hamburger-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        padding: 0.4rem;
        font-size: 1.4rem;
        width: 40px;
        height: 40px;
        order: 1;
    }

    /* Logo - center */
    .logo {
        order: 2;
        font-size: 1.3rem;
        flex: 1;
        text-align: center !important;
        min-width: 0;
        white-space: nowrap;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Mobile header - rightmost items */
    .mobile-header {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        gap: 0.4rem;
        order: 3;
        flex-shrink: 0;
    }

    .search-icon-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0.4rem;
        font-size: 1.3rem;
        width: 40px;
        height: 40px;
    }

    #authBtnMobile {
        display: block !important;
        padding: 0.4rem 0.9rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    #authBtnMobile.hidden {
        display: none !important;
    }

    #userSectionMobile {
        display: none !important;
        align-items: center;
        position: relative;
    }

    #userSectionMobile.show {
        display: flex !important;
    }

    .user-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: linear-gradient(135deg, #e50914 0%, #b20710 100%) !important;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        font-weight: bold;
        color: white !important;
        border: none;
        cursor: pointer;
        transition: transform 0.2s ease;
    }

    .user-avatar:hover {
        transform: scale(1.1);
    }

    .user-avatar img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        object-fit: cover;
    }

    /* Content grid - default 2 column grid for mobile */
    .content-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding-bottom: 1rem;
    }

    /* Index page specific - horizontal scroll */
    body.index-page .content-grid {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 1rem;
        padding-bottom: 1rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    body.index-page .content-grid::-webkit-scrollbar {
        display: none;
    }

    body.index-page .content-card {
        flex: 0 0 140px;
        scroll-snap-align: start;
    }

    .content-card {
        width: 100%;
    }

    .content-card img {
        height: 200px;
        width: 100%;
        object-fit: cover;
    }

    /* Search Page - 2 column grid */
    body:not(.index-page) .content-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }

    /* Details Page Responsive */
    .details-hero {
        height: 50vh;
        min-height: 300px;
    }

    .details-container {
        padding: 1rem;
    }

    .details-main {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    .details-poster {
        max-width: 200px;
        margin: 0 auto;
    }

    .details-info h1 {
        font-size: 1.8rem;
    }

    .details-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .details-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .details-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .seasons-list {
        grid-template-columns: 1fr;
    }

    .episode-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .episode-thumbnail {
        width: 100%;
        height: 180px;
    }

    .cast-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .cast-member img {
        height: 120px;
    }

    .cast-name {
        font-size: 0.85rem;
    }

    .cast-character {
        font-size: 0.75rem;
    }

    /* Season Episodes List - Horizontal Scroll */
    .episodes-list {
        display: flex;
        gap: 1rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 1rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: var(--primary) transparent;
    }

    .episodes-list::-webkit-scrollbar {
        height: 6px;
    }

    .episodes-list::-webkit-scrollbar-track {
        background: transparent;
    }

    .episodes-list::-webkit-scrollbar-thumb {
        background: var(--primary);
        border-radius: 3px;
    }

    .episode-card {
        flex: 0 0 300px;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 8px;
        overflow: hidden;
        transition: all 0.3s ease;
        cursor: pointer;
        scroll-snap-align: start;
    }

    .episode-card:hover {
        background: rgba(255, 255, 255, 0.08);
        transform: translateY(-5px);
    }

    .episode-thumbnail {
        flex-shrink: 0;
        width: 100%;
        height: 170px;
        border-radius: 0;
        overflow: hidden;
    }

    .episode-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .episode-info {
        flex: 1;
        padding: 1rem;
        min-width: 0;
    }

    .episode-title {
        font-weight: 600;
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .episode-overview {
        font-size: 0.85rem;
        color: var(--text-secondary);
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .episode-meta {
        font-size: 0.8rem;
        color: var(--text-secondary);
        margin-top: 0.5rem;
        display: flex;
        gap: 1rem;
    }

    /* Mobile Episode Cards */
    @media (max-width: 768px) {
        .episode-card {
            flex: 0 0 250px;
        }

        .episode-thumbnail {
            height: 140px;
        }

        .episode-overview {
            -webkit-line-clamp: 2;
            line-clamp: 2;
        }
    }

    .details-main {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .details-poster {
        max-width: 300px;
        margin: 0 auto;
    }

    .hero {
        height: 50vh;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }













}

/* Top 10 Section Mobile - FINAL FIX */
@media (max-width: 768px) {
    .top10-container {
        padding: 0 !important;
        position: relative !important;
    }

    .top10-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 1.5rem !important;
        padding: 1rem 3rem !important;
        scrollbar-width: none !important;
        align-items: flex-start !important;
    }

    .top10-grid::-webkit-scrollbar {
        display: none !important;
    }

    .top10-card {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
        flex: 0 0 auto !important;
        width: 240px !important;
        min-width: 240px !important;
        gap: 0 !important;
        position: relative !important;
        height: auto !important;
    }

    .top10-rank {
        font-size: 11rem !important;
        line-height: 0.75 !important;
        font-weight: 900 !important;
        color: #555 !important;
        -webkit-text-stroke: 4px #777 !important;
        /* Thicker stroke for visibility */
        opacity: 0.8 !important;
        width: 110px !important;
        height: 180px !important;
        flex-shrink: 0 !important;
        text-align: right !important;
        margin-right: -25px !important;
        /* Move right (more overlap) */
        bottom: 30px !important;
        /* Move up */
        z-index: 1 !important;
        position: relative !important;
        display: flex !important;
        align-items: flex-end !important;
        justify-content: flex-end !important;
    }

    /* Poster Wrapper Div */
    .top10-card>div:last-child {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        z-index: 2 !important;
        flex: 1 !important;
    }

    .top10-poster {
        width: 120px !important;
        height: 180px !important;
        flex-shrink: 0 !important;
        position: relative !important;
    }

    .top10-poster img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 6px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
        display: block !important;
    }

    .top10-info {
        width: 100% !important;
        margin-top: 0.75rem !important;
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.25rem !important;
    }

    .top10-title {
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 130px !important;
        color: #fff !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
    }

    .top10-rating {
        font-size: 0.85rem !important;
        color: #46d369 !important;
        /* Match success color */
        font-weight: 600 !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    /* Arrows */
    .top10-container .nav-btn-prev,
    .top10-container .nav-btn-next {
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 40px !important;
        height: 40px !important;
        background: rgba(0, 0, 0, 0.7) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        z-index: 100 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }

    .top10-container .nav-btn-prev {
        left: 0 !important;
    }

    .top10-container .nav-btn-next {
        right: 0 !important;
    }
}

/* Content Robot Mobile Responsive */
@media (max-width: 768px) {

    /* Modal Container Override */
    /* Modal Container Override - STRONG FIX */
    div.robot-modal-container {
        min-width: 0 !important;
        width: 90% !important;
        max-width: 95% !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    #robotStep1 {
        padding: 1.5rem !important;
    }

    /* Filter Grid */
    #robotFilters>div {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }

    /* AI Card Mobile Layout */
    .ai-card {
        flex-direction: column !important;
        min-height: auto !important;
        height: auto !important;
    }

    .ai-card-content {
        flex-direction: column !important;
        padding: 1.5rem !important;
        gap: 1.5rem !important;
        align-items: center !important;
        text-align: center !important;
    }

    .ai-card-poster {
        width: 150px !important;
        max-width: 60% !important;
        flex: 0 0 auto !important;
    }

    .ai-card-info {
        width: 100% !important;
        text-align: center !important;
    }

    .ai-card-meta {
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    .ai-card-title {
        font-size: 1.5rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }

    .ai-card-overview {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
        -webkit-line-clamp: 4 !important;
        line-clamp: 4 !important;
    }

    .ai-card-actions {
        flex-direction: column !important;
        gap: 0.8rem !important;
    }

    .ai-btn-primary,
    .ai-btn-secondary {
        width: 100% !important;
        padding: 0.8rem !important;
        font-size: 1rem !important;
    }

    /* Navigation Arrows Position */
    .ai-nav-prev {
        left: 10px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
        top: 250px !important;
        /* Position near poster */
    }

    .ai-nav-next {
        right: 10px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
        top: 200px !important;
    }

    .nav-btn {
        display: none !important;
    }
}


/* Extra fix for Robot Modal spacing */
@media (max-width: 768px) {
    .robot-modal-container {
        margin-bottom: 50px !important;
    }
}



/* Robot Promo Card Mobile */
@media (max-width: 768px) {
    .robot-promo-card {
        padding: 1.5rem !important;
        margin-top: 1.5rem !important;
        margin-bottom: 1.5rem !important;
        text-align: center !important;
    }

    .robot-promo-content {
        flex-direction: column-reverse !important;
        gap: 1rem !important;
    }

    .robot-promo-text h2 {
        font-size: 1.8rem !important;
    }

    .robot-promo-text p {
        font-size: 1rem !important;
        margin: 0 auto !important;
    }

    .robot-promo-icon {
        font-size: 5rem !important;
        margin-bottom: 1rem !important;
    }

    .robot-promo-text button {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Nuclear option: Force all children to respect width */
    .robot-modal-container * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}



/* Specific Override for Inline Robot Banner */
@media (max-width: 991px) {
    .robot-banner {
        padding: 1.5rem !important;
    }

    .robot-content-wrapper {
        flex-direction: column-reverse !important;
        gap: 1.5rem !important;
        text-align: center !important;
        justify-content: center !important;
        display: flex !important;
    }

    .robot-content-wrapper>div:first-child {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .robot-content-wrapper h2 {
        font-size: 1.8rem !important;
        text-align: center !important;
        width: 100% !important;
    }

    .robot-content-wrapper p {
        font-size: 1rem !important;
        margin: 0 auto !important;
        text-align: center !important;
        max-width: 100% !important;
    }

    .robot-content-wrapper button {
        width: 100% !important;
        margin-top: 1rem !important;
        display: flex !important;
        justify-content: center !important;
    }

    /* Target the icon div specifically */
    .robot-content-wrapper>div:nth-child(2) {
        font-size: 5rem !important;
        margin-bottom: 0 !important;
        width: 100% !important;
        text-align: center !important;
        display: block !important;
    }
}

@media (max-width: 768px) {
    .site-logo {
        max-height: 40px !important;
    }
}