/* ============================================
   STREAMIFY - BROWSE PAGES STYLES
   Movies, Series, My List Pages
   FULLY OPTIMIZED FOR MOBILE
   ADDED: Country selection modal (full-screen overlay)
============================================ */

/* ============ BROWSE HEADER ============ */
.browse-header {
    padding: 120px 60px 40px;
    background: linear-gradient(180deg, rgba(20,20,20,1) 0%, rgba(20,20,20,0.8) 100%);
}

.browse-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.browse-header h1 {
    font-size: 42px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 15px;
}

.browse-header h1 i {
    color: #e50914;
}

.mylist-subtitle {
    font-size: 16px;
    color: #808080;
    margin-top: 10px;
}

/* ============ FILTER CONTROLS ============ */
.filter-controls {
    display: flex;
    gap: 15px;
}

.filter-dropdown {
    position: relative;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: #141414;
    border: 1px solid #808080;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.filter-btn:hover {
    background: #333;
    border-color: #fff;
}

.filter-btn i {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.filter-dropdown.active .filter-btn i {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: rgba(30, 30, 30, 0.98);
    border: 1px solid #404040;
    border-radius: 5px;
    padding: 10px 0;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #b3b3b3;
    font-size: 14px;
    transition: all 0.2s ease;
    min-height: 44px;
}

.dropdown-menu a:hover {
    background: #333;
    color: #fff;
}

.dropdown-menu a.active {
    color: #fff;
    background: #e50914;
}

/* ============ BROWSE CONTENT ============ */
.browse-content {
    padding: 20px 60px 60px;
    min-height: 50vh;
}

/* ============ CONTENT GRID ============ */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* Grid Card - Entire card clickable */
.grid-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.grid-card:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.grid-card:active {
    transform: scale(0.98);
}

.grid-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    background: #232323;
    display: block;
    pointer-events: none;
}

.grid-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 40%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

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

.grid-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grid-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.grid-card-rating {
    color: #46d369;
    font-weight: 600;
}

.grid-card-year {
    color: #aaa;
}

.grid-card-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    pointer-events: auto;
}

.grid-card-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(30, 30, 30, 0.8);
    color: #fff;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.grid-card-btn:hover {
    border-color: #fff;
    background: rgba(50, 50, 50, 0.9);
    transform: scale(1.1);
}

.grid-card-btn.play-btn {
    background: #fff;
    color: #000;
    border: none;
}

.grid-card-btn.play-btn:hover {
    background: #e5e5e5;
}

/* Remove Button */
.grid-card-btn.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    z-index: 5;
    pointer-events: auto;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.3);
}

.grid-card:hover .grid-card-btn.remove-btn {
    opacity: 1;
}

.grid-card-btn.remove-btn:hover {
    background: #e50914;
    border-color: #e50914;
}

/* ============ MODAL OVERLAY ============ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
    display: flex !important;
}

.detail-modal {
    background: #181818;
    border-radius: 10px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active .detail-modal {
    transform: scale(1);
    opacity: 1;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    background: rgba(20, 20, 20, 0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e50914;
    transform: rotate(90deg);
}

.modal-banner {
    position: relative;
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center top;
    background-color: #232323;
    background-repeat: no-repeat;
}

.modal-banner-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, #181818 0%, rgba(24,24,24,0.7) 30%, transparent 60%);
}

.modal-banner-content {
    position: absolute;
    bottom: 30px;
    left: 30px;
    right: 30px;
}

.modal-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.8);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.modal-buttons .btn-play {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    background: #fff;
    color: #000;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

.modal-buttons .btn-play:hover {
    background: #e5e5e5;
}

.btn-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    background: rgba(40,40,40,0.8);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-circle:hover {
    border-color: #fff;
    transform: scale(1.1);
}

.modal-body {
    padding: 25px 30px 35px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 18px;
    font-size: 15px;
}

.match-score {
    color: #46d369;
    font-weight: 600;
}

.hd-badge {
    padding: 2px 8px;
    border: 1px solid #808080;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.modal-description {
    font-size: 15px;
    color: #d2d2d2;
    line-height: 1.6;
}

.modal-info-right {
    font-size: 14px;
}

.modal-info-right p {
    margin-bottom: 12px;
    color: #808080;
}

.info-label {
    color: #808080;
}

.modal-info-right span:not(.info-label) {
    color: #fff;
}

/* ============ LOAD MORE ============ */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 50px;
}

