/* ============================================
   MicroTV - Complete Stylesheet
   With Search Box & Telegram Button
   Fixed Tag Wrapping | SEO Friendly | Responsive
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    line-height: 1.6;
}

/* ========== HEADER ========== */
header {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid #e50914;
    margin-bottom: 30px;
}

.logo {
    font-size: 32px;
    font-weight: bold;
}

.logo a {
    color: white;
    text-decoration: none;
}

.logo span {
    color: #e50914;
}

.logo small {
    font-size: 14px;
    color: #666;
    display: block;
    margin-top: 5px;
}

header h1 {
    font-size: 20px;
    margin-top: 10px;
    color: #ddd;
    font-weight: normal;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== ACTION BAR (সার্চ + টেলিগ্রাম) ========== */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

.search-form input {
    flex: 1;
    padding: 12px 18px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 40px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.search-form input:focus {
    border-color: #e50914;
}

.search-form button {
    padding: 12px 24px;
    background: #e50914;
    color: white;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.search-form button:hover {
    background: #b8070f;
}

.clear-btn {
    padding: 12px 20px;
    background: #333;
    color: white;
    text-decoration: none;
    border-radius: 40px;
    transition: background 0.3s;
}

.clear-btn:hover {
    background: #555;
}

.telegram-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #0088cc;
    color: white;
    text-decoration: none;
    border-radius: 40px;
    font-weight: bold;
    white-space: nowrap;
    transition: all 0.3s;
}

.telegram-btn:hover {
    background: #006699;
    transform: translateY(-2px);
}

.search-info {
    background: #1a1a1a;
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    color: #ddd;
    text-align: center;
}

/* ========== POST GRID ========== */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.post-card {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(229, 9, 20, 0.3);
}

.post-card a {
    text-decoration: none;
    color: white;
    display: block;
}

.post-card img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.post-card h3 {
    font-size: 16px;
    padding: 12px 12px 8px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-card .views {
    font-size: 12px;
    color: #888;
    padding: 0 12px 12px;
    display: block;
}

/* ========== PAGINATION ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.pagination a {
    padding: 10px 16px;
    background: #1a1a1a;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 14px;
}

.pagination a:hover {
    background: #e50914;
}

.pagination a.active {
    background: #e50914;
}

.pagination span.dots {
    padding: 10px 5px;
    color: #888;
}

/* ========== SINGLE POST PAGE ========== */
.post-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.post-container h1 {
    font-size: 28px;
    margin-bottom: 20px;
    text-align: center;
    word-break: break-word;
    line-height: 1.3;
}

.featured-poster {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 16px;
    margin: 20px auto;
    display: block;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.embed-player {
    margin: 30px 0;
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
}

.embed-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.download-btn {
    display: inline-block;
    background: #2ecc71;
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    text-decoration: none;
    margin: 20px 0;
    font-weight: bold;
    transition: background 0.3s;
    text-align: center;
}

.download-btn:hover {
    background: #27ae60;
}

/* ========== TAGS SECTION - FIXED WRAPPING ========== */
.tags-container {
    background: #1a1a1a;
    padding: 18px 20px;
    border-radius: 12px;
    margin: 25px 0;
    border-left: 4px solid #e50914;
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.tags-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e50914;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 0.3px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    justify-content: flex-start;
    align-items: center;
}

.tag {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
    background: #2a2a2a;
    color: #ddd;
    cursor: pointer;
}

.global-tag {
    background: #e50914;
    color: white;
}

.global-tag:hover {
    background: #ff1a2a;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(229, 9, 20, 0.4);
}

.post-tag {
    background: rgba(229, 9, 20, 0.12);
    color: #ff6b6b;
    border: 1px solid rgba(229, 9, 20, 0.3);
}

.post-tag:hover {
    background: #e50914;
    color: white;
    border-color: #e50914;
    transform: translateY(-2px);
}

/* ========== META INFO ========== */
.meta {
    color: #888;
    font-size: 14px;
    text-align: center;
    padding: 20px;
    border-top: 1px solid #333;
    margin-top: 30px;
}

/* ========== ADS BANNER ========== */
.ad-banner {
    text-align: center;
    margin: 20px auto;
    padding: 10px;
    background: #1a1a1a;
    border-radius: 8px;
}

/* ========== NO POSTS ========== */
.no-posts {
    text-align: center;
    padding: 60px 20px;
    background: #1a1a1a;
    border-radius: 12px;
}

.no-posts h2 {
    margin-bottom: 10px;
    color: #ddd;
}

.back-home {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 24px;
    background: #e50914;
    color: white;
    text-decoration: none;
    border-radius: 40px;
}

/* ========== FOOTER ========== */
footer {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 12px;
    border-top: 1px solid #222;
    margin-top: 50px;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Tablet */
@media (max-width: 768px) {
    .post-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }
    
    .post-card h3 {
        font-size: 13px;
    }
    
    .pagination a {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .post-container h1 {
        font-size: 22px;
    }
    
    /* Action Bar Mobile */
    .action-bar {
        flex-direction: column;
    }
    
    .search-form {
        max-width: 100%;
        width: 100%;
    }
    
    .telegram-btn {
        width: 100%;
        justify-content: center;
    }
    
    .search-form input {
        padding: 10px 15px;
    }
    
    .search-form button, .clear-btn {
        padding: 10px 18px;
    }
    
    /* Tags Mobile Fix */
    .tags-container {
        padding: 14px 15px;
    }
    
    .tag {
        padding: 5px 12px;
        font-size: 10px;
    }
    
    .tags-list {
        gap: 6px 10px;
    }
    
    .tags-label {
        font-size: 12px;
        margin-bottom: 12px;
    }
}

/* Mobile Small */
@media (max-width: 480px) {
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .container {
        padding: 0 12px;
    }
    
    .logo {
        font-size: 24px;
    }
    
    .logo small {
        font-size: 10px;
    }
    
    header h1 {
        font-size: 16px;
    }
    
    /* Tags Small Mobile */
    .tags-container {
        padding: 12px;
    }
    
    .tag {
        padding: 4px 10px;
        font-size: 9px;
    }
    
    .tags-list {
        gap: 5px 8px;
    }
    
    .tags-label {
        font-size: 11px;
        margin-bottom: 10px;
    }
    
    .post-container h1 {
        font-size: 18px;
    }
    
    .download-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .search-form input {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .search-form button, .clear-btn, .telegram-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* Medium Screens */
@media (min-width: 769px) and (max-width: 1024px) {
    .post-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .tag {
        padding: 5px 12px;
        font-size: 11px;
    }
}

/* Large Desktop */
@media (min-width: 1025px) {
    .tag:hover {
        transform: translateY(-2px);
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.tag:active {
    animation: pulse 0.2s ease;
}

/* ========== SCROLLBAR CUSTOMIZATION ========== */
.tags-container::-webkit-scrollbar {
    height: 4px;
}

.tags-container::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 10px;
}

.tags-container::-webkit-scrollbar-thumb {
    background: #e50914;
    border-radius: 10px;
}

/* ========== UTILITY CLASSES ========== */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.clearfix::after {
    content: "";
    clear: both;
    display: table;
}

/* ========== LOADING STATE ========== */
img.loading {
    opacity: 0.5;
    filter: blur(5px);
}

/* ========== SEO OPTIMIZATION ========== */
.tag {
    cursor: pointer;
}

.tag:focus {
    outline: 2px solid #e50914;
    outline-offset: 2px;
}