/* assets/css/style.css */

/* ============================================================
   1. VARIABLES & RESET GLOBAL
   ============================================================ */
:root {
    --primary-color: #007bff;   /* Bleu Mer */
    --secondary-color: #6c757d; /* Gris Pierre */
    --success-color: #28a745;   /* Vert Validation */
    --danger-color: #dc3545;    /* Rouge Alerte */
    --warning-color: #ffc107;   /* Jaune Attente */
    --info-color: #17a2b8;      /* Bleu Ciel */
    --light-bg: #f4f6f9;        /* Fond général */
    --dark-text: #343a40;
    --border-color: #dee2e6;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 15px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* ============================================================
   2. STRUCTURE & LAYOUT
   ============================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* En-tête de page standard */
.header-page, .dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

h1, h2, h3, h4, h5 {
    margin-top: 0;
    color: #2c3e50;
}

h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; }

/* ============================================================
   3. TABLEAUX DE DONNÉES (Data Tables)
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

thead {
    background-color: #343a40;
    color: white;
}

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

th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}



tbody tr:hover {
    background-color: rgba(0,0,0,0.02);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   4. FORMULAIRES & INPUTS
   ============================================================ */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input:focus, select:focus, textarea:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ============================================================
   5. BOUTONS (Buttons)
   ============================================================ */
.btn, button, input[type="submit"] {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: #0069d9; }

.btn-secondary { background-color: var(--secondary-color); color: white; }
.btn-secondary:hover { background-color: #5a6268; }

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

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

.btn-warning { background-color: var(--warning-color); color: #212529; }
.btn-warning:hover { background-color: #e0a800; }

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}

/* ============================================================
   6. COMPOSANTS DASHBOARD & CARTES
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s;
    color: inherit; /* Pour les liens */
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.kpi-val { font-size: 2rem; font-weight: bold; }
.kpi-label { color: #888; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; }

/* ============================================================
   7. BADGES & ÉTATS
   ============================================================ */
.badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 10rem;
}

.status-badge { padding: 5px 10px; border-radius: 20px; font-weight: bold; font-size: 0.85em; }
.status-ok { background-color: #d4edda; color: #155724; }
.status-ko { background-color: #f8d7da; color: #721c24; }

/* Badges Documents (Gestion Bateau) */
.doc-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    margin-right: 5px;
    border: 1px solid transparent;
}
.doc-ok { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.doc-warn { background-color: #fff3cd; color: #856404; border-color: #ffeeba; }
.doc-ko { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }

/* ============================================================
   8. MODALES (Pop-ups)
   ============================================================ */
.modal {
    display: none; /* Caché par défaut */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5); /* Overlay sombre */
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto; /* Centré verticalement (un peu haut) */
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px; /* Max largeur desktop */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

/* ============================================================
   9. MESSAGES (Alerts)
   ============================================================ */
.alert, .msg {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

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

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

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

/* ============================================================
   10. LOGIN PAGE (Spécifique)
   ============================================================ */
.login-page {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

/* ============================================================
   11. UTILITAIRES
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.d-none { display: none !important; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }
.w-100 { width: 100%; }

/* Loader CSS simple */
.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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