.load-more-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 40px;
    background: transparent;
    border: 1px solid #808080;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 50px;
}

.load-more-btn:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.load-more-btn i {
    transition: transform 0.3s ease;
}

.load-more-btn:hover i {
    transform: translateY(3px);
}

.load-more-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.load-more-btn.loading i {
    animation: spin 1s linear infinite;
}

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

/* ============ EMPTY STATE ============ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    min-height: 40vh;
}

.empty-icon {
    font-size: 80px;
    color: #404040;
    margin-bottom: 30px;
}

.empty-state h2 {
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 16px;
    color: #808080;
    margin-bottom: 30px;
    max-width: 400px;
}

.btn-browse {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: #e50914;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    border-radius: 5px;
    transition: background 0.2s ease;
    min-height: 50px;
}

.btn-browse:hover {
    background: #f40612;
}

/* ============ FOOTER ============ */
.footer-container {
    max-width: 1000px;
    margin: 0 auto;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 30px;
}

.social-icons a {
    color: #808080;
    font-size: 22px;
    transition: color 0.2s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-icons a:hover {
    color: #fff;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px 40px;
    margin-bottom: 30px;
}

.footer-links a {
    color: #808080;
    font-size: 13px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #b3b3b3;
}

.copyright {
    color: #404040;
    font-size: 12px;
}

/* ============ SEARCH BOX FOR BROWSE PAGES ============ */
.search-box {
    display: flex;
    align-items: center;
    position: relative;
}

.search-box input {
    width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    transition: all 0.3s ease;
    opacity: 0;
}

.search-box.active input {
    width: 200px;
    padding: 10px 15px;
    background: #141414;
    border: 1px solid #333;
    border-radius: 4px;
    opacity: 1;
    margin-right: 10px;
}

.search-box.active input:focus {
    border-color: #fff;
    outline: none;
}

.search-toggle {
    color: #fff;
    font-size: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-toggle:hover {
    color: #e50914;
}

/* Profile Dropdown for Browse Pages */
.profile-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.profile-dropdown .profile-img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
}

.profile-dropdown i {
    color: #fff;
    font-size: 12px;
    transition: transform 0.2s;
}

.profile-dropdown:hover i {
    transform: rotate(180deg);
}

/* ============ RESPONSIVE - TABLET ============ */
@media (max-width: 992px) {
    .browse-header {
        padding: 100px 40px 30px;
    }
    
    .browse-header h1 {
        font-size: 32px;
    }
    
    .browse-content {
        padding: 20px 40px 50px;
    }
    
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .modal-banner {
        height: 300px;
    }
    
    .modal-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ============ RESPONSIVE - MOBILE ============ */
@media (max-width: 768px) {
    .browse-header {
        padding: 75px 15px 20px;
    }
    
    .browse-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .browse-header h1 {
        font-size: 24px;
    }
    
    .filter-controls {
        width: 100%;
    }
    
    .filter-btn {
        flex: 1;
        justify-content: center;
        padding: 12px 15px;
    }
    
    .dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 60vh;
        border-radius: 15px 15px 0 0;
        transform: translateY(100%);
    }
    
    .filter-dropdown.active .dropdown-menu {
        transform: translateY(0);
    }
    
    .browse-content {
        padding: 15px;
    }
    
    /* MOBILE: 3 columns grid */
    .content-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    /* MOBILE: Always show overlay */
    .grid-card-overlay {
        opacity: 1;
        background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, transparent 50%);
        padding: 8px;
    }
    
    .grid-card-title {
        font-size: 10px;
        -webkit-line-clamp: 1;
        margin-bottom: 2px;
    }
    
    .grid-card-meta {
        font-size: 9px;
        gap: 4px;
    }
    
    /* MOBILE: Hide buttons - card is clickable */
    .grid-card-buttons {
        display: none;
    }
    
    /* MOBILE: Remove button always visible */
    .grid-card-btn.remove-btn {
        opacity: 1;
        width: 26px;
        height: 26px;
        font-size: 10px;
        top: 5px;
        right: 5px;
    }
    
    /* MOBILE: Modal full screen from bottom */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    
    .detail-modal {
        max-height: 95vh;
        border-radius: 15px 15px 0 0;
        margin-top: auto;
    }
    
    .modal-banner {
        height: 200px;
    }
    
    .modal-banner-content {
        bottom: 15px;
        left: 15px;
        right: 15px;
    }
    
    .modal-title {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .modal-buttons .btn-play {
        padding: 10px 20px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .btn-circle {
        width: 40px;
        height: 40px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-meta {
        font-size: 12px;
        gap: 10px;
    }
    
    .modal-description {
        font-size: 13px;
    }
    
    .empty-icon {
        font-size: 60px;
    }
    
    .empty-state h2 {
        font-size: 22px;
    }
    
    .empty-state p {
        font-size: 14px;
    }
    
    .footer-links {
        gap: 15px 25px;
    }
    
    .footer-links a {
        font-size: 12px;
    }
    
    .load-more-btn {
        padding: 12px 30px;
        font-size: 14px;
    }
    
    /* Mobile Search */
    .search-box {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: #141414;
        padding: 15px;
        z-index: 1000;
        display: none;
    }
    
    .search-box.active {
        display: flex;
    }
    
    .search-box.active input {
        width: 100%;
        flex: 1;
    }
    
    .profile-dropdown {
        display: none;
    }
}

/* ============ RESPONSIVE - SMALL MOBILE ============ */
@media (max-width: 480px) {
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .grid-card-title {
        font-size: 9px;
    }
    
    .grid-card-meta {
        font-size: 8px;
    }
    
    .grid-card-overlay {
        padding: 6px;
    }
    
    .browse-header h1 {
        font-size: 22px;
    }
    
    .filter-btn {
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-buttons .btn-play {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .btn-circle {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .grid-card-btn.remove-btn {
        width: 24px;
        height: 24px;
        font-size: 9px;
        top: 4px;
        right: 4px;
    }
}

/* ============ RESPONSIVE - VERY SMALL ============ */
@media (max-width: 350px) {
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }
    
    .browse-header h1 {
        font-size: 20px;
    }
    
    .browse-header h1 i {
        font-size: 18px;
    }
}

/* ============ COUNTRY SELECTION MODAL (FULL-SCREEN OVERLAY) ============ */
.country-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.country-modal-container {
    background: #141414;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.country-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #333;
    background: #0a0a0a;
}

.country-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #e50914;
    margin: 0;
}

.country-modal-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.country-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.country-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

.country-loading, .country-error {
    text-align: center;
    padding: 40px;
    color: #b3b3b3;
    font-size: 16px;
}

.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.country-select-btn {
    background: #2a2a2a;
    border: 1px solid #404040;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.country-select-btn:hover {
    background: #e50914;
    border-color: #e50914;
    transform: translateY(-2px);
}

/* Responsive adjustments for country modal */
@media (max-width: 768px) {
    .country-modal-container {
        max-height: 95vh;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .country-modal-header {
        padding: 15px;
    }
    
    .country-modal-title {
        font-size: 20px;
    }
    
    .country-modal-close {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .country-modal-content {
        padding: 15px;
    }
    
    .country-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .country-select-btn {
        padding: 10px 12px;
        font-size: 13px;
        white-space: normal;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .country-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .country-select-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
}