* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.controls {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.view-selector {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.btn-view {
    flex: 1;
    max-width: 200px;
    padding: 15px 25px;
    font-size: 1.1em;
    border: 2px solid #4CAF50;
    background: white;
    color: #4CAF50;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.btn-view.active {
    background: #4CAF50;
    color: white;
}

.salarie-selector {
    text-align: center;
    margin-top: 20px;
}

.salarie-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 1.1em;
    color: #555;
}

.salarie-selector select {
    width: 100%;
    max-width: 300px;
    padding: 12px 20px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.salarie-selector select:focus {
    outline: none;
    border-color: #4CAF50;
}

.mois-actuel {
    padding: 20px 30px;
    text-align: center;
    font-size: 1.5em;
    font-weight: 600;
    color: #4CAF50;
    background: #f0f8f0;
}

.horaires-container {
    padding: 30px;
}

.jour-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.jour-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.jour-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.jour-header.weekend {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.jour-header.ferie {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.jour-nom {
    font-size: 1.2em;
    font-weight: 600;
}

.jour-date {
    font-size: 1em;
    opacity: 0.9;
}

.salarie-horaires {
    padding: 20px;
}

.salarie-row {
    display: grid;
    grid-template-columns: 150px 1fr 1fr;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}

.salarie-row:last-child {
    border-bottom: none;
}

.salarie-nom {
    font-weight: 600;
    color: #4CAF50;
    font-size: 1.1em;
}

.horaire-cell {
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.horaire-cell.repos {
    background: #fee;
    color: #c33;
}

.horaire-cell.ferie {
    background: #fff3cd;
    color: #856404;
    font-weight: 600;
}

.horaire-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 600;
}

.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fee;
    color: #c33;
    padding: 20px;
    margin: 20px 30px;
    border-radius: 10px;
    border: 2px solid #fcc;
}

.hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

.actions-bar {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 20px 30px;
    background: #fff;
    border-bottom: 2px solid #e9ecef;
}

.btn-action {
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: 600;
    border: 2px solid #4CAF50;
    background: white;
    color: #4CAF50;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action:hover {
    background: #4CAF50;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.btn-print {
    border-color: #2196F3;
    color: #2196F3;
}

.btn-print:hover {
    background: #2196F3;
    color: white;
}

.btn-email {
    border-color: #FF9800;
    color: #FF9800;
}

.btn-email:hover {
    background: #FF9800;
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 25px 30px;
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-radius: 0 0 20px 20px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.email-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.radio-option:hover {
    background: #e9ecef;
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.email-form {
    padding-left: 30px;
    margin-top: 15px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #4CAF50;
}

textarea.form-control {
    resize: vertical;
    font-family: inherit;
}

.btn-primary {
    padding: 12px 30px;
    background: #FF9800;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #F57C00;
    transform: translateY(-2px);
}

.btn-secondary {
    padding: 12px 30px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #5a6268;
}

footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Vue personnalisée simplifiée */
.vue-perso .salarie-horaires {
    padding: 0;
}

.vue-perso .salarie-row {
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.vue-perso .salarie-nom {
    display: none;
}

/* Jour actuel mis en évidence */
.jour-card.jour-actuel {
    border: 3px solid #FF9800;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.3);
    transform: scale(1.02);
}

.jour-card.jour-actuel .jour-header {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    .view-selector {
        flex-direction: column;
    }

    .btn-view {
        max-width: 100%;
    }

    .actions-bar {
        flex-direction: column;
        padding: 15px;
    }

    .btn-action {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        margin: 10px;
        max-height: 95vh;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 1.2em;
    }

    .modal-body {
        padding: 20px;
    }

    .email-form {
        padding-left: 15px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
    }

    .salarie-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .salarie-nom {
        text-align: center;
        padding-bottom: 10px;
        border-bottom: 2px solid #4CAF50;
    }

    .horaire-cell {
        font-size: 0.95em;
    }

    .vue-perso .salarie-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 15px;
    }

    .horaires-container {
        padding: 15px;
    }

    .jour-header {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

/* Styles d'impression - Format TABLEAU sur 1 page A4 */
@media print {
    @page {
        size: A4 landscape;
        margin: 8mm;
    }
    
    * {
        box-sizing: border-box;
    }
    
    body {
        background: white;
        padding: 0;
        margin: 0;
        font-family: Arial, sans-serif;
        font-size: 7pt;
        color: #000;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        margin: 0;
        max-width: 100%;
    }

    .controls,
    .actions-bar,
    footer,
    .btn-view,
    .btn-action,
    #error,
    #loading {
        display: none !important;
    }

    /* Header compact */
    header {
        background: #4CAF50 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 3mm 0;
        margin-bottom: 2mm;
        text-align: center;
    }

    header h1 {
        font-size: 14pt;
        margin: 0;
        color: white !important;
    }

    header p {
        font-size: 9pt;
        margin: 1mm 0 0 0;
        color: white !important;
    }
    
    /* Titre du mois */
    #mois {
        font-size: 11pt;
        font-weight: bold;
        text-align: center;
        margin-bottom: 2mm;
        color: #333;
    }

    /* TRANSFORMATION EN TABLEAU */
    .horaires-container {
        display: block !important;
        padding: 0;
        width: 100%;
    }
    
    /* Créer un tableau HTML à partir des cartes */
    .jour-card {
        display: none !important;
    }
    
    /* Afficher uniquement le tableau généré */
    #print-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 7pt;
        page-break-inside: avoid;
    }
    
    #print-table th {
        background: #4CAF50 !important;
        color: white !important;
        padding: 2mm;
        border: 0.5pt solid #333;
        font-weight: bold;
        text-align: center;
        font-size: 7.5pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    #print-table td {
        border: 0.5pt solid #999;
        padding: 1.5mm;
        vertical-align: top;
        font-size: 6.5pt;
        line-height: 1.3;
    }
    
    /* Colonne date */
    #print-table td.date-col {
        font-weight: bold;
        text-align: center;
        background: #f0f0f0 !important;
        width: 8%;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Weekends */
    #print-table td.date-col.weekend {
        background: #E1BEE7 !important;
        color: #4A148C !important;
    }
    
    /* Jours fériés */
    #print-table td.date-col.ferie {
        background: #FFF9C4 !important;
        color: #F57F17 !important;
    }
    
    /* Jour actuel */
    #print-table tr.jour-actuel td.date-col {
        background: #FF9800 !important;
        color: white !important;
        font-weight: bold;
    }
    
    /* Cellules horaires */
    #print-table td.horaire-col {
        width: auto;
        text-align: left;
    }
    
    /* Nom du salarié en gras */
    .salarie-nom-print {
        font-weight: bold;
        color: #333;
        margin-bottom: 1mm;
        display: block;
    }
    
    /* Horaires */
    .horaire-print {
        display: block;
        margin: 0.5mm 0;
    }
    
    .horaire-print .label {
        font-weight: normal;
        color: #666;
        font-size: 6pt;
    }
    
    .horaire-print .value {
        font-weight: normal;
        color: #000;
    }
    
    /* Repos */
    .horaire-print.repos {
        color: #C62828 !important;
        font-weight: bold;
        background: #FFEBEE !important;
        padding: 1mm;
        border-radius: 1mm;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Férié */
    .horaire-print.ferie {
        color: #F57F17 !important;
        font-weight: bold;
        background: #FFF9C4 !important;
        padding: 1mm;
        border-radius: 1mm;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Mise en évidence des lignes du jour actuel */
    #print-table tr.jour-actuel {
        background: #FFF8E1 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    #print-table tr.jour-actuel td {
        border-color: #FF9800 !important;
        border-width: 1pt !important;
    }
}

