/* Variables de la charte graphique */
:root {
    --couleur-1: #00A3E0; /* Bleu */
    --couleur-2: #73C92D; /* Vert */
    --couleur-3: #91999F; /* Gris */
    --font-main: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}

body {
    font-family: var(--font-main);
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 0;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--couleur-1);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

h1 {
    color: var(--couleur-1);
    font-size: 1.8rem;
    margin: 0;
}

button {
    background-color: var(--couleur-2);
    color: white;
    border: none;
    padding: 10px 20px;
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #5da622;
}

.project-card {
    background: white;
    border: 1px solid var(--couleur-3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.project-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.project-title {
    color: var(--couleur-1);
    margin: 0;
}

.time-left {
    color: var(--couleur-3);
    font-size: 0.9rem;
}

.ai-section {
    background-color: #eaf6fc;
    border-left: 4px solid var(--couleur-1);
    padding: 20px;
    margin-top: 15px;
    overflow: hidden; /* Obligatoire pour englober l'image flottante */
}

.project-thumb {
    float: right; /* L'image flotte à droite */
    width: 320px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--couleur-3);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin: 0 0 15px 20px; /* Espace en bas et à gauche de l'image */
}

.ai-text {
    flex: 1; /* Le texte prend tout l'espace restant */
}

.project-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.project-body {
    display: flex; /* Aligne l'image et l'IA côte à côte */
    flex-direction: row-reverse; /* Met l'image à droite et l'IA à gauche */
    gap: 20px;
    margin-top: 15px;
    align-items: flex-start;
}

.project-info {
    flex: 1;
}

/* Style du bouton supprimer */
.card-footer {
    display: flex;
    justify-content: flex-end; /* Aligne tout à droite */
    gap: 15px; /* Espace entre les deux boutons */
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--couleur-3);
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

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

.btn-delete:hover {
    background-color: #c0392b; /* Rouge plus foncé au survol */
}

.btn-delete:disabled {
    background-color: #f1948a;
    cursor: not-allowed;
}

.ai-content ul {
    margin-top: 5px;
    padding-left: 20px;
}
.ai-content li {
    margin-bottom: 5px;
}

.btn-project, .btn-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 220px; /* Largeur strictement identique */
    height: 45px; /* Hauteur strictement identique */
    font-size: 0.95rem;
    font-family: var(--font-main);
    font-weight: bold;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.btn-project {
    background-color: var(--couleur-1);
    color: white;
}

.btn-project:hover {
    background-color: #0082b3;
}

/* --- SECTION RÉCOMPENSES --- */
.rewards-section {
    background-color: white;
    border: 1px solid var(--couleur-3);
    border-radius: 8px;
    padding: 15px 20px;
    margin-top: 15px;
}

.rewards-section h4 {
    color: var(--couleur-2); /* Vert */
    margin-top: 0;
}

.rewards-section del {
    color: #e74c3c; /* Rouge pour le prix barré */
    font-weight: normal;
    margin-right: 10px;
}

/* Barre de recherche et filtres */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    gap: 20px;
}

.search-box {
    flex: 1;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid var(--couleur-3);
    border-radius: 5px;
    font-family: var(--font-main);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--couleur-3);
}

.filter-box select {
    padding: 10px;
    border: 1px solid var(--couleur-3);
    border-radius: 5px;
    font-family: var(--font-main);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}

.pagination button {
    background-color: white;
    color: var(--couleur-1);
    border: 1px solid var(--couleur-1);
    padding: 8px 15px;
}

.pagination button.active {
    background-color: var(--couleur-1);
    color: white;
}
/* =========================================
   MODALE PARAMÈTRES (ADMIN)
========================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 650px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden;
}

.modal-header {
    background: #34495e; /* Gris anthracite */
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 { margin: 0; font-size: 1.2rem; }

.btn-close {
    background: none; border: none; color: white;
    font-size: 1.5rem; cursor: pointer;
}

.modal-body { padding: 20px; }

