@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&display=swap');
:root {
    --primary-color: #007bff; --background-color: #f8f9fa; --text-color: #212529;
    --card-bg-color: #ffffff; --border-color: #dee2e6; --navbar-bg: rgba(255, 255, 255, 0.85);
    --footer-bg: #212529; --footer-text-color: #f8f9fa; --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --viewed-border-color: #dc3545; --player-bg: rgba(0,0,0,0.8);
}
[data-theme="dark"] {
    --primary-color: #0d6efd; --background-color: #121212; --text-color: #e0e0e0;
    --card-bg-color: #1e1e1e; --border-color: #343a40; --navbar-bg: rgba(25, 25, 25, 0.85);
    --footer-bg: #1e1e1e; --footer-text-color: #e0e0e0; --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --viewed-border-color: #ff4d4d; --player-bg: rgba(0,0,0,0.8);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Hind Siliguri', sans-serif; background-color: var(--background-color); color: var(--text-color); transition: background-color 0.3s, color 0.3s; line-height: 1.7; }
img { max-width: 100%; height: auto; display: block; }

/* Navbar */
.navbar { 
    background-color: var(--navbar-bg); backdrop-filter: blur(10px); 
    border-bottom: 1px solid var(--border-color); padding: 0.8rem 1.5rem; 
    position: sticky; top: 0; z-index: 1000;
    transition: top 0.3s ease-in-out;
}
.navbar.navbar--hidden {
    top: -80px;
}
.nav-container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap; }
.nav-logo { font-size: 1rem; font-weight: 700; color: var(--primary-color); text-decoration: none; flex-shrink: 0; margin-right: auto; }
.nav-menu { display: flex; align-items: center; gap: 0.5rem; }
.nav-btn { padding: 6px 12px; background-color: var(--primary-color); color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: background-color 0.3s; }

/* Search Box */
.search-container { position: relative; }
.search-icon { font-size: 1rem; cursor: pointer; }
.search-box { width: 0; padding: 8px 0; border: none; border-bottom: 2px solid var(--primary-color); background: transparent; color: var(--text-color); outline: none; opacity: 0; visibility: hidden; transition: all 0.4s ease; position: absolute; right: 25px; top: -10px; font-size: 1rem; }
.search-container.active .search-box { width: 200px; opacity: 1; visibility: visible; padding: 8px 10px; }

/* Theme Switcher */
.theme-switcher { display: flex; align-items: center; gap: 8px; }
.switch { position: relative; display: inline-block; width: 30px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 14px; width: 10px; left: 3px; bottom: 3px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* Main Content & Post Grid */
.main-content { max-width: 1200px; margin: 2.5rem auto; padding: 0 1rem; min-height: 60vh; }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.post-card { background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); transition: transform 0.3s ease, box-shadow 0.3s ease; cursor: pointer; }
.post-card.viewed { border: 2px solid var(--viewed-border-color); }
.post-card:hover { transform: translateY(-8px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12); }
.post-thumbnail-container { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.post-thumbnail { width: 100%; height: 100%; object-fit: cover; }
.view-count { position: absolute; top: 10px; right: 10px; background-color: rgba(0, 0, 0, 0.7); color: white; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; }
.post-content { padding: 1rem; }
.post-title { font-size: 1.2rem; font-weight: 600; line-height: 1.4; height: 48px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-overflow: ellipsis; }
.post-date { font-size: 0.9rem; color: #6c757d; margin-top: 0.5rem; }

/* Loader & Pagination */
.loader { border: 5px solid #f3f3f3; border-top: 5px solid var(--primary-color); border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin: 50px auto; display: none; }
.loader.active { display: block; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.pagination { display: flex; justify-content: center; margin-top: 2.5rem; }
#loadMoreBtn { font-size: 1rem; padding: 12px 25px; }

/* Floating Button & Watchlist */
.floating-btn { position: fixed; bottom: 20px; right: 20px; width: 60px; height: 60px; background-color: var(--primary-color); color: white; border: none; border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.2); font-size: 1.5rem; display: flex; justify-content: center; align-items: center; cursor: pointer; z-index: 999; transition: transform 0.3s ease; }
.floating-btn:hover { transform: scale(1.1); }
.watchlist-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); backdrop-filter: blur(5px); display: none; justify-content: center; align-items: center; z-index: 1001; padding: 1rem; }
.watchlist-content { background-color: var(--card-bg-color); padding: 1.5rem; border-radius: 12px; width: 100%; max-width: 900px; height: 80%; display: flex; flex-direction: column; }
.watchlist-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; margin-bottom: 1rem; }
.watchlist-header h2 { margin: 0; font-size: 1.5rem; }
.close-watchlist-btn { background: none; border: none; font-size: 2rem; cursor: pointer; color: var(--text-color); }
#watchlistGrid { overflow-y: auto; flex-grow: 1; }

