/* Styles pour l'historique collaboratif */

.historique-timeline {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e5e9;
}

.timeline-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.timeline-controls {
    display: flex;
    gap: 10px;
}

.timeline-filters {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.filters-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filters-row select,
.filters-row input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.filters-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #495057;
}

/* Timeline Entries */
.timeline-entries {
    position: relative;
    padding-left: 20px;
}

.timeline-entries::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #3498db, #2c3e50);
}

.timeline-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0 12px 0;
    border-bottom: 1px solid #f1f5f9;
    background: #f9fafb;
    border-radius: 7px;
    margin-bottom: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: background 0.2s, box-shadow 0.2s;
}

.timeline-entry:hover {
    background: #e8f0fe;
    box-shadow: 0 4px 12px rgba(52,152,219,0.10);
}

.timeline-entry::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 20px;
    width: 12px;
    height: 12px;
    background: #3498db;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 3px #3498db;
}

.timeline-entry .w-8 {
    min-width: 2rem;
    min-height: 2rem;
}

.timeline-entry .font-semibold {
    font-weight: 600;
}

.timeline-entry .truncate {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Types d'entrées */
.timeline-entry.auto {
    border-left-color: #95a5a6;
    opacity: 0.9;
}

.timeline-entry.auto::before {
    background: #95a5a6;
    box-shadow: 0 0 0 3px #95a5a6;
}

.timeline-entry.manual {
    border-left-color: #3498db;
}

/* Priorités */
.timeline-entry.priorite-critique {
    border-left-color: #e74c3c;
}

.timeline-entry.priorite-critique::before {
    background: #e74c3c;
    box-shadow: 0 0 0 3px #e74c3c;
}

.timeline-entry.priorite-importante {
    border-left-color: #f39c12;
}

.timeline-entry.priorite-importante::before {
    background: #f39c12;
    box-shadow: 0 0 0 3px #f39c12;
}

.timeline-entry.priorite-normale {
    border-left-color: #27ae60;
}

.timeline-entry.priorite-normale::before {
    background: #27ae60;
    box-shadow: 0 0 0 3px #27ae60;
}

/* Timestamp */
.entry-timestamp {
    position: static !important;
    display: inline-block;
    margin: 0 0 0 10px;
    font-size: 12px;
    color: #7f8c8d;
    background: #ecf0f1;
    padding: 4px 8px;
    border-radius: 12px;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Acteur */
.entry-acteur {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 15px 10px 15px;
    border-bottom: 1px solid #ecf0f1;
}

.acteur-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.entry-acteur.system .acteur-avatar {
    background: #95a5a6;
}

.acteur-nom {
    font-weight: 600;
    color: #2c3e50;
}

.acteur-role {
    font-size: 12px;
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Rôles */
.role-technicien .acteur-role { background: #3498db; }
.role-superviseur .acteur-role { background: #9b59b6; }
.role-enqueteur .acteur-role { background: #e67e22; }
.role-securite .acteur-role { background: #e74c3c; }
.role-mainteneur .acteur-role { background: #27ae60; }
.role-controleur .acteur-role { background: #f39c12; }

/* Contenu */
.entry-content {
    padding: 0 15px 15px 15px;
}

.entry-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.entry-icon {
    font-size: 18px;
}

.entry-type {
    font-size: 12px;
    background: #ecf0f1;
    color: #7f8c8d;
    padding: 2px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.entry-title {
    font-weight: 600;
    color: #2c3e50;
}

.entry-description {
    margin: 10px 0;
    color: #34495e;
    line-height: 1.5;
}

.entry-details {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.entry-detail {
    margin: 5px 0;
    font-size: 14px;
    color: #5a6c7d;
}

.change-detail .old-value {
    color: #e74c3c;
    text-decoration: line-through;
}

.change-detail .new-value {
    color: #27ae60;
    font-weight: 600;
}

.entry-tags {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.entry-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.btn-mini {
    background: none;
    border: 1px solid #bdc3c7;
    color: #7f8c8d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-mini:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.entry-responses {
    padding: 8px 15px;
    background: #f8f9fa;
    border-top: 1px solid #ecf0f1;
    border-radius: 0 0 12px 12px;
    font-size: 12px;
    color: #7f8c8d;
}

/* Modal Action Rapide */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: #ecf0f1;
    color: #7f8c8d;
}

.modal-body {
    padding: 20px;
}

.action-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.action-btn {
    padding: 20px;
    border: 2px solid #ecf0f1;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.action-btn:hover {
    border-color: #3498db;
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.action-btn.action-terrain:hover { border-color: #3498db; }
.action-btn.observation:hover { border-color: #27ae60; }
.action-btn.decision:hover { border-color: #9b59b6; }
.action-btn.communication:hover { border-color: #e67e22; }

/* Formulaires */
.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #34495e;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

/* Boutons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* Mode Film */
.mode-film {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.film-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e5e9;
}

.film-controls {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.film-narrative {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.film-narrative pre {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #2c3e50;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

.film-metadata {
    background: #ecf0f1;
    padding: 15px;
    border-radius: 8px;
    color: #2c3e50;
}

.film-metadata ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.film-metadata li {
    margin: 5px 0;
}

/* Styles pour le mode film intégré */
.film-mode {
    background: #1a1a1a;
    color: white;
    border-radius: 8px;
    padding: 16px;
}

.film-reconstruction {
    max-height: 500px;
    overflow-y: auto;
}

.film-header {
    text-align: center;
    border-bottom: 1px solid #333;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.film-header h4 {
    color: #fbbf24;
    margin: 0;
    font-size: 18px;
}

.film-entry {
    display: flex;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.film-timestamp {
    min-width: 140px;
    font-family: monospace;
    color: #10b981;
    font-size: 12px;
}

.film-content {
    flex: 1;
}

.film-actor {
    color: #60a5fa;
    font-size: 12px;
    margin-bottom: 4px;
}

.film-action {
    font-size: 14px;
}

.film-summary {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #333;
}

.film-summary h5 {
    color: #fbbf24;
    margin: 0 0 12px 0;
}

.film-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    font-size: 12px;
}

.film-stats > div {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 8px;
    border-radius: 4px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 9998;
    animation: slideInRight 0.3s ease;
}

.notification-success {
    background: #27ae60;
}

.notification-error {
    background: #e74c3c;
}

.notification-info {
    background: #3498db;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* États vides */
.no-entries {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    font-style: italic;
}

/* Timeline simplifiée */
.timeline-global {
    max-width: 700px;
    margin: 30px auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    padding: 24px 32px;
}
.timeline-global h3 {
    margin-bottom: 18px;
    color: #1a202c;
    font-size: 1.7rem;
    text-align: center;
}
#timeline-form {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}
#timeline-form input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 15px;
}
#timeline-form input#timeline-acteur {
    min-width: 120px;
    max-width: 180px;
    flex: 0 0 25%;
}
#timeline-form input#timeline-commentaire {
    min-width: 200px;
    flex: 1 1 60%;
}
#timeline-form button[type="submit"] {
    padding: 8px 18px;
    background: #2563eb;
    color: white;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    transition: background 0.2s;
}
#timeline-form button[type="submit"]:hover {
    background: #1d4ed8;
}

/* Style pour l'input inline editing */
.timeline-entry input[type="text"] {
    font-size: 16px;
    padding: 2px 6px;
    border: 1px solid #60a5fa;
    border-radius: 4px;
    background: #f0f9ff;
    margin: 0;
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .timeline-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .timeline-controls {
        justify-content: center;
    }
    
    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .action-type-selector {
        grid-template-columns: 1fr;
    }
    
    .entry-timestamp {
        position: static;
        margin-bottom: 10px;
        text-align: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* Améliorations d'accessibilité */
.timeline-entry:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Animation d'apparition */
.timeline-entry {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
