/* Responsive Design */

/* Extra small screens (XS) - 1 colonne */
@media (max-width: 575px) {
    .music-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem 0;
    }
    
    .music-card {
        max-width: 100%;
        margin: 0;
    }
    
    .music-image {
        height: 180px;
    }
    
    .music-info {
        padding: 1.2rem;
    }
    
    .music-info h3 {
        font-size: 1.2rem;
        margin-bottom: 0.8rem;
    }
    
    .music-info p {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }
}

/* Small screens (SM) - 2 colonnes */
@media (min-width: 576px) and (max-width: 767px) {
    .music-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
        padding: 1.5rem 0;
    }
    
    .music-card {
        max-width: 100%;
    }
    
    .music-image {
        height: 160px;
    }
    
    .music-info {
        padding: 1rem;
    }
    
    .music-info h3 {
        font-size: 1.1rem;
        margin-bottom: 0.6rem;
    }
    
    .music-info p {
        font-size: 0.95rem;
        margin-bottom: 0.6rem;
    }
}

/* Medium screens (MD) - 3 colonnes */
@media (min-width: 768px) and (max-width: 991px) {
    .music-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        padding: 2rem 0;
    }
    
    .music-image {
        height: 170px;
    }
    
    .music-info h3 {
        font-size: 1.1rem;
    }
}

/* Large screens (LG) - 4 colonnes */
@media (min-width: 992px) and (max-width: 1199px) {
    .music-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

/* Extra large screens (XL) - 5 colonnes */
@media (min-width: 1200px) {
    .music-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 2rem;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .nav-list {
        width: 90%;
        margin: 0 auto;
    }
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    

    .nav-menu {
        position: fixed;
        top: 0;
        right: -300px;
        width: 280px;
        height: 100vh;
        background: #ffffff;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        padding: 80px 20px 20px;
        transition: right 0.3s ease;
        z-index: 1000;
        display: flex;
        overflow-y: auto;
    }

    .nav-menu.active {
        right: 0;
    z-index: 2002; /* ensure menu overlays page content */
    }

    .nav-list {
        flex-direction: column;
        width: 100%;
    }

    /* Ensure nav links are dark on mobile for readability */
    .nav-menu .nav-link {
        color: #333 !important;
    }

    .nav-item {
        width: 100%;
        margin: 5px 0;
    }

    .mobile-menu-toggle {
        display: flex;
        position: relative;
    z-index: 2003; /* keep toggle above other header elements */
        background: none;
        border: none;
        padding: 15px;
        cursor: pointer;
        flex-direction: column;
        justify-content: space-between;
        width: 40px;
        height: 30px;
        margin-left: 15px;
    }
    
    .mobile-menu-toggle span {
        display: block;
        width: 25px;
        height: 3px;
        background: var(--primary-color);
        margin: 3px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-buttons .btn {
        width: 200px;
        text-align: center;
    }

    /* Règles music-grid supprimées car gérées par les nouveaux breakpoints */

    .discovery-grid {
        grid-template-columns: 1fr;
    }

    .recommendations-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .search-input {
        min-width: auto;
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
}

/* High-priority override: ensure nav-menu opens when .active is toggled even
   if other rules try to keep it off-screen. Keeps specificity and uses !important
   to override conflicting rules on pages with complex styles (e.g. artistes). */
header .nav-menu.active,
.header .nav-menu.active {
    right: 0 !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
}

/* Mobile */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    /* Amélioration des cartes de musique sur mobile */
    .music-card {
        max-width: 100%;
        margin: 0;
        border-radius: var(--border-radius-medium);
        box-shadow: var(--shadow-medium);
    }
    
    .play-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .discovery-card {
        max-width: 350px;
        margin: 0 auto;
    }

    .recommendation-item {
        flex-direction: column;
        text-align: center;
    }

    .recommendation-item img {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    .hero-section {
        padding: 2rem 0;
    }

    .page-header {
        padding: 2rem 0;
    }

    .featured-section,
    .discovery-section,
    .recommendations-section,
    .contact-section {
        padding: 2rem 0;
    }
    
    /* Amélioration de l'espacement sur mobile */
    .container {
        padding: 0 15px;
    }
    
    .music-grid {
        margin: 0 -5px;
    }
    
    .music-card {
        margin: 0 5px;
    }
}

/* Fix: Ensure the mobile menu toggle and menu are clickable on pages
   that use large hero images or overlays (e.g. artiste.php). */
@media (max-width: 992px) {
    .header, .header * {
        pointer-events: auto !important;
    }
    .mobile-menu-toggle {
        z-index: 99999 !important; /* keep toggle above everything */
        pointer-events: auto !important;
    }
    .nav-menu {
        z-index: 99998 !important; /* ensure menu overlays page content */
        pointer-events: auto !important;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

    .hero-title {
        font-size: 3.5rem;
    }

    /* Règles music-grid supprimées car gérées par les nouveaux breakpoints */

    .discovery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Landscape orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 2rem;
    }

    .page-header {
        padding: 1.5rem 0;
    }
}
