/* Styles adaptatifs pour optimiser l'affichage sur différentes tailles d'écran */

/* Styles pour éviter les défilements inutiles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Améliore le défilement sur iOS */
}

.space-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

.space-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.space-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Ajustements pour les écrans de grande taille (>1200px) */
@media (min-width: 1201px) {
    .space-container {
        padding: 1.5rem 2rem;
    }
    
    .theme-container {
        justify-content: center;
        margin-bottom: 1.5rem;
    }
    
    .subtheme-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .document-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Ajustements pour les écrans moyens (992px-1200px) */
@media (min-width: 992px) and (max-width: 1200px) {
    .space-container {
        padding: 1.25rem 1.5rem;
    }
    
    .theme-container {
        justify-content: center;
        gap: 1rem;
    }
    
    .theme-card {
        width: 120px;
        padding: 0.75rem;
    }
    
    .subtheme-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .document-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Ajustements pour les tablettes (768px-991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .space-container {
        padding: 1rem;
    }
    
    .space-header h1 {
        font-size: 1.8rem;
    }
    
    .theme-container {
        justify-content: center;
        gap: 0.75rem;
    }
    
    .theme-card {
        width: 110px;
        padding: 0.6rem;
    }
    
    .theme-icon {
        width: 42px;
        height: 42px;
        margin-bottom: 0.4rem;
    }
    
    .subtheme-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .document-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ajustements pour les appareils mobiles (<768px) */
@media (max-width: 767px) {
    .space-container {
        padding: 0.75rem;
    }
    
    .space-header {
        margin-bottom: 1rem;
    }
    
    .space-header h1 {
        font-size: 1.5rem;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .space-header p {
        font-size: 0.9rem;
        margin-top: 0;
        margin-bottom: 0.5rem;
    }
    
    .theme-container {
        justify-content: flex-start;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
        flex-wrap: nowrap;
    }
    
    .theme-card {
        width: 100px;
        padding: 0.5rem;
        flex: 0 0 auto;
    }
    
    .theme-icon {
        width: 36px;
        height: 36px;
        margin-bottom: 0.25rem;
    }
    
    .theme-title {
        font-size: 0.9rem;
    }
    
    .subtheme-container h2 {
        font-size: 1.3rem;
        margin-bottom: 0.5rem;
    }
    
    .subtheme-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .folder-icon {
        width: 32px;
        height: 26px;
    }
    
    .document-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .document-header h2 {
        margin: 0.5rem 0;
        font-size: 1.3rem;
    }
    
    .document-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}

/* Optimisations pour les petits écrans (<480px) */
@media (max-width: 479px) {
    .space-header h1 {
        font-size: 1.3rem;
    }
    
    .theme-card {
        width: 85px;
        padding: 0.4rem;
        min-width: 0;
    }
    
    .theme-icon {
        width: 32px;
        height: 32px;
    }
    
    .theme-title {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .subtheme-card {
        padding: 0.6rem;
    }
    
    .document-card {
        padding: 0.6rem;
    }
    
    /* Optimisations pour éviter le défilement horizontal */
    .subtheme-content h3,
    .document-info h3 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}

/* Fix pour iPhone SE et autres très petits appareils */
@media (max-width: 375px) {
    .theme-card {
        width: 80px;
        padding: 0.3rem;
    }
    
    .theme-icon {
        width: 28px;
        height: 28px;
    }
}
