/* Variables de Couleurs et Ombres pour un look 2025 */
:root {
    --primary-blue: #002415; /* Bleu principal pour les actions et le branding */
    --primary-dark-blue: #002415;
    --secondary-grey: #6c757d; /* Gris secondaire pour les textes moins importants */
    --accent-green: #28a745; /* Vert pour les succès/actions positives */
    --accent-dark-green: #218838;

    --bg-light: #f9fafb; /* Arrière-plan général très clair */
    --card-bg: #ffffff; /* Fond des cartes et modales */
    --column-bg: #edf2f7; /* Fond des colonnes Kanban */
    --border-color: #e2e8f0; /* Bordures subtiles */
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.05); /* Ombre légère pour les éléments */
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.1); /* Ombre plus prononcée pour les modales */

    --text-dark: #2d3748; /* Texte principal foncé */
    --text-medium: #4a5568; /* Texte secondaire */
    --text-light: #718096; /* Texte très léger, petites infos */

    --priority-urgent: #ef4444; /* Rouge vibrant pour l'urgence */
    --priority-moderate: #f59e0b; /* Jaune-orange pour modéré */
    --priority-normal: #3b82f6; /* Bleu pour normal */

    --tag-bg: #ebf4ff; /* Fond des tags */
    --tag-text: #2b6cb0; /* Texte des tags */

    --badge-rupture: #dc2626; /* Rouge foncé */
    --badge-erreur-quantite: #facc15; /* Jaune vif */
    --badge-livre-partiellement: #16a34a; /* Vert foncé */
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif; /* Police moderne */
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    scroll-behavior: smooth;
}

/* Boutons génériques */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: 8px; /* Plus arrondis */
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px; /* Espacement entre icône et texte */
}

.btn-primary {
    background-color: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark-blue);
    box-shadow: var(--shadow-light);
}

.btn-secondary {
    background-color: var(--secondary-grey);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    box-shadow: var(--shadow-light);
}

.simulate-btn {
    background-color: #002415; /* Un violet/bleu plus doux */
    color: white;
    padding: 10px 18px;
    font-size: 0.95rem;
}

.simulate-btn:hover {
    background-color: #4f46e5;
}

/* Input & Select fields */
input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    background-color: var(--card-bg);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.error-message {
    color: var(--priority-urgent);
    margin-top: 15px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
}

/* Login Page */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-image: linear-gradient(to right bottom, #f0f2f5, #e0e5ea); /* Léger dégradé */
    padding: 20px;
}

.login-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px; /* Plus arrondis */
    box-shadow: var(--shadow-medium); /* Ombre plus profonde */
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.login-logo {
    max-width: 180px; /* Plus grand */
    margin-bottom: 30px;
}

.login-box h1 {
    margin-bottom: 10px;
    color: var(--primary-blue);
    font-size: 2rem;
    font-weight: 600;
}
.login-box p {
    color: var(--text-medium);
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.login-box .btn {
    width: 100%;
    font-size: 1.1rem;
    padding: 14px; /* Plus grand */
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-light);
}

.app-header {
    background-color: var(--primary-blue);
    color: white;
    padding: 18px 30px; /* Plus de padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-light);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 48px; /* Plus grand */
    /* border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2); Bordure subtile */
}

.app-header h1 {
    font-size: 2rem; /* Plus grand */
    font-weight: 600;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

#current-user {
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-button {
    background-color: var(--priority-urgent); /* Rouge pour la déconnexion */
}

.logout-button:hover {
    background-color: #c82333;
}

.app-nav {
    background-color: var(--card-bg); /* Blanc pour la nav */
    padding: 10px 30px;
    display: flex;
    gap: 5px; /* Espacement plus serré */
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03); /* Ombre très légère */
}

.nav-button {
    background-color: transparent;
    color: var(--text-medium);
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden; /* Pour l'effet de surlignage */
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-button::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background-color: var(--primary-blue);
    transition: width 0.3s ease;
}

.nav-button:hover {
    color: var(--primary-blue);
    background-color: #f0f4f8; /* Très léger fond au survol */
}

.nav-button.active {
    color: var(--primary-blue);
    font-weight: 600;
    background-color: #e0eaf3; /* Fond plus prononcé pour l'actif */
}
.nav-button.active::after {
    width: calc(100% - 40px); /* Ligne soulignée sous le texte */
}

.app-main {
    flex-grow: 1;
    padding: 25px 30px; /* Plus de padding */
    overflow-x: auto;
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 25px; /* Plus d'espace entre les colonnes */
    padding-bottom: 20px;
    min-height: calc(100vh - 280px); /* Ajuster la hauteur */
}

.kanban-column {
    flex: 0 0 320px; /* Largeur fixe pour les colonnes */
    background-color: var(--column-bg);
    border-radius: 10px; /* Plus arrondis */
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-light); /* Ombre subtile */
}

