/* 
* Styles améliorés pour APN Pneus - Type de travail
* Optimisations de performances et accessibilité
*/

/* --- RÉINITIALISATION DE BASE --- */
html, body {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body div, body p, body h1, body h2, body h3, body h4, body h5, body h6,
body a, body button, body input, body form, body label, body select, body textarea {
    box-sizing: border-box;
}

body {
    background-color: #f3f4f6;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif;
    line-height: 1.5;
    color: #333;
}

/* --- CONTENEURS PRINCIPAUX --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.form-container {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

/* --- GROUPE DE BOUTONS RADIO --- */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
}

input[type="radio"] {
    width: 1rem;
    height: 1rem;
    margin-right: 0.75rem;
    /* Remplacement de accent-color par une approche compatible */
    background-color: white;
    border: 1px solid #bbbbbb;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 50%;
    position: relative;
    outline: none;
}

/* Style personnalisé pour l'état coché */
input[type="radio"]:checked {
    border-color: #2563eb;
    border-width: 10px;
    background-color: white;
}

.radio-option label {
    cursor: pointer;
    font-size: 24px;
    color: #374151;
    user-select: none;
    flex: 1;
    padding: 0.5rem 0;
}

/* Focus visible pour accessibilité */
input[type="radio"]:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Ajout d'un état hover pour feedback visuel */
input[type="radio"]:hover:not(:checked) {
    border-color: #4b83eb;
}

/* --- BOUTONS --- */
.button1 {
    background-color: #2563eb;
    color: white;
    font-weight: 500;
    width: 80%;
    max-width: 450px;
    margin: 0 auto;
    display: block;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-align: center;
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    margin-top: 15px;
    font-size: 30px;
}

.button1:hover {
    background-color: #1d4ed8;
}

.button1:active {
    transform: translateY(1px);
}

.button1:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5);
}

/* Gestion des erreurs */
.error-message {
    color: #dc2626;
    text-align: center;
    padding: 0.5rem;
    margin: 1rem 0;
    font-size: 20px;
    min-height: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-weight: 700;
    background-color: #fffb07;
    border-radius: 4px;
}

.error-message.visible {
    opacity: 1;
}

/* --- MODALES DIALOG --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    width: 90%;
    max-width: 500px;
}

.dialog-style {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.dialog-style h2 {
    margin-top: 0;
    color: #000000;
    font-weight: 700;
}

.dialog-style p {
    margin: 10px 0;
    color: #000000;
    font-size: 20px;
    font-weight: 700;
}

/* --- HEADER ET NAVIGATION --- */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Logo */
.apb-png {
    max-width: 100%;
    height: auto;
}

/* --- CALENDRIER --- */
.type-travail {
    background-color: #dbeafe;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
}

.calendar-container {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn {
    background-color: #3b82f6;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease;
}

.btn:hover {
    background-color: #2563eb;
}

.month-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.weekday {
    text-align: center;
    font-weight: 700;
    padding: 0.5rem;
}

.calendar-day {
    text-align: center;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.calendar-day:hover:not(.disabled):not(.empty) {
    background-color: #dbeafe;
}

.calendar-day.empty {
    border: none;
}

.calendar-day.disabled {
    background-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.calendar-day.today {
    background-color: #bfdbfe;
}

.calendar-day.selected-day {
    background-color: #22c55e;
    color: white;
}

#no-creneaux-message {
    background-color: #fef08a;
    color: #dc2626;
    text-align: center;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 1.5rem;
    display: none;
}

#creneaux {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    display: none;
}

#liste-creneaux {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.creneau-btn {
    padding: 0.5rem;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.2s ease;
}

.creneau-btn:hover {
    background-color: #2563eb;
}

.creneau-btn.selected-day {
    background-color: #22c55e;
}

#reservation-section {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 1rem;
    display: none;
}

.reservation-btn {
    margin: 1rem auto;
    display: block;
    width: 200px;
    font-size: 1.875rem;
    text-align: center;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* --- ACCESSIBILITÉ --- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* --- MÉDIAS QUERIES --- */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .button1 {
        width: 100%;
    }
    
    #liste-creneaux {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .form-container {
        padding: 1rem;
    }
    
    .radio-option label {
        font-size: 16px;
    }
    
    .button1 {
        font-size: 16px;
        padding: 8px 16px;
    }
}

/* --- ACCESSIBILITÉ ET RÉDUCTION DE MOUVEMENT --- */
@media (prefers-reduced-motion: reduce) {
    /* Solution compatible avec CSP stricte */
    body {
        /* Alternative à scroll-behavior */
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .button1 {
        transition-duration: 0.001s;
    }
    
    .modal-content {
        transition-duration: 0.001s;
    }
    
    .calendar-day {
        transition-duration: 0.001s;
    }
    
    .creneau-btn {
        transition-duration: 0.001s;
    }
    
    .radio-option {
        transition-duration: 0.001s;
    }
    
    .error-message {
        transition-duration: 0.001s;
    }
}