/* Variables de couleurs avec contraste AAA */
:root {
    --primary-orange: #db3a00;
    --dark-orange: #b32e00;
    --light-orange: #ff6b3a;
    --background: #fff9f2;
    --text-dark: #222222;
    --text-light: #555555;
    --white: #ffffff;
    --border: #d0d0d0;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --focus-ring: #db3a00;
    --focus-ring-light: rgba(219, 58, 0, 0.3);
    --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 12px 35px rgba(0, 0, 0, 0.15);
}

/* Reset et styles de base avec accessibilité */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--background);
    color: var(--text-dark);
    line-height: 1.8;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 1.125rem;
    font-weight: 400;
}

/* Amélioration du contraste pour tous les textes */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    line-height: 1.3;
    font-weight: 700;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1.5rem;
}

/* Conteneur principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Skip link pour l'accessibilité */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-orange);
    color: var(--white);
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 700;
    z-index: 10000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
    outline: 3px solid var(--white);
    outline-offset: 2px;
}

/* === HEADER MOBILE COMPLET === */

/* En-tête - Accessibilité améliorée */
header {
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--dark-orange) 100%);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow-medium);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--white);
    z-index: 1001;
}

.logo:focus {
    outline: 3px solid var(--white);
    outline-offset: 3px;
    border-radius: 4px;
}

.logo i {
    margin-right: 0.5rem;
    font-size: 1.75rem;
}

/* Bouton menu mobile */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 2.5rem;
    height: 2.5rem;
    background: transparent;
    border: 2px solid var(--white);
    border-radius: 0.375rem;
    cursor: pointer;
    padding: 0.375rem;
    transition: all 0.3s ease;
    z-index: 1001;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle:focus {
    outline: 3px solid var(--white);
    outline-offset: 2px;
}

.mobile-menu-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.2);
}

.hamburger-line {
    width: 1.25rem;
    height: 0.1875rem;
    background: var(--white);
    border-radius: 0.125rem;
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: translateY(0.4375rem) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: translateY(-0.4375rem) rotate(-45deg);
}

/* Navigation desktop */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.main-nav ul li {
    margin: 0;
}

.main-nav ul li a {
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    font-size: 1rem;
    white-space: nowrap;
}

.main-nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.main-nav ul li a:focus {
    outline: 3px solid var(--white);
    outline-offset: 2px;
    background-color: rgba(255, 255, 255, 0.2);
}

.main-nav ul li a.active {
    background-color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
}

.main-nav ul li a i {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
}

/* Overlay mobile */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* === FIN HEADER MOBILE === */

/* Section en-tête de page */
.page-header {
    padding: 4rem 0 2.5rem;
    text-align: center;
    background-color: var(--white);
    margin-bottom: 2.5rem;
    border-radius: 0 0 1.25rem 1.25rem;
    box-shadow: var(--shadow-light);
}

.page-header h1 {
    font-size: 2.75rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.page-header p {
    font-size: 1.25rem;
    max-width: 700px;
    margin: 0 auto;
    color: var(--text-light);
    line-height: 1.6;
}

/* Section des propositions */
.propositions-section {
    padding: 4rem 0;
    background-color: var(--white);
    border-radius: 1.25rem;
    box-shadow: var(--shadow-light);
    margin-bottom: 2.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.section-title {
    color: var(--text-dark);
    font-size: 2.25rem;
    position: relative;
}

.section-title:after {
    content: '';
    display: block;
    width: 5rem;
    height: 0.375rem;
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--dark-orange) 100%);
    margin: 1rem auto 0;
    border-radius: 3px;
}

.stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--background);
    padding: 1rem 1.5rem;
    border-radius: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.125rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-item i {
    color: var(--primary-orange);
    font-size: 1.25rem;
}

/* Filtres avec accessibilité */
.filters {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: 2rem;
    font-size: 1.125rem;
    transition: all 0.3s ease;
    background: var(--white);
}

.search-box input:focus {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-color: var(--primary-orange);
    background: var(--white);
}

.search-box i {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.25rem;
}

.filter-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 1rem 2rem;
    border: 2px solid var(--border);
    background: var(--white);
    color: var(--text-dark);
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.125rem;
    transition: all 0.3s ease;
    min-height: 3.5rem;
}

.filter-btn:hover {
    background: var(--primary-orange);
    color: var(--white);
    border-color: var(--primary-orange);
    transform: translateY(-2px);
}

