/* ===== VARIABLES ===== */
:root {
    --teal:        #008080;
    --teal-dark:   #005959;
    --teal-xdark:  #003333;
    --teal-light:  #f0f8f8;
    --teal-mid:    #cceaea;
    --sub-bg:      #005050;
    --sub-hover:   #006868;
    --sub-active:  #008080;
    --bg:          #f2f5f7;
    --card:        #ffffff;
    --text:        #0d1a1a;
    --muted:       #5a7070;
    --border:      #dde8e8;
    --font:        'DM Sans', Arial, sans-serif;
    --mono:        'JetBrains Mono', 'Courier New', monospace;
}

body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); }

/* ===== SOUS-NAVBAR ===== */
.sub-navbar {
    position: static;
    width: 100%;
    height: 46px;
    background: var(--sub-bg);
    display: flex;
    align-items: stretch;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    border-bottom: 1px solid var(--teal-xdark);
    box-sizing: border-box;
}

.sub-nav-inner {
    display: flex;
    align-items: stretch;
    padding: 0 28px;
    gap: 2px;
}

.sub-nav-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-family: var(--font);
    font-size: 0.88em;
    font-weight: 500;
    padding: 0 18px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.18s;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.sub-nav-btn:hover {
    color: #fff;
    background: var(--sub-hover);
}

.sub-nav-btn.active {
    color: #fff;
    font-weight: 700;
    border-bottom-color: #7dd3c8;
    background: rgba(255,255,255,0.06);
}

/* ===== CONTENU ===== */
.config-content {
    padding: 36px 48px 100px 48px;
    max-width: 1100px;
}

.config-tab { display: none; }
.config-tab.active { display: block; animation: fadeIn 0.18s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== EN-TÊTES ===== */
.tab-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 16px;
}

.tab-header h2 {
    margin: 0 0 4px 0;
    font-size: 1.55em;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.tab-desc { margin: 0; color: var(--muted); font-size: 0.9em; max-width: 580px; }

.header-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ===== NETWORK TABS ===== */
.network-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--border);
}

.net-tab {
    background: transparent;
    border: none;
    font-family: var(--font);
    font-size: 0.9em;
    font-weight: 500;
    color: var(--muted);
    padding: 9px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.net-tab:hover { color: var(--teal); }
.net-tab.active { color: var(--teal); font-weight: 700; border-bottom-color: var(--teal); }

/* ===== GLOBAL SECTIONS ===== */
.global-sections { display: flex; flex-direction: column; gap: 48px; }

.global-section {}

.global-section-header { margin-bottom: 16px; }
.global-section-header h3 { margin: 0 0 4px 0; font-size: 1.15em; font-weight: 700; color: var(--text); }
.global-section-header p  { margin: 0; font-size: 0.88em; color: var(--muted); }

.global-divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ===== CARDS ===== */
.card-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.config-card {
    background: var(--card);
    border-radius: 9px;
    padding: 13px 18px;
    border-left: 4px solid var(--teal);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    transition: box-shadow 0.2s, transform 0.15s;
}

.config-card:hover {
    box-shadow: 0 4px 14px rgba(0,128,128,0.1);
    transform: translateX(3px);
}

.card-info { flex: 1; min-width: 0; }

.card-name {
    font-weight: 600;
    font-size: 0.97em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 0.8em;
    color: var(--muted);
    align-items: center;
}

.card-meta code {
    font-family: var(--mono);
    font-size: 0.92em;
    background: var(--teal-light);
    color: var(--teal);
    padding: 1px 6px;
    border-radius: 3px;
}

.card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Spécial link-color */
.card-media { border-left-width: 5px; }
.color-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.1); flex-shrink: 0; }
.dash-svg  { display: block; }

/* Épaisseur */
.thick-svg { display: block; }

/* Statut */
.status-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.1); flex-shrink: 0; }

/* Seuil bar */
.threshold-track {
    width: 150px; height: 6px;
    background: #e0e8e8;
    border-radius: 3px;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}