.add-url-box {
    display: flex; gap: 10px; margin-bottom: 20px;
}

#new-url-title { flex: 0.35; padding: 10px; border: 1px solid var(--couleur-3); border-radius: 5px; }
#new-url-input { flex: 0.65; padding: 10px; border: 1px solid var(--couleur-3); border-radius: 5px; }
#add-url-btn { padding: 10px 20px; width: auto; height: auto; }

.urls-list {
    list-style: none; padding: 0; margin: 0;
    max-height: 350px; overflow-y: auto;
}

.urls-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 10px; border-bottom: 1px solid #eee; gap: 15px;
}

.url-info {
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    flex: 1; 
}

.url-title {
    font-size: 1rem;
    color: var(--couleur-1);
    margin-bottom: 2px;
}

.url-text {
    font-size: 0.8rem; 
    color: #7f8c8d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Les fameux petits points ... */
}

.url-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0; 
}

.btn-visit-url, .btn-edit-url, .btn-delete-url {
    display: inline-flex; /* inline-flex est plus stable que flex ici */
    align-items: center; 
    justify-content: center;
    width: 35px; 
    height: 35px;
    padding: 0; /* Annule le padding par défaut des navigateurs */
    margin: 0;
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    color: white;
    text-decoration: none; 
    font-size: 0.9rem;
    box-sizing: border-box; /* Bloque les dimensions exactes à 35x35px */
}

.btn-visit-url { background: var(--couleur-1); }
.btn-visit-url:hover { background: #0082b3; }
.btn-delete-url { background: #e74c3c; }
.btn-delete-url:hover { background: #c0392b; }

/* --- MISE A JOUR FORMULAIRE MODAL --- */
.add-url-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.add-url-row {
    display: flex;
    gap: 10px;
}

#new-url-ignored {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--couleur-3);
    border-radius: 5px;
    font-size: 0.9rem;
    color: #e74c3c;
}

/* Le petit badge "Ignoré" */
.ignored-badge {
    font-size: 0.75rem;
    color: #e74c3c;
    background-color: #fceceb;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 5px;
    border: 1px solid #fadbd8;
}

/* --- MODALE PARAMÈTRES AMÉLIORÉE --- */
.settings-modal-large {
    max-width: 800px; /* Plus large pour accueillir les deux colonnes/sections */
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section h3 {
    font-size: 1.1rem;
    color: #34495e;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

.settings-help {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.settings-divider {
    border: 0;
    border-top: 1px solid #eee;
    margin: 30px 0;
}

/* Grille pour les mots-clés (Badges) */
.keywords-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.keyword-badge {
    background: #fceceb;
    color: #e74c3c;
    border: 1px solid #fadbd8;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.keyword-badge button {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
}

.add-keyword-row {
    display: flex;
    gap: 10px;
}

#new-keyword-input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--couleur-3);
    border-radius: 5px;
}

.btn-settings-header {
    background-color: #34495e;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-settings-header:hover {
    background-color: #2c3e50;
}

/* =========================================
   RESPONSIVE (MOBILE < 768px)
========================================= */
@media (max-width: 768px) {
    .controls { 
        flex-direction: column; 
    }
    
    .add-url-box { 
        flex-direction: column; 
    }

    /* Le nouveau JS crée <div class="project-body"> sur mobile */
    .project-body {
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 15px;
    }

    .project-thumb {
        float: none; /* Désactive l'enveloppement du texte */
        width: 100%; /* Prend toute la largeur de l'écran */
        margin: 0;
    }

    .ai-section {
        margin-top: 0; 
        border-radius: 8px; /* On arrondit tous les coins sur mobile */
    }

    .card-footer {
        flex-direction: column; /* Empile les boutons l'un sur l'autre */
        align-items: center;
    }

    .btn-project, .btn-delete {
        width: 100%; /* Les boutons prennent toute la largeur sur mobile */
    }
	
	.add-url-row { flex-direction: column; }
}