/* URLMonitor — Stylesheet v1 */

:root {
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #0284c7;
    --info-bg: #e0f2fe;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;
    --sidebar-width: 240px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Login ─────────────────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--sidebar-bg);
}

.login-container { width: 100%; max-width: 400px; padding: 20px; }

.login-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,.2);
}

.login-header { text-align: center; margin-bottom: 24px; }
.login-header h1 { font-size: 1.5rem; }
.login-header p { color: var(--text-muted); margin-top: 4px; }

.login-form .form-group { margin-bottom: 20px; text-align:center;}
.login-form input[type="email"],
.login-form input[type="password"],
.login-form input[type="text"] {
    height: 48px;
    padding: 0 16px;
    border: 1px solid #d9dee7;
    border-radius: 10px;
    font-size: 15px;
    transition: all .2s ease;
    background: #fff;
}
.login-form input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59,130,246,.15);
}
.login-form input::placeholder {color: #9ca3af;}
.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}
.login-form .btn-full {
    height: 48px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    transition: .2s;
}

.login-form .btn-full:hover {transform: translateY(-1px);}

/* ─── Sidebar ───────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.25s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-header h1 {
    font-size: 1.1rem;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-logo {
    display: inline-block;
    vertical-align: middle;
    border-radius: 5px;
    flex-shrink: 0;
}

.mobile-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}

.nav-icon { font-size: 1.1rem; }

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 8px 0;
}

/* ─── Mobile Header ─────────────────────────────────── */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
}


.menu-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
}

/* ─── Main Content ──────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: 100vh;
}

/* ─── Page Header ───────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Stats Grid ────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.stat-card-warning .stat-value { color: var(--warning); }
.stat-card-danger .stat-value { color: var(--danger); }

/* ─── Cards ─────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.card h3 { font-size: 1rem; margin-bottom: 12px; }
.card h4 { font-size: 0.9rem; margin: 12px 0 8px; }
.card hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.card-help { background: var(--surface-alt); font-size: 0.85rem; }
.card-help ol { padding-left: 20px; }
.card-help li { margin-bottom: 4px; }

/* ─── Category Sections ─────────────────────────────── */
.category-section { margin-bottom: 24px; }

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 0 4px;
}

.category-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

/* ─── Tables ────────────────────────────────────────── */
.products-table-wrap { overflow-x: auto; }

.products-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align:left;
}

