/* =============================================================================
   FICHIER: assets/css/style.css
   DESCRIPTION: Feuille de style principale pour le système de gestion des formations
   ============================================================================= */

/* =============================================================================
   BLOC 1: RESET ET VARIABLES CSS
   ============================================================================= */

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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #ecf0f1;
    --dark-bg: #34495e;
    --text-color: #2c3e50;
    --border-color: #bdc3c7;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* =============================================================================
   BLOC 2: STYLES GENERAUX
   ============================================================================= */

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--light-bg);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =============================================================================
   BLOC 3: NAVIGATION
   ============================================================================= */

.main-nav {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-links a:hover {
    background-color: rgba(255,255,255,0.1);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    color: #bdc3c7;
    font-size: 0.9rem;
}

/* =============================================================================
   BLOC 4: FORMULAIRES
   ============================================================================= */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* =============================================================================
   BLOC 5: BOUTONS
   ============================================================================= */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

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

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

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* =============================================================================
   BLOC 6: TABLEAUX
   ============================================================================= */

.table-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--light-bg);
    font-weight: 600;
    color: var(--text-color);
}

.table tr:hover {
    background-color: #f8f9fa;
}

.table-responsive {
    overflow-x: auto;
}

.table-sortable th {
    cursor: pointer;
    user-select: none;
}

.table-sortable th:hover {
    background-color: #d5dbdb;
}

/* =============================================================================
   BLOC 7: ALERTES ET NOTIFICATIONS
   ============================================================================= */

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* =============================================================================
   BLOC 8: STATUTS DES FORMATIONS
   ============================================================================= */

.status-ok {
    color: var(--success-color);
    font-weight: 500;
}

.status-warning {
    color: var(--warning-color);
    font-weight: 500;
}

.status-expired {
    color: var(--danger-color);
    font-weight: 500;
}

.formation-cell {
    padding: 0.5rem;
    border-radius: 4px;
}

.formation-cell.warning {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
}

.formation-cell.expired {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.formation-important {
    font-weight: bold;
}

.formation-expired {
    color: var(--danger-color);
}

/* =============================================================================
   BLOC 9: RECHERCHE
   ============================================================================= */

.search-container {
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 3rem;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.search-box::after {
    content: "🔍";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

/* =============================================================================
   BLOC 10: DASHBOARD
   ============================================================================= */

.dashboard-header {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.dashboard-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #7f8c8d;
    font-size: 1rem;
}

.section-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

/* =============================================================================
   BLOC 11: GRILLES DE DONNEES
   ============================================================================= */

.data-grid {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.grid-header {
    background-color: var(--light-bg);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.grid-actions {
    display: flex;
    gap: 0.5rem;
}

.qualification-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.qualification-observateur {
    background-color: #e8f4f8;
    color: #2980b9;
}

.qualification-samaritain {
    background-color: #e8f5e8;
    color: #27ae60;
}

/* =============================================================================
   BLOC 12: FORMULAIRE DE CONNEXION
   ============================================================================= */

.login-body {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    max-width: 400px;
    width: 100%;
    padding: 2rem;
}

.login-form {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.login-form h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-form h3 {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 2rem;
}

.login-info {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
}

.login-info p {
    margin-bottom: 0.5rem;
}

/* =============================================================================
   BLOC 13: FICHES PERSONNELLES
   ============================================================================= */

.fiche-container {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.fiche-header {
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.fiche-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.fiche-section {
    margin-bottom: 2rem;
}

.fiche-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    margin-bottom: 0.5rem;
}

.info-label {
    font-weight: 600;
    min-width: 150px;
    color: var(--text-color);
}

.info-value {
    color: #7f8c8d;
}

/* =============================================================================
   BLOC 14: IMPRESSION
   ============================================================================= */

@media print {
    .main-nav,
    .action-buttons,
    .btn {
        display: none !important;
    }
    
    body {
        background-color: white !important;
        color: black !important;
    }
    
    .fiche-container {
        box-shadow: none !important;
        border: 1px solid #ccc;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    .page-break {
        page-break-before: always;
    }
}

/* =============================================================================
   BLOC 15: RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-responsive {
        overflow-x: scroll;
    }
}

/* =============================================================================
   BLOC 16: UTILITAIRES
   ============================================================================= */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #7f8c8d;
}

.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 {
    gap: 1rem;
}

.w-100 {
    width: 100%;
}

.hidden {
    display: none;
}

.tooltip {
    position: relative;
    cursor: help;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--dark-bg);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    font-size: 0.8rem;
}

/* =============================================================================
   BLOC 17: UPLOAD DE FICHIERS
   ============================================================================= */

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background-color: #f8f9fa;
    transition: border-color 0.3s;
}

.file-upload-area:hover {
    border-color: var(--secondary-color);
}

.file-upload-area.dragover {
    border-color: var(--secondary-color);
    background-color: #e3f2fd;
}

.file-list {
    margin-top: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.file-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.file-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.file-meta {
    font-size: 0.85rem;
    color: #666;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

/* =============================================================================
   BLOC 18: ARCHIVES
   ============================================================================= */

.archive-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #6c757d;
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.service-duration {
    font-weight: 500;
    color: var(--primary-color);
}

.archive-stats {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100px;
    height: 15px;
    background-color: #e9ecef;
    border-radius: 7px;
    overflow: hidden;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}

.progress-fill {
    height: 100%;
    background-color: #007bff;
    transition: width 0.3s ease;
}

/* =============================================================================
   BLOC 19: BADGES ET INDICATEURS
   ============================================================================= */

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    border-radius: 0.25rem;
    text-transform: uppercase;
}

.badge-secondary {
    background-color: #6c757d;
}

.badge-primary {
    background-color: var(--secondary-color);
}

.badge-success {
    background-color: var(--success-color);
}

.badge-warning {
    background-color: var(--warning-color);
}

.badge-danger {
    background-color: var(--danger-color);
}

/* =============================================================================
   BLOC 20: MESSAGES ET ALERTES AMÉLIORÉS
   ============================================================================= */

.alert {
    position: relative;
    padding: 1rem 1rem 1rem 3rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid transparent;
}

.alert::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    background-size: contain;
}

.alert-success::before {
    content: '✓';
    color: #155724;
    font-weight: bold;
}

.alert-warning::before {
    content: '⚠';
    color: #856404;
    font-weight: bold;
}

.alert-error::before {
    content: '✗';
    color: #721c24;
    font-weight: bold;
}

.alert-info::before {
    content: 'ℹ';
    color: #0c5460;
    font-weight: bold;
}