.filter-btn:focus {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    background: var(--primary-orange);
    color: var(--white);
    border-color: var(--primary-orange);
}

.filter-btn.active {
    background: var(--primary-orange);
    color: var(--white);
    border-color: var(--primary-orange);
}

.quartier-filter {
    padding: 1rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: 2rem;
    background: var(--white);
    color: var(--text-dark);
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    font-weight: 600;
}

.quartier-filter:focus {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-color: var(--primary-orange);
    background: var(--white);
}

/* Conteneur des propositions */
.propositions-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Carte de proposition - Accessibilité améliorée */
.proposition-card {
    background: var(--background);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    border: 2px solid var(--border);
    position: relative;
}

.proposition-card:hover,
.proposition-card:focus-within {
    transform: translateY(-8px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--primary-orange);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 3.5rem;
    height: 3.5rem;
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--light-orange) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 1.375rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(219, 58, 0, 0.3);
}

.user-details h4 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.date {
    color: var(--text-light);
    font-size: 1rem;
}

.card-id {
    background: var(--primary-orange);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(219, 58, 0, 0.3);
}

.etablissement-info {
    margin-bottom: 1.5rem;
}

.etablissement-nom {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.quartier-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-orange);
    font-weight: 700;
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.quartier-info i {
    font-size: 1.25rem;
}

.commentaire-content {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 2px solid var(--border);
    margin-bottom: 1.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.commentaire-content p {
    color: var(--text-dark);
    line-height: 1.7;
    word-wrap: break-word;
    white-space: pre-wrap;
    margin: 0;
    font-size: 1.125rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border);
}

.actions {
    display: flex;
    gap: 1rem;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    font-size: 1.125rem;
    min-width: 3rem;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    color: var(--primary-orange);
    background: rgba(219, 58, 0, 0.1);
    transform: translateY(-2px);
}

.action-btn:focus {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    color: var(--primary-orange);
    background: rgba(219, 58, 0, 0.1);
}

/* Statuts */
.status {
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    font-size: 1rem;
    font-weight: 700;
}

.status-new {
    background: #d4edda;
    color: #155724;
}

.status-recent {
    background: #fff3cd;
    color: #856404;
}

.status-old {
    background: #f8d7da;
    color: #721c24;
}

/* Messages */
.loading-message,
.error-message,
.no-propositions-message {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--text-light);
}

.loading-message i,
.error-message i,
.no-propositions-message i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: var(--primary-orange);
}

.error-message i {
    color: var(--danger);
}

