/* css/style.css - Version Finale "Clean & Aligned" */

/* --- 1. CONFIGURATION GÉNÉRALE --- */
body { 
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; 
    background: #F0F8FC; /* Fond très léger bleuté */
    color: #333;      
    margin: 0; 
    padding: 20px; 
    display: flex;       
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

.container { 
    width: 100%;
    max-width: 950px; 
    margin: 0 auto; 
    padding-bottom: 80px; 
    flex: 1;
}

/* --- 2. TYPOGRAPHIE --- */
h1 { 
    text-align: center; 
    color: #00A3E0; /* Bleu */
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 1px;
}

h2 { 
    color: #00A3E0; 
    border-bottom: 2px solid #91999F; /* Gris */
    margin-top: 0; 
    padding-bottom: 10px;
    font-size: 1.5em;
}

h3 { 
    color: #73C92D; /* Vert */
    margin-bottom: 10px; 
}

code { 
    display: block; 
    background: #333; 
    color: #73C92D; 
    padding: 15px; 
    border-radius: 8px; 
    word-break: break-all; 
    margin-top: 10px; 
    font-family: 'Consolas', monospace; 
}

/* --- 3. LOGIN --- */
.login-wrapper { width: 100%; max-width: 400px; margin: auto; }

/* --- 4. ONGLETS (TABS) --- */
.tabs { display: flex; gap: 5px; margin-bottom: 0; }

.tab-btn {
    background: #E1E4E6; 
    border: none; 
    padding: 15px 20px; 
    cursor: pointer;
    border-radius: 8px 8px 0 0; 
    font-weight: bold; 
    color: #91999F; 
    transition: all 0.2s; 
    flex: 1; 
    font-size: 1em; 
    outline: none;
    font-family: 'Trebuchet MS', sans-serif;
}

.tab-btn:hover { background: #d0d3d5; color: #00A3E0; }

.tab-btn.active {
    background: white; 
    color: #00A3E0; 
    border-top: 4px solid #00A3E0;
    box-shadow: 0 -4px 6px rgba(0,0,0,0.05); 
    position: relative; 
    z-index: 10;
}

/* Bouton Logout (Rouge) */
.tab-logout {
    margin-left: auto;
    flex: 0 0 50px;
    background: #fff;
    border: 2px solid #D32F2F;
    border-bottom: none;
    color: #D32F2F;
    border-radius: 8px 8px 0 0;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; font-size: 1.2em; transition: all 0.2s;
}
.tab-logout:hover { background: #D32F2F; color: white; }

.tab-content { display: none; animation: fadeIn 0.3s ease-in-out; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- 5. CARTES --- */
.card { 
    background: white; 
    padding: 30px; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(145, 153, 159, 0.15); 
    margin-bottom: 25px; 
}
.tab-content .card { border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 0; }
.cron-section { margin-top: 30px; border: 2px dashed #00A3E0; background: #F0F8FC; }

/* --- 6. FORMULAIRES --- */
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: bold; color: #91999F; }

input, textarea, select { 
    width: 100%; 
    padding: 12px; 
    border: 1px solid #91999F; 
    border-radius: 6px; 
    box-sizing: border-box; 
    font-family: 'Trebuchet MS', sans-serif;
    font-size: 15px; 
    color: #333;
    transition: border-color 0.3s; 
}

input:focus, textarea:focus, select:focus { 
    border-color: #00A3E0; outline: none; box-shadow: 0 0 0 3px rgba(0, 163, 224, 0.1);
}

textarea.prompt-editor { 
    min-height: 500px; font-family: 'Courier New', monospace; font-size: 13px; background: #FAFAFA; line-height: 1.5; border-color: #ccc;
}
.model-select { font-weight: bold; color: #00A3E0; cursor: pointer; }

/* --- 7. GESTION DES FLUX RSS --- */

/* Groupe Catégorie */
.category-group {
    background: #fff; border: 1px solid #91999F; border-radius: 8px;
    margin-bottom: 30px; overflow: hidden; 
}
.category-header {
    background: #F4F4F4; padding: 12px 15px; border-bottom: 1px solid #91999F;
    display: flex; align-items: center; justify-content: space-between;
}
.category-title { 
    font-size: 1.2em; font-weight: bold; color: #00A3E0; 
    display: flex; align-items: center; gap: 10px; 
}

/* Badge Compteur */
.category-counter {
    background-color: #ffffff; color: #91999F; padding: 5px 12px; border-radius: 50px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
    border: 1px solid #ccc; display: flex; align-items: center; gap: 6px;
}
.category-counter::before { content: ''; display: block; width: 8px; height: 8px; border-radius: 50%; background-color: #91999F; }
.category-counter.stat-ok::before { background-color: #73C92D; }
.category-counter.stat-warn::before { background-color: #FFB300; }
.category-counter.stat-err::before { background-color: #FF5252; }

.category-content { padding: 0; }

/* Colonnes & Grille */
.feed-header { 
    display: flex; align-items: center; background-color: #00A3E0; color: white; 
    padding: 12px 0; font-weight: bold; font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.5px; 
}

.feed-header { 
    display: flex; 
    align-items: center; 
    background-color: #00A3E0;
    color: white; 
    padding: 12px 0; 
    font-weight: bold; 
    font-size: 0.9em; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
    margin-bottom: 3px; 
}

.feed-item { 
    display: flex; align-items: center; border-bottom: 1px solid #eee; 
    padding: 8px 0; transition: background 0.2s; height: 50px; 
}
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background-color: #F0F8FC; }
.feed-item.disabled { opacity: 0.5; background-color: #f9f9f9; }

/* Largeurs Colonnes */
.col-state { width: 70px; display: flex; justify-content: center; align-items: center; flex-shrink: 0; }
.col-name { flex: 1; min-width: 150px; padding: 0 10px; border-right: 1px solid #eee; }
.input-name { width: 100%; }
.col-url, .input-url { flex: 2; min-width: 200px; padding: 0 10px; }
.col-actions, .feed-actions { width: 140px; display: flex; justify-content: flex-end; padding-right: 10px; flex-shrink: 0; gap: 5px; }

/* Champs Lecture Seule */
input.readonly-field { 
    background: transparent; border: none; box-shadow: none; 
    color: #333; font-weight: 500; font-size: 0.95em; width: 100%; text-overflow: ellipsis; 
}
input.readonly-field.input-url { font-family: 'Consolas', monospace; font-size: 0.85em; color: #91999F; }

/* Zone d'Ajout (Formulaire intégré) */
#new-feeds-area { margin-top: 0; padding: 0; border: none; }

.add-feed-card {
    display: flex; align-items: center; 
    background-color: #F1FAEE; /* Fond vert très pâle */
    border: 1px solid #73C92D; /* Bordure Verte */
    border-radius: 8px; padding: 8px 0; margin-bottom: 10px;
    animation: fadeIn 0.3s;
}

/* Style unifié pour inputs d'ajout */
.add-feed-card input, .add-feed-card select {
    background-color: #fff; 
    border: 1px solid #73C92D; 
    color: #37474F;
    border-radius: 4px;
    height: 38px; 
    padding: 0 10px;
    margin: 0;
    box-sizing: border-box;
    font-size: 14px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

/* Alignement spécifique pour la colonne Nom + Select */
.add-feed-card .col-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-badge-icon {
    background: #73C92D; color: white; font-size: 10px; font-weight: bold; text-transform: uppercase;
    padding: 4px 8px; border-radius: 12px;
}

/* --- 8. SWITCH --- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; margin: 0; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #73C92D; }
input:focus + .slider { box-shadow: 0 0 1px #73C92D; }
input:checked + .slider:before { transform: translateX(18px); }

/* --- 9. BOUTONS --- */
.btn-secondary, .btn-opml, .btn-copy, #add-feed-btn {
    background-color: #fff; border: 2px solid #00A3E0; color: #00A3E0;
    padding: 8px 16px; border-radius: 8px; font-weight: 700; font-size: 0.9em;
    cursor: pointer; transition: all 0.2s ease; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.2;
    font-family: 'Trebuchet MS', sans-serif;
}
.btn-secondary:hover, .btn-opml:hover, .btn-copy:hover, #add-feed-btn:hover {
    background-color: #00A3E0; color: white; transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0, 163, 224, 0.2);
}
.btn-secondary:active, #add-feed-btn:active { transform: translateY(0); box-shadow: none; }

/* Actions */
.btn-remove, .btn-test, .btn-edit { border: none; border-radius: 6px; cursor: pointer; height: 34px; width: 34px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; font-size: 1.1em; }
.btn-edit { background: #E3F2FD; color: #00A3E0; } .btn-edit:hover { background: #00A3E0; color: white; }
.btn-test { background: #F1FAEE; color: #73C92D; } .btn-test:hover { background: #73C92D; color: white; }
.btn-remove { background: #FFEBEE; color: #D32F2F; } .btn-remove:hover { background: #D32F2F; color: white; }

/* Principal */
.bottom-bar { position: sticky; bottom: 20px; z-index: 99; margin-top: 20px; }
.btn-primary { background: #00A3E0; color: white; border: none; padding: 16px 28px; border-radius: 50px; font-size: 1.2em; cursor: pointer; font-weight: bold; width: 100%; box-shadow: 0 5px 15px rgba(0, 163, 224, 0.4); transition: transform 0.2s; font-family: 'Trebuchet MS', sans-serif; }
.btn-primary:hover { background: #008CBF; transform: translateY(-2px); }

/* Cron */
.cron-action-container { text-align: center; margin-top: 25px; padding-top: 20px; border-top: 1px dashed #00A3E0; display: flex; justify-content: center; gap: 15px; }
.btn-run-cron { background: #73C92D; color: white; border: none; padding: 12px 25px; border-radius: 50px; font-size: 1em; cursor: pointer; font-weight: bold; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 4px 10px rgba(115, 201, 45, 0.3); transition: all 0.2s; font-family: 'Trebuchet MS', sans-serif; }
.btn-run-cron:hover { background: #63b125; transform: translateY(-2px); }
.btn-force-cron { background: #D32F2F; color: white; border: none; padding: 12px 25px; border-radius: 50px; font-size: 1em; cursor: pointer; font-weight: bold; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 4px 10px rgba(211, 47, 47, 0.3); transition: all 0.2s; font-family: 'Trebuchet MS', sans-serif; }
.btn-force-cron:hover { background: #B71C1C; transform: translateY(-2px); }

.input-group { display: flex; gap: 10px; }

/* --- 10. MESSAGES & MODAL --- */
.alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; text-align: center; font-weight: bold; }
.alert.success { background-color: #73C92D; color: white; }
.alert.error { background-color: #D32F2F; color: white; }
.alert.info { background-color: #00A3E0; color: white; }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); backdrop-filter: blur(3px); }
.modal-content { background-color: #fefefe; margin: 5% auto; padding: 25px; border: 1px solid #91999F; width: 90%; max-width: 700px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); position: relative; animation: slideDown 0.3s; }
@keyframes slideDown { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.close-modal { color: #91999F; float: right; font-size: 28px; font-weight: bold; cursor: pointer; line-height: 0.8; }
.close-modal:hover { color: #000; }

/* --- 11. RESULTATS TEST --- */
#test-result { max-height: 500px; overflow-y: auto; font-family: 'Trebuchet MS', sans-serif; background: #fff; padding: 0; border: 1px solid #ccc; border-radius: 8px; margin-top: 15px; display: flex; flex-direction: column; }
.test-header-box { background-color: #F0F8FC; padding: 15px 20px; border-bottom: 1px solid #ccc; position: sticky; top: 0; z-index: 10; }
.test-header-title { font-size: 1.1em; font-weight: 700; color: #00A3E0; margin-bottom: 5px; display: flex; align-items: center; gap: 8px; }
.test-header-meta { font-size: 0.9em; color: #91999F; }
.test-list { list-style: none; padding: 0; margin: 0; }
.test-item-row { display: flex; align-items: center; padding: 10px 15px; border-bottom: 1px solid #eee; transition: background 0.1s; }
.test-item-row:nth-child(even) { background-color: #fcfcfc; }
.test-item-row:hover { background-color: #F0F8FC; }

.badge-wrapper { width: 90px; min-width: 90px; margin-right: 15px; flex-shrink: 0; }
.badge-synced, .badge-new { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 10px; font-weight: 700; text-transform: uppercase; text-align: center; width: 100%; box-sizing: border-box; letter-spacing: 0.5px; }
.badge-synced { background-color: #f0f0f0; color: #91999F; border: 1px solid #ccc; }
.badge-new { background-color: #F1FAEE; color: #73C92D; border: 1px solid #73C92D; }

.item-content { flex: 1; display: flex; flex-direction: column; }
.item-title { font-size: 14px; font-weight: 600; color: #333; line-height: 1.4; margin-bottom: 2px; }
.item-date { font-size: 11px; color: #91999F; display: flex; align-items: center; gap: 5px; }
.test-error { padding: 30px; text-align: center; color: #D32F2F; }

@media (max-width: 600px) {
    .feed-item { flex-direction: column; align-items: stretch; background: #f9f9f9; padding: 10px; border-radius: 8px; border: 1px solid #eee; height: auto; }
    .feed-header { display: none; }
    .col-actions, .feed-actions { width: 100%; margin-top: 10px; justify-content: center; }
    .col-state, .col-name, .col-url { width: auto; min-width: 0; padding: 0; margin-bottom: 5px; border: none; }
    .add-feed-card { flex-direction: column; align-items: stretch; }
}