.threshold-warn { position: absolute; top: 0; left: 0; height: 6px; background: #f59e0b; border-radius: 3px; }
.threshold-crit { position: absolute; top: -2px; width: 2px; height: 10px; background: #ef4444; border-radius: 2px; }

/* Network status */
.scan-status-idle      { border-left-color: #94a3b8; }
.scan-status-completed { border-left-color: #22c55e; }
.scan-status-failed    { border-left-color: #ef4444; }
.scan-status-running   { border-left-color: #f59e0b; }
.card-banned           { border-left-color: #ef4444; opacity: 0.85; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9px;
    font-size: 0.74em;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.1px;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-teal   { background: #ccf0f0; color: #0f766e; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-orange { background: #ffedd5; color: #c2410c; }

/* ===== BOUTONS ===== */
.btn-primary {
    background: var(--teal);
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 0.88em;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s, transform 0.1s;
}
.btn-primary:hover { background: var(--teal-dark); transform: translateY(-1px); }

.btn-sm { padding: 7px 14px; font-size: 0.82em; }

.btn-secondary {
    background: #f0f4f4;
    color: #3a5050;
    border: 1.5px solid var(--border);
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 0.88em;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.18s;
}
.btn-secondary:hover { background: #e0eaea; }

.btn-outline {
    background: transparent;
    color: var(--teal);
    border: 1.5px solid var(--teal);
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 0.88em;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.18s;
}
.btn-outline:hover { background: var(--teal-light); }

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 0.88em;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.18s;
}
.btn-danger:hover { background: #dc2626; }

.btn-icon {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--muted);
    padding: 5px 9px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82em;
    font-family: var(--font);
    transition: all 0.15s;
}
.btn-icon:hover          { border-color: var(--teal); color: var(--teal); background: var(--teal-light); }
.btn-icon-danger:hover   { border-color: #ef4444; color: #ef4444; background: #fff5f5; }

/* ===== BLOC SQL ===== */
.sql-block {
    background: #0d1117;
    border-radius: 9px;
    padding: 16px 20px 18px;
    border: 1px solid #1a2828;
    margin-top: 8px;
    margin-bottom: 4px;
    overflow-x: auto;
}

.sql-label {
    font-size: 0.7em;
    font-weight: 700;
    color: var(--teal);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sql-label code {
    font-family: var(--mono);
    background: #1a2828;
    color: #7dd3c8;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

.sql-block pre { margin: 0; }
.sql-block code {
    font-family: var(--mono);
    font-size: 0.82em;
    color: #c9d1d9;
    line-height: 1.9;
    white-space: pre;
}

.kw  { color: #79c0ff; font-weight: 600; }
.fn  { color: #d2a8ff; }
.str { color: #a5d6ff; }
.cmt { color: #4a6a6a; font-style: italic; }

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background: rgba(0,0,0,0.45);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.22);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: translateY(-28px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 17px 22px;
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.modal-header-danger {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

.modal-header h2 { margin: 0; font-size: 1.1em; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.75);
    font-size: 1.55em;
    cursor: pointer;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.modal-body { padding: 20px 22px; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.ban-warn {
    background: #fff5f5;
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.87em;
    color: #7f1d1d;
    margin: 0 0 4px 0;
}

/* ===== FORMULAIRES ===== */
.form-group { margin-bottom: 13px; }

.form-group label {
    display: block;
    font-size: 0.78em;
    font-weight: 600;
    color: #2a4040;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 5px;
}

.form-hint { font-weight: 400; color: #999; text-transform: none; letter-spacing: 0; }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: 0.9em;
    font-family: var(--font);
    background: #fafcfc;
    box-sizing: border-box;
    color: var(--text);
    transition: border-color 0.18s, box-shadow 0.18s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(0,128,128,0.1);
    background: #fff;
}

.form-row { display: flex; gap: 11px; }
.form-row .form-group { flex: 1; }

.form-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fbfb;
    padding: 10px 13px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
}
.form-toggle label:first-child { margin: 0; font-size: 0.84em; }

/* ===== TOGGLE SWITCH ===== */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.toggle input { display: none; }
.toggle-slider { position: absolute; inset: 0; background: #c0d0d0; border-radius: 22px; transition: background 0.25s; }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.25s; }
.toggle input:checked + .toggle-slider { background: var(--teal); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ===== THICKNESS MODAL ===== */
.thickness-row { display: flex; flex-direction: column; gap: 10px; }
.thickness-row input[type="range"] { width: 100%; accent-color: var(--teal); padding: 0; border: none; background: transparent; box-shadow: none; }
.thickness-preview-box { display: flex; align-items: center; gap: 10px; background: var(--teal-light); padding: 7px 12px; border-radius: 8px; }
#thickness-val { font-family: var(--mono); font-size: 0.88em; font-weight: 600; color: var(--teal); min-width: 36px; }

/* ===== ÉTATS CHARGEMENT / ERREUR / VIDE ===== */
.card-loading {
    padding: 22px 20px;
    text-align: center;
    color: var(--teal);
    font-weight: 600;
    background: var(--teal-light);
    border-radius: 9px;
    font-size: 0.95em;
    animation: pulse 1.2s ease-in-out infinite;
}

.card-error {
    padding: 16px 20px;
    color: #dc2626;
    background: #fff5f5;
    border-left: 4px solid #ef4444;
    border-radius: 9px;
    font-size: 0.9em;
    font-weight: 500;
}

.card-empty {
    padding: 22px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9em;
    background: #f8fbfb;
    border-radius: 9px;
    border: 1.5px dashed var(--border);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .config-content { padding: 20px 14px 80px; }
    .sub-nav-inner  { padding: 0 8px; gap: 0; overflow-x: auto; }
    .sub-nav-btn    { padding: 0 12px; font-size: 0.82em; }
    .tab-header     { flex-direction: column; gap: 10px; }
    .header-actions { flex-wrap: wrap; }
    .form-row       { flex-direction: column; gap: 0; }
    .modal-content  { max-width: 96vw; }
}
