/* -------------------------------
   Responsive design
--------------------------------- */
/* Default: desktop layout (show nav horizontally) */
@media (min-width: 900px) {
    /* Ensure nav is visible on larger screens */
    #main-nav {
        display: block;
    }
    
    #main-nav .menu {
        flex-direction: row;
        gap: 18px;
        background: transparent;
        padding: 0;
    }
    
    /* Keep search input compact on desktop */
    .header-search input[type="search"],
    .header-search input[type="text"] {
        min-width: 200px;
    }
}

/* Mobile / tablet: collapse nav (hide until toggled) */
@media (max-width: 899px) {
    /* Prevent horizontal scroll on mobile */
    body, html {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Container adjustments for mobile */
    .container {
        padding: 0 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    /* Content wrapper */
    .content-wrapper {
        flex-direction: column;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* Content area */
    .content-area {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* Hide nav by default on small screens */
    #main-nav {
        display: none;
        width: 100%;
    }
    
    /* When JS toggles .active the nav will show */
    #main-nav.active {
        display: block;
        margin-top: 10px;
    }
    
    /* Menu becomes vertical stack */
    #main-nav .menu {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        background-color: #111;
        border-radius: 6px;
    }
    
    /* Header inner spacing on small screens */
    .header-inner {
        gap: 12px;
    }
    
    /* Make search smaller on mobile */
    .header-search input[type="search"],
    .header-search input[type="text"] {
        min-width: 120px;
    }
    
    /* Stack home layout vertically */
    .home-layout {
        flex-direction: column;
    }
    
    .featured-post,
    .latest-news {
        flex: 1;
    }
    
    /* YouTube videos layout on mobile */
    .youtube-videos ul {
        flex-direction: row;
    }
    
    .youtube-videos ul li {
        flex: 0 0 100%;
    }
    
    /* News section on mobile */
    .news-list {
        margin-top: 40px;
        padding: 20px;
        background-color: #111;
        border-radius: 10px;
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
    }
    
    .content-area, 
    #sidebar {
        flex: 1 1 100%;
    }
    
    #sidebar {
        max-width: none;
        margin-top: 20px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .youtube-videos ul li {
        flex: 0 0 100%;
    }
    
    .youtube-section {
        margin-top: 2rem;
        margin-bottom: 2rem;
    }
    
    .youtube-section h3 {
        font-size: 1.3rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .youtube-grid {
        grid-template-columns: 1fr;
    }
    
    .home-layout {
        gap: 16px;
    }
}

/* YouTube responsive */
@media (max-width: 1400px) {
    .youtube-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.25rem; /* ← Reduzido de 0.5rem */
    }
}

@media (max-width: 1024px) {
    .youtube-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.25rem; /* ← Reduzido de 0.5rem */
    }
}

@media (max-width: 768px) {
    .youtube-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.25rem; /* ← Reduzido de 0.5rem */
    }
    
    /* Hide 5th video on mobile - show only 4 videos */
    .youtube-grid .youtube-card:nth-child(n+5) {
        display: none !important;
    }
    
    .home-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .featured-post,
    .latest-news-column {
        width: 100%;
    }
    
    .featured-post .post-item {
        padding: 24px;
    }
    
    .youtube-card {
        transform: scale(1);
    }
    
    .youtube-card:hover {
        transform: scale(1.02);
    }
    
    .youtube-section h3 {
        font-size: 1.5rem;
    }
    
    .youtube-section h3 svg {
        width: 24px;
        height: 24px;
    }
}