.products-table th {
    background: var(--surface-alt);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.products-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.products-table tbody tr:hover { background: var(--surface-alt); }
.products-table tbody tr:last-child td { border-bottom: none; }

.row-inactive { opacity: 0.5; }
.row-error { background: #fff5f5 !important; }
.row-changed { background: #fffbeb !important; }

.product-name-cell strong { display: block; font-size: 0.9rem; }

.product-links {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.75rem;
}

.product-links a {
    color: var(--text-muted);
    white-space: nowrap;
}
.product-links a:hover { color: var(--primary); }

.detection-method-hint {
    font-size: 0.72rem;
    color: var(--text-light);
    letter-spacing: 0.01em;
}

.error-detail {
    font-size: 0.7rem;
    color: var(--danger);
    margin-top: 4px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actions-cell { white-space: nowrap; }

.actions-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.help-table { width: 100%; margin-top: 8px; }
.help-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
.help-table td:first-child { font-weight: 600; white-space: nowrap; }

/* ─── History ───────────────────────────────────────── */
.history-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.history-summary > div {
    flex: 1;
    min-width: 140px;
}

/* ─── Forms ─────────────────────────────────────────── */
fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

legend {
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0 8px;
    color: var(--text);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--text);
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-inline {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.form-inline-edit {
    display: flex;
    gap: 4px;
    align-items: center;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Zone dangereuse : action destructive rejetée à l'opposé du bouton
   Enregistrer pour éviter les fausses manipulations. */
.form-danger-zone {
    display: flex;
    justify-content: flex-end;
}

.input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.input-inline {
    width: auto;
    flex: 1;
    padding: 6px 10px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500 !important;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ─── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; }

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--surface-alt); border-color: var(--text-muted); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

.btn-small { padding: 5px 10px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; padding: 10px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-icon:hover { background: var(--surface-alt); text-decoration: none; }
.btn-danger-icon:hover  { background: var(--danger-bg); }
.btn-icon-danger        { opacity: .55; }
.btn-icon-danger:hover  { background: var(--danger-bg); opacity: 1; }

/* ─── Menu actions mobile (dropdown ⋮) ─────────────── */
.actions-toggle { display: none; }

@media (max-width: 768px) {
    .actions-cell { position: relative; }

    .actions-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--surface);
        cursor: pointer;
        font-size: 1.1rem;
        color: var(--text-muted);
        padding: 0;
        line-height: 1;
    }
    .actions-toggle:hover { background: var(--surface-alt); }

    .actions-dropdown {
        display: none;
        position: absolute;
        right: 0;
        top: calc(100% + 4px);
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: 0 4px 16px rgba(0,0,0,.12);
        z-index: 200;
        flex-direction: column;
        min-width: 150px;
        overflow: hidden;
    }
    .actions-row.open .actions-dropdown { display: flex; }

    .actions-dropdown .btn-icon,
    .actions-dropdown a,
    .actions-dropdown button {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 14px;
        text-decoration: none;
        color: var(--text);
        font-size: .875rem;
        white-space: nowrap;
        background: transparent;
        border: none;
        border-bottom: 1px solid var(--border);
        cursor: pointer;
        width: 100%;
        text-align: left;
        box-sizing: border-box;
        height: auto;
        width: 100%;
        justify-content: flex-start;
        border-radius: 0;
        opacity: 1;
    }
    .actions-dropdown .btn-icon:last-child,
    .actions-dropdown a:last-child,
    .actions-dropdown button:last-child { border-bottom: none; }
    .actions-dropdown .btn-icon:hover,
    .actions-dropdown a:hover,
    .actions-dropdown button:hover { background: var(--surface-alt); }
    .actions-dropdown .btn-icon-danger:hover { background: var(--danger-bg); }

    .action-label { font-size: .875rem; }
}

/* ─── Badges ────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }

/* ─── Alerts ────────────────────────────────────────── */
.alert {
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.alert-success { background: var(--success-bg); color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }

.alert-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0 4px;
}
.alert-close:hover { opacity: 1; }

/* ─── Pagination ────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagination-info { font-size: 0.85rem; color: var(--text-muted); }

/* ─── Empty State ───────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 16px; }

/* ─── Utilities ─────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.8rem; }
.font-mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.85em; }
.hidden { display: none !important; }

/* ─── News Badge (dashboard) ────────────────────────── */
.badge-news {
    background: #dbeafe;
    color: var(--primary);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    text-decoration: none;
    margin-left: 8px;
    vertical-align: middle;
}
.badge-news:hover { background: #bfdbfe; text-decoration: none; }

.category-header-actions { display: flex; gap: 6px; }

/* ─── News Filters ──────────────────────────────────── */
.news-filters {
    margin-bottom: 16px;
}

.filter-group {
    margin-bottom: 10px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 8px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
}

.chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.chip-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-active:hover { background: var(--primary-hover); color: #fff; }

/* ─── News Cards ────────────────────────────────────── */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.news-card {
    display: flex;
    gap: 14px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: border-color 0.15s;
}

.news-card:hover { border-color: var(--text-light); }

.news-unread {
    border-left: 3px solid var(--primary);
    background: #f8faff;
}

.news-read {
    opacity: 0.7;
}

.news-image {
    flex-shrink: 0;
    width: 100px;
    height: 75px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-alt);
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-light);
}

.news-image-broken {
    display: flex;
    align-items: center;
    justify-content: center;
}
.news-image-broken img { display: none; }
.news-image-broken::after { content: '📰'; font-size: 1.5rem; }

.news-body {
    flex: 1;
    min-width: 0;
}

.news-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.75rem;
}

.news-source {
    font-weight: 600;
    color: var(--primary);
}

.news-category-tag {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.news-date { color: var(--text-light); }

.news-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

.news-title a {
    color: var(--text);
    text-decoration: none;
}
.news-title a:hover { color: var(--primary); }

.news-summary {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.news-actions {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
}

.btn-mark-read {
    opacity: 0.5;
    transition: opacity 0.15s;
}
.btn-mark-read:hover { opacity: 1; }

.news-read-icon {
    color: var(--success);
    font-size: 0.85rem;
}

/* ─── Category Card (sources) ───────────────────────── */
.category-card { margin-bottom: 12px; }

.category-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.category-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sources-toggle { margin-bottom: 8px; }

.sources-block {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 8px;
}

.sources-table { margin-bottom: 16px; }

.add-source-form {
    background: var(--surface-alt);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 12px;
}

.add-source-form h4 {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.detect-result {
    padding: 10px 14px;
    border-radius: 6px;
    margin: 8px 0 12px;
    font-size: 0.85rem;
}

.detect-result.detect-success {
    background: var(--success-bg);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.detect-result.detect-error {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.detect-result .feed-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0,0,0,.06);
    cursor: pointer;
}
.detect-result .feed-option:last-child { border-bottom: none; }
.detect-result .feed-option:hover { color: var(--primary); }

/* ─── Page Réglages ─────────────────────────────────── */
.settings-cron-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.settings-cron-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.settings-cron-label {
    font-weight: 600;
    min-width: 60px;
}

/* ─── Graphique évolution des prix ──────────────────── */
.chart-container {
    position: relative;
    height: 280px;
    margin-top: 8px;
}

.chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chart-empty {
    padding: 40px 0;
    font-size: 0.85rem;
}

/* ─── Détection et test de sélecteur CSS ─────────────── */
.detect-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.input-detect-price {
    width: 160px;
    flex-shrink: 0;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s;
}

.input-detect-price:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.detect-result.detect-loading {
    background: var(--surface-alt);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.selector-option {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.selector-option + .selector-option {
    border-top: 1px solid rgba(0, 0, 0, .06);
}

.selector-option:hover {
    background: rgba(37, 99, 235, .06);
    color: var(--primary);
}

.selector-option code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82em;
    background: rgba(0,0,0,.05);
    padding: 1px 5px;
    border-radius: 3px;
}

/* ─── Test sélecteur ────────────────────────────────── */
.selector-test-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.test-result {
    flex: 1;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.test-result.test-success {
    background: var(--success-bg);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.test-result.test-error {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.test-result.test-loading {
    background: var(--surface-alt);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ─── Multi-type détection ──────────────────────────── */
.detection-type-row {
    align-items: flex-start;
}

.detection-value-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.detect-css-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* ─── Bannière d'analyse URL ─────────────────────────── */
.analyze-banner {
    margin-top: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
    border: 1px solid transparent;
}

.analyze-banner.analyze-success {
    background: var(--success-bg);
    color: #166534;
    border-color: #bbf7d0;
}

.analyze-banner.analyze-error {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
}

.analyze-banner.analyze-loading {
    background: var(--surface-alt);
    color: var(--text-muted);
    border-color: var(--border);
}

/* ─── Champ pré-rempli automatiquement ───────────────── */
.field-autofilled {
    border-color: var(--success) !important;
    background: #f0fdf4 !important;
    transition: border-color 0.3s, background 0.3s;
}

/* ─── Options avancées (collapsible) ─────────────────── */
.form-advanced-options {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.form-advanced-options > summary {
    cursor: pointer;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    user-select: none;
    list-style: none;
}
.form-advanced-options > summary::-webkit-details-marker { display: none; }
.form-advanced-options > summary::before { content: '▶ '; font-size: 0.7em; }
.form-advanced-options[open] > summary::before { content: '▼ '; }

.form-advanced-content {
    padding: 0 16px 16px;
}

/* ─── Credentials WordPress par catégorie (collapsible) ─ */
.wp-creds-item {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.wp-creds-item > summary {
    cursor: pointer;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.9rem;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.wp-creds-item > summary::-webkit-details-marker { display: none; }
.wp-creds-item > summary::before { content: '▶ '; font-size: 0.7em; color: var(--text-muted); }
.wp-creds-item[open] > summary::before { content: '▼ '; }

.wp-creds-form {
    padding: 0 14px 14px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* ─── Badge de fiabilité de détection ────────────────── */
.reliability-badge {
    font-size: 0.85rem;
    margin-top: 3px;
    cursor: default;
}

/* ─── Bloc métadonnées produit (historique) ──────────── */
.product-metadata-card h3 {
    margin-bottom: 12px;
}

.metadata-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.metadata-item {
    flex: 1;
    min-width: 200px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 0.85rem;
    line-height: 1.8;
}

.metadata-source {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* ─── Login : centrage labels ───────────────────────── */
.login-form label { text-align: center; }

/* ─── Sidebar : bouton CTA Nouveau produit ───────────── */
.nav-item.nav-item-cta {
    background: rgb(253,192,21);
    font-weight: 700;
    margin: 8px 10px;
    border-radius: var(--radius);
    padding: 10px 16px;
}
.nav-item.nav-item-cta,
.nav-item.nav-item-cta:hover,
.nav-item.nav-item-cta.active { color: #1e293b !important; text-decoration: none; }
.nav-item.nav-item-cta:hover  { background: #f0c005; }
.nav-item.nav-item-cta.active { background: #d4a700; }

.sidebar-sep { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: 4px 0; }

/* ─── Badge promo ───────────────────────────────────── */
.badge-promo { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

/* ─── Section promo (dashboard) ─────────────────────── */
.promo-section {
    background: linear-gradient(135deg, #fef9ee, #fef3c7);
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
}
.promo-section h3 { color: #92400e; margin-bottom: 12px; }

/* ─── Dashboard tout stable ─────────────────────────── */
.dashboard-all-ok {
    text-align: center;
    padding: 32px 20px;
    color: var(--success);
    font-weight: 600;
    font-size: 1.05rem;
}

/* ─── Filtre tabs (page produits) ───────────────────── */
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.83rem;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--surface);
    text-decoration: none;
    transition: all 0.15s;
}
.filter-tab:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-count {
    background: rgba(0,0,0,.1);
    border-radius: 10px;
    padding: 0px 6px;
    font-size: 0.75rem;
}
.filter-tab.active .filter-count { background: rgba(255,255,255,.25); }

/* ─── Analytics ─────────────────────────────────────── */
.analytics-section { margin-top: 24px; }
.analytics-section > h3 {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.analytics-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.analytics-card h4 { font-size: 0.85rem; font-weight: 700; margin-bottom: 12px; }
.analytics-card h4 span { color: var(--text-muted); font-weight: 400; }
.analytics-card-full { grid-column: 1 / -1; }

.analytics-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.analytics-table th {
    text-align: left;
    padding: 5px 8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.analytics-table td { padding: 6px 8px; border-bottom: 1px solid var(--surface-alt); vertical-align: middle; }
.analytics-table tr:last-child td { border-bottom: none; }
.analytics-table .text-right { text-align: right; }

.trends-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.trend-item { text-align: center; padding: 14px 8px; background: var(--surface-alt); border-radius: 6px; border: 1px solid var(--border); }
.trend-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.trend-label { font-size: 0.73rem; color: var(--text-muted); margin-top: 4px; }

.domain-bar-wrap { display: flex; align-items: center; gap: 6px; min-width: 80px; }
.domain-bar-bg { flex: 1; height: 6px; background: var(--surface-alt); border-radius: 3px; overflow: hidden; }
.domain-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

/* ─── Catégories masquées / en pause ───────────────── */
.cat-row-hidden { opacity: 0.55; }
.cat-row-hidden td:first-child { text-decoration: line-through; }
.cat-row-paused { background: #fffbeb; }

/* ─── Bouton icône désactivé ────────────────────────── */
.btn-icon-disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 1rem;
    opacity: 0.3;
    cursor: not-allowed;
}

/* ─── Bouton warning ────────────────────────────────── */
.btn-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning);
}
.btn-warning:hover { background: #fde68a; }

/* ─── Champ avec bouton inline (ex: générer clé) ────── */
.input-with-action {
    display: flex;
    gap: 8px;
    align-items: center;
}
.input-with-action .input {
    flex: 1;
    min-width: 0;
}

/* ─── Section push dashboard ───────────────────────── */
.push-dashboard-section {
    margin-bottom: 24px;
}
.row-push-warn {
    background: #fffbeb;
}
.row-push-warn td:first-child {
    border-left: 3px solid var(--warning);
}

/* ─── Log push (réglages) ───────────────────────────── */
.push-log-block {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: var(--surface-alt);
    font-size: .875rem;
}
.push-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.push-log-stats {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
}
.push-log-notfound {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.push-log-notfound ul {
    margin: 4px 0 6px 16px;
}
.push-log-notfound li { margin-bottom: 2px; }

/* ─── IP serveur (réglages) ─────────────────────────── */
.server-ip-display {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.server-ip-display code {
    font-size: 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: var(--radius);
    color: var(--primary);
}

/* ─── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .hide-mobile {
        display: none !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .history-summary {
        flex-direction: column;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .products-table th,
    .products-table td {
        padding: 8px;
        font-size: 0.82rem;
    }

    .actions-row { gap: 2px; }
    .btn-icon { width: 28px; height: 28px; font-size: 0.9rem; }

    /* Detect / test selector mobile */
    .detect-row { flex-wrap: wrap; }
    .detect-css-row { flex-wrap: wrap; }
    .input-detect-price { width: 100%; flex-shrink: 1; }
    .selector-test-row { flex-wrap: wrap; }
    .test-result { width: 100%; }
    .detection-type-row { grid-template-columns: 1fr; }
    .metadata-grid { flex-direction: column; }
    .analytics-grid { grid-template-columns: 1fr; }
    .trends-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { gap: 4px; }
    .filter-tab { padding: 4px 10px; font-size: 0.78rem; }

    /* News mobile */
    .news-image { width: 70px; height: 55px; }
    .news-card { gap: 10px; padding: 10px; }
    .news-summary { -webkit-line-clamp: 1; }
    .filter-chips { gap: 4px; }
    .chip { padding: 3px 8px; font-size: 0.75rem; }
    .category-card-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 1.4rem; }
}