.loading-message p,
.error-message p,
.no-propositions-message p {
    font-size: 1.375rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Bouton de réessai */
.retry-btn {
    background: var(--primary-orange);
    color: var(--white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.125rem;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    min-height: 3.5rem;
    box-shadow: 0 4px 15px rgba(219, 58, 0, 0.3);
}

.retry-btn:hover {
    background: var(--dark-orange);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(219, 58, 0, 0.4);
}

.retry-btn:focus {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    background: var(--dark-orange);
}

/* Amélioration du loading */
.loading-message .fa-spinner {
    color: var(--primary-orange);
    margin-bottom: 1.5rem;
}

/* Pied de page - Accessibilité AAA */
footer {
    background-color: var(--text-dark);
    color: var(--white);
    padding: 3rem 0 1.5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-column h3 {
    font-size: 1.375rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
    color: var(--white);
}

.footer-column h3:after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 3rem;
    height: 0.25rem;
    background-color: var(--primary-orange);
    border-radius: 2px;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 0.75rem;
}

.footer-column ul li a {
    color: #d1d5db;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 0.25rem 0;
    font-size: 1.125rem;
    border-bottom: 1px solid transparent;
}

.footer-column ul li a:hover,
.footer-column ul li a:focus {
    color: var(--white);
    padding-left: 0.5rem;
    border-bottom-color: var(--primary-orange);
    outline: none;
}

.footer-column ul li a:focus {
    background-color: rgba(219, 58, 0, 0.2);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}

.copyright {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #4b5563;
    color: #9ca3af;
    font-size: 1.125rem;
}

/* Améliorations pour le focus visible */
*:focus {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* === RESPONSIVE DESIGN === */

/* Mobile First - Tablettes et mobiles */
@media (max-width: 768px) {
    /* Header mobile */
    .mobile-menu-toggle {
        display: flex;
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 300px;
        height: 100vh;
        background: linear-gradient(135deg, var(--primary-orange) 0%, var(--dark-orange) 100%);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
        transition: right 0.3s ease;
        z-index: 999;
        padding: 5rem 1.5rem 2rem;
        overflow-y: auto;
    }

    .main-nav.active {
        right: 0;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }

    .main-nav ul li {
        width: 100%;
    }

    .main-nav ul li a {
        padding: 1rem 1.25rem;
        border-radius: 0.5rem;
        font-size: 1.125rem;
        justify-content: flex-start;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-nav ul li a:hover {
        transform: translateX(5px);
        background-color: rgba(255, 255, 255, 0.2);
    }

    .main-nav ul li a i {
        font-size: 1.25rem;
        width: 1.5rem;
    }

    /* Empêcher le défilement du body quand le menu est ouvert */
    body.menu-open {
        overflow: hidden;
    }

    /* Ajustements du header en mobile */
    header {
        padding: 0.75rem 0;
    }

    .logo {
        font-size: 1.375rem;
    }

    .logo i {
        font-size: 1.5rem;
    }

    /* Styles généraux responsive */
    body {
        font-size: 1rem;
    }
    
    .page-header {
        padding: 3rem 0 2rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
        padding: 0 1rem;
    }
    
    .page-header p {
        font-size: 1.125rem;
        padding: 0 1rem;
    }
    
    .propositions-section {
        padding: 3rem 0;
    }
    
    .section-title {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stats {
        justify-content: flex-start;
    }
    
    .propositions-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .filter-group {
        justify-content: center;
        width: 100%;
    }
    
    .filter-btn,
    .quartier-filter {
        width: 100%;
        text-align: center;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .card-id {
        align-self: flex-start;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Mobile - Petits écrans */
@media (max-width: 480px) {
    .main-nav {
        width: 90%;
    }

    .main-nav ul li a {
        padding: 1.125rem 1.25rem;
        font-size: 1.25rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .mobile-menu-toggle {
        width: 2.25rem;
        height: 2.25rem;
    }

    .hamburger-line {
        width: 1.125rem;
    }

    .page-header {
        padding: 2.5rem 0 1.5rem;
        border-radius: 0 0 1rem 1rem;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .page-header p {
        font-size: 1rem;
    }

    .container {
        padding: 0 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .proposition-card {
        padding: 1.5rem;
    }
    
    .user-info {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .user-avatar {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }
    
    .card-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .actions {
        width: 100%;
        justify-content: space-around;
    }
    
    .stat-item {
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }
    
    .etablissement-nom {
        font-size: 1.25rem;
    }
    
    .quartier-info {
        font-size: 1rem;
    }
}

/* === ACCESSIBILITÉ ET MODES SPÉCIAUX === */

/* Support pour la préférence de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
    
    .proposition-card:hover,
    .filter-btn:hover,
    .retry-btn:hover,
    .main-nav ul li a:hover,
    .action-btn:hover {
        transform: none;
    }

    .main-nav,
    .mobile-menu-toggle,
    .main-nav ul li a,
    .mobile-overlay {
        transition: none;
    }
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    :root {
        --text-dark: #000000;
        --text-light: #333333;
        --border: #000000;
        --background: #ffffff;
    }
    
    .proposition-card {
        border: 3px solid var(--border);
    }
    
    .search-box input,
    .quartier-filter {
        border: 3px solid var(--border);
    }
    
    .commentaire-content {
        border: 3px solid var(--border);
    }

    .main-nav ul li a {
        border: 2px solid var(--white);
    }

    .mobile-menu-toggle {
        border: 3px solid var(--white);
    }
}

/* Support pour le mode sombre */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #ffffff;
        --text-light: #cccccc;
        --background: #1a1a1a;
        --white: #2d2d2d;
        --border: #444444;
    }
    
    .page-header,
    .propositions-section {
        background-color: var(--white);
    }
    
    .proposition-card {
        background-color: #333333;
    }
    
    .commentaire-content {
        background-color: #2d2d2d;
    }
    
    footer {
        background-color: #000000;
    }

    /* Le header garde ses couleurs orange en mode sombre */
    .page-header {
        background-color: #2d2d2d;
    }
    
    .page-header h1 {
        color: #ffffff;
    }
    
    .page-header p {
        color: #cccccc;
    }
}

/* Impression */
@media print {
    .proposition-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .actions,
    .filters,
    .main-nav,
    footer {
        display: none;
    }
    
    .page-header,
    .propositions-section {
        box-shadow: none;
    }
}