.kanban-column h2 {
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
    padding-bottom: 10px;
    text-align: center;
    font-weight: 600;
}

.kanban-cards {
    flex-grow: 1;
    min-height: 80px; /* Plus d'espace pour le drop */
    padding-bottom: 10px;
}

.kanban-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-light);
    cursor: grab;
    transition: all 0.2s ease;
    border-left: 6px solid transparent; /* Pour l'indication de priorité */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-card:hover {
    transform: translateY(-5px); /* Effet d'élévation plus prononcé */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1); /* Ombre plus grande au survol */
}

.kanban-card.is-dragging {
    opacity: 0.7;
    transform: scale(0.98);
}

.kanban-card h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--text-dark);
    font-weight: 600;
}

.kanban-card p {
    font-size: 0.95rem;
    color: var(--text-medium);
}

.kanban-card .card-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
}

/* Priority Indicators */
.priority-urgent {
    border-left-color: var(--priority-urgent);
}
.priority-moderate {
    border-left-color: var(--priority-moderate);
}
.priority-normal {
    border-left-color: var(--priority-normal);
}

/* Badges/Tags */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}
.card-tags span {
    display: inline-block;
    background-color: var(--tag-bg);
    color: var(--tag-text);
    padding: 6px 12px;
    border-radius: 20px; /* Totalement rond */
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-rupture { background-color: var(--badge-rupture); color: white; }
.badge-erreur-quantite { background-color: var(--badge-erreur-quantite); color: var(--text-dark); }
.badge-livre-partiellement { background-color: var(--badge-livre-partiellement); color: white; }

/* Automation Simulation Buttons */
.automation-simulation {
    margin-bottom: 25px;
    text-align: center;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow-light);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
.automation-simulation p {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0;
    margin-right: 15px;
}


/* Reporting Section */
.reporting-section {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-medium);
    margin-top: 20px;
}

.reporting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.reporting-section h2 {
    color: var(--primary-blue);
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.report-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* 2 ou 3 colonnes flexibles */
    gap: 20px;
    margin-bottom: 40px;
}

.metric-card {
    background-color: var(--column-bg);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
}

.metric-card h3 {
    font-size: 1.1rem;
    color: var(--text-medium);
    margin-bottom: 10px;
    font-weight: 500;
}

.metric-card p {
    font-size: 2.5rem; /* Grande taille pour les chiffres */
    font-weight: 700;
    color: var(--primary-blue);
    line-height: 1;
}

.metric-icon {
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 4rem;
    color: rgba(0, 123, 255, 0.1); /* Icône en filigrane */
    z-index: 0;
}

.reporting-section h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.styled-list {
    list-style-type: none; /* Supprime les puces par défaut */
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    background-color: #fcfdfe;
    padding: 10px;
}

.styled-list li {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-medium);
    transition: background-color 0.2s ease;
}
.styled-list li:last-child {
    border-bottom: none;
}
.styled-list li:hover {
    background-color: #f0f4f8;
}


/* Modals */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Ombre plus douce */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0; /* Pour l'animation d'ouverture */
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 650px; /* Plus large */
    box-shadow: var(--shadow-medium);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px); /* Pour l'animation d'ouverture */
    transition: transform 0.3s ease;
}
.modal.visible .modal-content {
    transform: translateY(0);
}

.close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: var(--text-dark);
}

.modal h2 {
    color: var(--primary-blue);
    margin-bottom: 25px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    font-size: 1.8rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

#task-history-list {
    min-height: 100px;
    max-height: 180px; /* Plus d'espace pour l'historique */
}
#task-history-list li {
    font-size: 0.88em;
}


/* Responsive Design */
@media (max-width: 992px) {
    .app-header h1 {
        font-size: 1.6rem;
    }
    .header-left {
        gap: 10px;
    }
    .header-logo {
        height: 40px;
    }
    .app-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    .nav-button {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    .nav-button.active::after {
        width: calc(100% - 30px);
    }
    .automation-simulation {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .automation-simulation p {
        width: 100%;
        text-align: center;
        margin-right: 0;
        margin-bottom: 10px;
    }
    .simulate-btn {
        width: 100%;
    }
    .kanban-board {
        flex-direction: column;
        gap: 20px;
    }
    .kanban-column {
        flex: 0 0 100%;
        max-width: none;
    }
    .report-metrics {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    .reporting-section h2 {
        font-size: 1.6rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .reporting-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
}

@media (max-width: 576px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px 20px;
    }
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    .login-box {
        padding: 25px;
    }
    .login-box h1 {
        font-size: 1.6rem;
    }
    .app-main {
        padding: 15px;
    }
    .modal-content {
        padding: 20px;
    }
    .modal h2 {
        font-size: 1.5rem;
    }
}