/* Custom Video Player */
.video-container { position: relative; width: 100%; aspect-ratio: 16 / 9; background-color: #000; border-radius: 12px; overflow: hidden; }
.video-container video { width: 100%; height: 100%; border-radius: 12px; }
.video-container .controls { position: absolute; bottom: 0; left: 0; right: 0; color: #FFF; z-index: 2; opacity: 0; transition: opacity .2s ease-in-out; background: var(--player-bg); padding: 5px 10px 10px; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.video-container:hover .controls, .video-container.paused .controls { opacity: 1; }
.controls-top { position: absolute; top: 0; left: 0; right: 0; padding: 15px; background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent); z-index: 1; opacity: 0; transition: opacity .2s ease-in-out; }
.video-container:hover .controls-top { opacity: 1; }
.site-name-overlay { font-size: 1.2rem; color: white; font-weight: bold; text-shadow: 1px 1px 2px black; }
.progress-bar-container { width: 100%; height: 8px; background-color: rgba(255, 255, 255, 0.3); cursor: pointer; border-radius: 4px; margin-bottom: 5px; }
.progress-bar { height: 100%; width: 0%; background-color: var(--primary-color); border-radius: 4px; }
.controls-main { display: flex; align-items: center; justify-content: space-between; }
.controls-left, .controls-right { display: flex; align-items: center; gap: 15px; }
.controls button { background: none; border: none; color: white; cursor: pointer; font-size: 1.2rem; padding: 5px; }
.volume-container { display: flex; align-items: center; }
.volume-slider { width: 80px; cursor: pointer; -webkit-appearance: none; background: rgba(255,255,255,0.3); height: 5px; border-radius: 5px; outline: none; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px; background: white; border-radius: 50%; cursor: pointer; }
.time-display { font-size: 0.9rem; }
.video-thumbnail-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; display: flex; justify-content: center; align-items: center; cursor: pointer; z-index: 3; }
.play-icon-big { font-size: 5rem; color: rgba(255, 255, 255, 0.9); transition: transform 0.3s; text-shadow: 0 0 15px rgba(0,0,0,0.5); }
video::-webkit-media-controls-download-button { display: none; }
video::-webkit-media-controls-enclosure { overflow: hidden; }
video::-webkit-media-controls-panel { width: calc(100% + 30px); }

/* Details Page Info */
.details-title { font-size: 2.2rem; font-weight: 700; margin-top: 1.5rem; line-height: 1.3; }
.details-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; color: #6c757d; font-size: 0.9rem; margin: 0.5rem 0 1.5rem; }
.share-btn { padding: 8px 16px; background-color: var(--primary-color); color: white; border: none; border-radius: 5px; cursor: pointer; font-weight: 500; }
.share-btn i { margin-right: 8px; }
.related-posts-section h2 { font-size: 1.8rem; margin-bottom: 1.5rem; border-bottom: 3px solid var(--primary-color); padding-bottom: 0.5rem; display: inline-block; }

/* Footer */
.footer { background-color: var(--footer-bg); color: var(--footer-text-color); padding: 3rem 1rem; margin-top: 3rem; }
.footer-container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2rem; }
.footer-about, .footer-social { flex: 1; min-width: 250px; }
.footer-about h3, .footer-social h3 { margin-bottom: 1rem; color: white; }
.footer-social a { color: var(--footer-text-color); font-size: 1.5rem; margin-right: 15px; transition: color 0.3s; }
.footer-social a:hover { color: var(--primary-color); }
.footer-bottom { text-align: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #444; }

/* Responsive Design */
@media (max-width: 768px) {
    .search-container.active .search-box { width: 150px; }
    .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .details-title { font-size: 1.8rem; }
}
@media (max-width: 480px) {
    .posts-grid { grid-template-columns: 1fr; }
    .details-title { font-size: 1.5rem; }
}