/* Fallback CSS for older browsers - Add this to the top of style.css */

/* Specific fixes for OPPO browser */
.oppo-browser .videos-grid {
    display: -webkit-flex !important;
    display: flex !important;
    -webkit-flex-wrap: wrap !important;
    flex-wrap: wrap !important;
    -webkit-justify-content: space-between !important;
    justify-content: space-between !important;
}

.oppo-browser .grid-video-item {
    width: calc(50% - 4px) !important;
    height: 280px !important;
    margin-bottom: 8px !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
}

@media (min-width: 480px) {
    .oppo-browser .grid-video-item {
        width: calc(33.333% - 6px) !important;
    }
}

@media (min-width: 768px) {
    .oppo-browser .grid-video-item {
        width: calc(25% - 6px) !important;
    }
}

/* Fallback for clamp() function */
@supports not (width: clamp(1px, 1vw, 1px)) {
    .like-btn,
    .nav-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    .like-controls {
        gap: 8px;
        padding: 12px 8px;
    }
    
    .navigation-controls {
        gap: 12px;
        padding: 16px 8px;
    }
    
    .like-count {
        font-size: 10px;
        min-width: 26px;
        min-height: 18px;
    }
}

/* Fallback for backdrop-filter */
@supports not (backdrop-filter: blur(10px)) {
    .bottom-nav-bar {
        background: rgba(0, 0, 0, 0.95) !important;
    }
    
    .like-controls {
        background: rgba(0, 0, 0, 0.8) !important;
    }
    
    .like-btn,
    .nav-btn {
        background: rgba(255, 255, 255, 0.2) !important;
    }
    
    .toast {
        background: rgba(0, 0, 0, 0.95) !important;
    }
    
    .home-header {
        background: rgba(0, 0, 0, 0.95) !important;
    }
}

/* Additional fallback for no backdrop-filter support */
.no-backdrop-filter .bottom-nav-bar,
.no-backdrop-filter .like-controls,
.no-backdrop-filter .home-header,
.no-backdrop-filter .toast {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.no-backdrop-filter .bottom-nav-bar {
    background: rgba(0, 0, 0, 0.95) !important;
}

.no-backdrop-filter .like-controls {
    background: rgba(0, 0, 0, 0.8) !important;
}

.no-backdrop-filter .home-header {
    background: rgba(0, 0, 0, 0.95) !important;
}

/* Fallback for aspect-ratio */
@supports not (aspect-ratio: 9/16) {
    .tiktok-video-container {
        aspect-ratio: auto !important;
    }
    
    .grid-video-item {
        height: 280px; /* Fixed height fallback for 9:16 aspect ratio */
    }
    
    .trending-video-item {
        height: 180px; /* Fixed height fallback */
    }
}

/* Fallback for display: grid with place-items */
@supports not (place-items: center) {
    .like-btn,
    .nav-btn {
        display: -webkit-flex !important;
        display: flex !important;
        -webkit-align-items: center !important;
        align-items: center !important;
        -webkit-justify-content: center !important;
        justify-content: center !important;
    }
}

/* Fallback for env() safe area */
@supports not (padding-bottom: env(safe-area-inset-bottom)) {
    #progress-wrap {
        bottom: 70px; /* Fixed value instead of calc(var(--nav-h) + var(--safe)) */
    }
}

/* Fallback for CSS Grid */
@supports not (display: grid) {
    .videos-grid {
        display: -webkit-flex !important;
        display: flex !important;
        -webkit-flex-wrap: wrap !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .grid-video-item {
        width: calc(50% - 4px) !important;
        -webkit-flex: 0 0 auto !important;
        flex: 0 0 auto !important;
    }
    
    @media (min-width: 480px) {
        .grid-video-item {
            width: calc(33.333% - 6px) !important;
        }
    }
    
    @media (min-width: 768px) {
        .grid-video-item {
            width: calc(25% - 6px) !important;
        }
    }
}

/* Fallback for grid support detection */
.no-grid-support .videos-grid {
    display: -webkit-flex !important;
    display: flex !important;
    -webkit-flex-wrap: wrap !important;
    flex-wrap: wrap !important;
    -webkit-justify-content: space-between !important;
    justify-content: space-between !important;
}

.no-grid-support .grid-video-item {
    width: calc(50% - 4px) !important;
    margin-bottom: 8px !important;
}

@media (min-width: 480px) {
    .no-grid-support .grid-video-item {
        width: calc(33.333% - 6px) !important;
    }
}

@media (min-width: 768px) {
    .no-grid-support .grid-video-item {
        width: calc(25% - 6px) !important;
    }
}

/* Fix for old Android WebView issues */
.videos-grid {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.grid-video-item {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* Simple loading animation for older browsers */
@supports not (animation: spin 1s linear infinite) {
    .loading-spinner {
        border: 3px solid rgba(255, 255, 255, 0.3) !important;
        border-top: 3px solid #fff !important;
        border-radius: 50% !important;
        width: 40px !important;
        height: 40px !important;
    }
}

/* Force hardware acceleration */
.videos-grid,
.grid-video-item,
.bottom-nav-bar,
.home-header {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}