/* Essiow Admin CSS */

/* ── Wrap — full width ────────────────────────────── */
.essiow-wrap {
    max-width: 100%;
    margin: 20px 20px 20px 0;
    padding-right: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Force WordPress admin content to use full width */
#wpcontent .essiow-wrap,
#wpbody-content .essiow-wrap {
    width: 100%;
    max-width: none;
}

/* Override WordPress default input/table widths */
.essiow-wrap input[type="text"],
.essiow-wrap input[type="url"],
.essiow-wrap input[type="email"],
.essiow-wrap input[type="password"],
.essiow-wrap input[type="number"],
.essiow-wrap textarea,
.essiow-wrap select,
.essiow-wrap .regular-text {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.essiow-wrap input[type="color"] {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
}

.essiow-wrap table {
    width: 100%;
    table-layout: fixed;
}

.essiow-wrap table th,
.essiow-wrap table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Form layout — labels and inputs side by side on wide screens */
.essiow-wrap .form-table th {
    width: 200px;
    padding: 15px 10px 15px 0;
}

.essiow-wrap .form-table td {
    padding: 10px;
}

/* ── Header ────────────────────────────────────────── */
.essiow-header {
    margin-bottom: 24px;
}

.essiow-header h1 {
    font-size: 23px;
    font-weight: 400;
    margin: 0 0 4px;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
}

.essiow-header p {
    color: #646970;
    margin: 0;
}

/* ── Badges ────────────────────────────────────────── */
.essiow-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    vertical-align: middle;
}

.essiow-badge--version {
    background: #f0f0f1;
    color: #50575e;
}

.essiow-badge--connected {
    background: #d1fae5;
    color: #065f46;
}

.essiow-badge--disconnected {
    background: #fee2e2;
    color: #991b1b;
}

.essiow-badge--optimized {
    background: #dbeafe;
    color: #1e40af;
}

.essiow-badge--pending {
    background: #fef3c7;
    color: #92400e;
}

.essiow-badge--processing {
    background: #e0e7ff;
    color: #3730a3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.essiow-badge--failed {
    background: #fee2e2;
    color: #991b1b;
    cursor: help;
}

/* ── Spinner inline (badge processing, etc.) ─────────────── */
.essiow-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: essiow-spin 0.8s linear infinite;
    vertical-align: -1px;
}
@keyframes essiow-spin {
    to { transform: rotate(360deg); }
}

/* ── Row states (during single + bulk optimize) ──────────── */
tr.essiow-row--processing {
    background: linear-gradient(90deg, #f5f3ff 0%, #fff 100%);
    box-shadow: inset 3px 0 0 #6366f1;
    transition: background 0.3s ease;
}
tr.essiow-row--done {
    background: #f0fdf4;
    box-shadow: inset 3px 0 0 #16a34a;
    animation: essiow-flash-done 1.2s ease-out;
}
tr.essiow-row--failed {
    background: #fef2f2;
    box-shadow: inset 3px 0 0 #dc2626;
}
@keyframes essiow-flash-done {
    0%   { background: #bbf7d0; }
    100% { background: #f0fdf4; }
}

/* ── Inline progress bar in table rows ───────────────────── */
.essiow-row-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    height: 14px;
    position: relative;
    overflow: hidden;
}
.essiow-row-progress__fill {
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.essiow-row-progress__label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #1f2937;
    text-shadow: 0 1px 0 rgba(255,255,255,0.6);
    pointer-events: none;
    white-space: nowrap;
}

/* ── Connection Status ─────────────────────────────── */
.essiow-connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.essiow-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.essiow-dot--green {
    background: #00a32a;
}

.essiow-dot--red {
    background: #d63638;
}

/* ── API Key Input ─────────────────────────────────── */
.essiow-key-input {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 440px;
}

.essiow-key-input input {
    flex: 1;
}

.essiow-key-input .button {
    padding: 0 8px;
    min-height: 30px;
    display: flex;
    align-items: center;
}

/* ── Cards ─────────────────────────────────────────── */
.essiow-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    padding: 20px;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Tables, cards, and grids take full width */
.essiow-wrap .essiow-table,
.essiow-wrap .essiow-card,
.essiow-wrap .essiow-stats,
.essiow-wrap .essiow-grid,
.essiow-wrap .essiow-bulk-bar {
    width: 100%;
    box-sizing: border-box;
}

/* Ensure table container doesn't overflow */
.essiow-wrap .essiow-table {
    table-layout: auto;
}

/* Override WordPress admin narrow content area */
.essiow-wrap * {
    box-sizing: border-box;
}

.essiow-card h2 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.essiow-card h2:first-child {
    margin-top: 0;
}

.essiow-card--link {
    display: block;
    text-decoration: none;
    color: #1d2327;
    transition: border-color 0.15s;
    text-align: center;
    padding: 24px 20px;
}

.essiow-card--link:hover {
    border-color: #2271b1;
    color: #1d2327;
}

.essiow-card--link .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #2271b1;
    margin-bottom: 8px;
}

.essiow-card--link h3 {
    margin: 0 0 4px;
    font-size: 14px;
}

.essiow-card--link p {
    margin: 0;
    color: #646970;
    font-size: 13px;
}

/* ── Grid — quick links fill full width ──────────── */
.essiow-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.essiow-grid > * {
    flex: 1 1 180px;
    min-width: 0;
}

/* ── Stats — stretch to full width ────────────────── */
.essiow-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.essiow-stats > * {
    flex: 1 1 150px;
    min-width: 0;
}

.essiow-stat {
    background: #fff;
    border: 1px solid #c3c4c7;
    padding: 20px;
    text-align: center;
}

.essiow-stat__number {
    display: block;
    font-size: 28px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.2;
}

.essiow-stat__number .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.essiow-stat__label {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: #646970;
}

/* ── Table ─────────────────────────────────────────── */
.essiow-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.essiow-table th,
.essiow-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f1;
    vertical-align: middle;
}

.essiow-table thead th {
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
    border-bottom: 1px solid #c3c4c7;
    background: #f6f7f7;
}

.essiow-table tbody tr:hover {
    background: #f6f7f7;
}

.essiow-table img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* ── Tabs ──────────────────────────────────────────── */
.essiow-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #c3c4c7;
    margin-bottom: 16px;
}

.essiow-tab {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-bottom: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #646970;
    margin-bottom: -1px;
}

.essiow-tab:hover {
    color: #1d2327;
}

.essiow-tab.active {
    border-color: #c3c4c7;
    border-bottom-color: #fff;
    background: #fff;
    color: #1d2327;
    font-weight: 500;
}

.essiow-tab-content {
    display: none;
}

.essiow-tab-content.active {
    display: block;
}

/* ── Modal ─────────────────────────────────────────── */
.essiow-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100100;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.essiow-modal__content {
    background: #fff;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 0;
}

.essiow-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #dcdcde;
}

.essiow-modal__header h3 {
    margin: 0;
    font-size: 16px;
}

.essiow-modal__close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #646970;
    padding: 0;
    line-height: 1;
}

.essiow-modal__close:hover {
    color: #1d2327;
}

.essiow-modal__body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.essiow-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #dcdcde;
}

/* ── Progress Bar ──────────────────────────────────── */
.essiow-progress {
    margin: 12px 0;
}

.essiow-progress__bar {
    width: 100%;
    height: 20px;
    background: #f0f0f1;
    border-radius: 3px;
    overflow: hidden;
}

.essiow-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, #2271b1, #3b82f6);
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
    position: relative;
}
.essiow-progress__fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    animation: essiow-shine 2s linear infinite;
}
@keyframes essiow-shine {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ── Variante carte (article generation) ─────────────────── */
.essiow-progress--card {
    width: 100%;
    height: 24px;
    background: #f0f0f1;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}
.essiow-progress--card .essiow-progress__fill {
    height: 100%;
    border-radius: 4px;
}

/* ── Actions sur les barres (annuler) ────────────────────── */
.essiow-progress-actions {
    margin-top: 6px;
    text-align: right;
}
.essiow-progress-actions .button-link {
    color: #b91c1c;
    text-decoration: underline;
    font-size: 12px;
}
.essiow-progress-actions .button-link:hover {
    color: #7f1d1d;
}

.essiow-progress__fill--indeterminate {
    width: 30%;
    animation: essiow-indeterminate 1.5s infinite ease-in-out;
}

@keyframes essiow-indeterminate {
    0% { margin-left: 0; }
    50% { margin-left: 70%; }
    100% { margin-left: 0; }
}

.essiow-progress__text {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: #646970;
}

/* ── Bulk Bar ──────────────────────────────────────── */
.essiow-bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── SEO Score ─────────────────────────────────────── */
.essiow-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.essiow-score--low {
    background: #d63638;
}

.essiow-score--medium {
    background: #dba617;
}

.essiow-score--high {
    background: #00a32a;
}

/* ── Toasts ────────────────────────────────────────── */
.essiow-toast {
    position: fixed;
    top: 40px;
    right: 20px;
    z-index: 100200;
    padding: 12px 20px;
    border-left: 4px solid;
    background: #fff;
    border-color: #00a32a;
    color: #1d2327;
    font-size: 13px;
    max-width: 400px;
    animation: essiow-slide-in 0.3s ease;
}

.essiow-toast--error {
    border-color: #d63638;
}

@keyframes essiow-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Loading spinner ───────────────────────────────── */
.essiow-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f0f0f1;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: essiow-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-left: 4px;
}

@keyframes essiow-spin {
    to { transform: rotate(360deg); }
}

/* ── Color picker fix ──────────────────────────────── */
.essiow-color-picker {
    vertical-align: middle;
}

/* ── Responsive ────────────────────────────────────── */
@media screen and (max-width: 782px) {
    .essiow-wrap {
        margin: 10px;
    }

    .essiow-stats,
    .essiow-grid {
        grid-template-columns: 1fr 1fr;
    }

    .essiow-modal__content {
        width: 98%;
        max-height: 95vh;
    }

    .essiow-bulk-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .essiow-table {
        font-size: 12px;
    }

    .essiow-table th,
    .essiow-table td {
        padding: 6px 8px;
    }
}

@media screen and (max-width: 480px) {
    .essiow-stats,
    .essiow-grid {
        grid-template-columns: 1fr;
    }
}

/* ════════════════════════════════════════════════════════════
   SEARCH CONSOLE
   ════════════════════════════════════════════════════════════ */

/* ── Tabs nav ───────────────────────────────────────────────── */
.essiow-tabs-nav {
    display: flex;
    gap: 4px;
    margin: 16px 0 0;
    border-bottom: 1px solid #c3c4c7;
    overflow-x: auto;
}
.essiow-tabs-nav .essiow-tab {
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #2c3338;
    border-radius: 4px 4px 0 0;
    margin-bottom: -1px;
}
.essiow-tabs-nav .essiow-tab:hover {
    background: #f0f0f1;
}
.essiow-tabs-nav .essiow-tab.active {
    background: #fff;
    border-color: #c3c4c7;
    border-bottom-color: #fff;
    font-weight: 600;
    color: #1d2327;
}

/* ── KPIs grid ─────────────────────────────────────────────── */
.essiow-kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 20px 0;
}
.essiow-kpi {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 16px;
}
.essiow-kpi__label {
    color: #646970;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.essiow-kpi__value {
    font-size: 26px;
    font-weight: 700;
    color: #1d2327;
}
.essiow-kpi__delta {
    margin-top: 4px;
    font-size: 12px;
}
.essiow-delta--pos { color: #008a20; }
.essiow-delta--neg { color: #cc1818; }

/* ── Indexation badges ─────────────────────────────────────── */
.essiow-index-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}
.essiow-index-badge--ok   { background: #d1fae5; color: #065f46; }
.essiow-index-badge--warn { background: #fef3c7; color: #92400e; }
.essiow-index-badge--err  { background: #fee2e2; color: #991b1b; }
.essiow-index-badge--unk  { background: #f3f4f6; color: #6b7280; }

/* ── Indexation stats list ─────────────────────────────────── */
.essiow-indexation-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.essiow-index-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 4px;
}
.essiow-index-stat strong { font-size: 16px; }
.essiow-index-stat small { color: #646970; }

/* ── Daily chart (CSS-only bars) ────────────────────────────── */
.essiow-chart {
    margin-top: 12px;
    min-height: 160px;
}
.essiow-chart__placeholder {
    color: #646970;
    font-style: italic;
    text-align: center;
    padding: 40px 0;
}
.essiow-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 140px;
    padding: 4px 0;
    background: linear-gradient(to top, #f9fafb 0%, transparent 100%);
}
.essiow-bar {
    flex: 1;
    position: relative;
    height: 100%;
    min-width: 4px;
}
.essiow-bar__impr {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, #93c5fd, #3b82f6);
    border-radius: 2px 2px 0 0;
}
.essiow-bar__clicks {
    position: absolute;
    bottom: 0;
    left: 25%;
    right: 25%;
    background: #1d4ed8;
    border-radius: 2px 2px 0 0;
}
.essiow-chart-legend {
    margin-top: 8px;
    font-size: 12px;
    color: #646970;
}
.essiow-chart-legend__impr::before { content: '■ '; color: #3b82f6; }
.essiow-chart-legend__clicks::before { content: '■ '; color: #1d4ed8; }

/* ── 2-column grid pour top queries / pages ─────────────────── */
.essiow-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
}

/* ── Striking distance row ─────────────────────────────────── */
.essiow-row-striking {
    background: linear-gradient(90deg, #fff7ed 0%, transparent 100%);
}

/* ── Pagination ────────────────────────────────────────────── */
.essiow-pagination {
    margin-top: 12px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* ── Indexing submitted button state ──────────────────────── */
.essiow-indexing-submitted {
    background: #16a34a !important;
    color: #fff !important;
    border-color: #15803d !important;
    cursor: default;
    opacity: 0.85;
}

/* ── Indexation status pills (Indexation column) ─────────── */
.essiow-idx {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.essiow-idx--indexed     { background: #dcfce7; color: #166534; }
.essiow-idx--not-indexed { background: #fef3c7; color: #92400e; }
.essiow-idx--excluded    { background: #fee2e2; color: #991b1b; }
.essiow-idx--unknown     { background: #f3f4f6; color: #6b7280; }
.essiow-idx--requested   { background: #dbeafe; color: #1e40af; }

/* ── Internal links graph (wrapper — canvas takes its own height) ─ */
.essiow-graph {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
    position: relative;
    overflow: hidden;
}
.essiow-graph__node {
    position: absolute;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.essiow-graph__node--orphan { border-color: #dc2626; background: #fef2f2; }
.essiow-graph__node--hub    { border-color: #16a34a; background: #f0fdf4; font-weight: 600; }
.essiow-graph__node--selected { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3); border-color: #2563eb; }

/* ── Article quick-score badge ────────────────────────────── */
.essiow-score {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 11px;
}
.essiow-score--good { background: #dcfce7; color: #166534; }
.essiow-score--mid  { background: #fef3c7; color: #92400e; }
.essiow-score--low  { background: #fee2e2; color: #991b1b; }

/* ── Cannibalization rows ───────────────────────────────────── */
.essiow-cannibal-row-primary td:first-child {
    background: linear-gradient(90deg, #f0fdf4 0%, transparent 100%);
    font-weight: 600;
}
.essiow-cannibal-row-secondary {
    transition: opacity 200ms ease, background 200ms ease;
}
.essiow-cannibal-row-secondary:hover {
    background: #fef9c3;
}
.essiow-cannibal-bulkbar label {
    cursor: pointer;
}

/* ── Floating optim panel (re-optimize live progress) ──────── */
.essiow-optim-panel {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 380px;
    max-height: 60vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    z-index: 99999;
    display: none;
    transition: max-height 200ms ease;
}
.essiow-optim-panel--minimized .essiow-optim-panel__list {
    display: none;
}
.essiow-optim-panel--minimized {
    max-height: 50px;
}
.essiow-optim-panel__header {
    padding: 10px 14px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    border-radius: 8px 8px 0 0;
}
.essiow-optim-panel__minimize {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6b7280;
}
.essiow-optim-panel__list {
    padding: 8px;
}
.essiow-optim-row {
    padding: 10px;
    border-bottom: 1px solid #f3f4f6;
}
.essiow-optim-row:last-child {
    border-bottom: none;
}
.essiow-optim-row__title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 6px;
}
.essiow-optim-row__name {
    font-weight: 600;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.essiow-optim-row__status {
    color: #6b7280;
    font-size: 11px;
}
.essiow-optim-row__actions {
    margin-top: 6px;
    display: flex;
    gap: 4px;
}

/* ── Internal links Miro-like graph ───────────────────────── */
.essiow-graph-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}
.essiow-graph-canvas {
    position: relative;
    width: 100%;
    height: 600px;
    overflow: hidden;
    background:
        repeating-linear-gradient(0deg, transparent 0, transparent 24px, #f1f5f9 24px, #f1f5f9 25px),
        repeating-linear-gradient(90deg, transparent 0, transparent 24px, #f1f5f9 24px, #f1f5f9 25px),
        #fafafa;
    cursor: grab;
    user-select: none;
}
.essiow-graph-canvas:active { cursor: grabbing; }
.essiow-graph-edges {
    position: absolute;
    inset: 0;
    pointer-events: none;
    width: 100%;
    height: 100%;
}
.essiow-graph-world {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
}
.essiow-graph-status {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    background: rgba(255,255,255,0.95);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #2563eb;
    font-size: 13px;
    pointer-events: none;
}
.essiow-graph__node {
    position: absolute;
    cursor: pointer;
}
.essiow-graph__node--target {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.4);
}
.essiow-graph__node-stats {
    font-size: 9px;
    color: #6b7280;
    margin-left: 4px;
}
.essiow-graph-score {
    margin-top: 16px;
}
.essiow-graph-score__panel {
    padding: 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.essiow-graph-score__panel h3 { margin: 0 0 8px; }
.essiow-graph-score__big {
    display: inline-block;
    font-size: 24px;
    padding: 8px 16px;
    border-radius: 8px;
}

/* ── Floating help link on every Essiow page ──────────────── */
.essiow-wrap .essiow-header {
    position: relative;
}
.essiow-help-link {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 4px 8px;
    text-decoration: none;
    font-size: 12px;
    color: #374151;
}
.essiow-help-link:hover {
    background: #f9fafb;
    color: #111827;
}

/* ── Universal busy state for any button + spinner inline ─── */
.essiow-btn-busy {
    pointer-events: none;
    opacity: 0.85;
    position: relative;
}
.essiow-btn-busy::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: essiow-spin 0.7s linear infinite;
    vertical-align: -1px;
}

/* ── Mesh score panel — proper layout ─────────────────────── */
.essiow-mesh-panel {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 24px;
    align-items: start;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-top: 16px;
}
.essiow-mesh-panel__big {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-radius: 12px;
}
.essiow-mesh-panel__big--good { background: #dcfce7; color: #166534; }
.essiow-mesh-panel__big--mid  { background: #fef3c7; color: #92400e; }
.essiow-mesh-panel__big--low  { background: #fee2e2; color: #991b1b; }
.essiow-mesh-panel__score {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}
.essiow-mesh-panel__total {
    font-size: 14px;
    opacity: 0.7;
    margin-top: 4px;
}
.essiow-mesh-panel__factors {
    list-style: none;
    padding: 0;
    margin: 0;
}
.essiow-mesh-panel__factors li {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
}
.essiow-mesh-panel__factors li:last-child {
    border-bottom: none;
}
.essiow-mesh-panel__factor-pts {
    color: #6b7280;
    font-weight: 600;
    font-size: 12px;
}

/* ── Graph node link handle + hover target ──────────────── */
.essiow-graph__node-handle {
    display: inline-flex;       /* 1.1.53 — toujours visible (pas seulement au hover) */
    position: absolute;
    right: -10px;
    top: -10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(37,99,235,0.45);
    z-index: 6;
    opacity: 0.55;
    transition: opacity 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.essiow-graph__node:hover .essiow-graph__node-handle,
.essiow-graph__node--focused .essiow-graph__node-handle {
    opacity: 1;
    transform: scale(1.18);
    box-shadow: 0 4px 12px rgba(37,99,235,0.6);
}
.essiow-graph__node-handle:active { cursor: grabbing; }
.essiow-graph__node--hover-target {
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.55) !important;
    transform: scale(1.05);
    transition: transform 100ms ease, box-shadow 100ms ease;
    border-color: #16a34a !important;
}

/* ── Node refresh : icone + titre + stats sur 2 lignes pour lisibilité (1.1.53) ── */
.essiow-graph__node {
    min-width: 90px;
    max-width: 220px;
    padding: 6px 12px 6px 8px;
    line-height: 1.25;
    display: inline-block;
    transition: transform 100ms ease, box-shadow 120ms ease;
}
.essiow-graph__node:hover {
    z-index: 4;
    box-shadow: 0 4px 10px rgba(0,0,0,0.10);
    transform: translateY(-1px);
}
.essiow-graph__node-icon {
    margin-right: 4px;
}
.essiow-graph__node-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 160px;
    vertical-align: middle;
}
.essiow-graph__node--no-label .essiow-graph__node-title {
    display: none;
}
.essiow-graph__node--no-label {
    min-width: auto;
    padding: 4px 6px;
}
.essiow-graph__node--focused {
    box-shadow: 0 0 0 3px #2563eb, 0 4px 14px rgba(37,99,235,0.35);
    border-color: #2563eb;
    z-index: 3;
}

/* ── Edges (1.1.53) ──────────────────────────────────── */
.essiow-graph-edges {
    /* le SVG global laisse passer les events MAIS on override sur les lines */
    pointer-events: none;
}
.essiow-graph-edge {
    pointer-events: none;
    transition: stroke-opacity 120ms ease;
}
.essiow-graph-edge.is-focus {
    pointer-events: stroke;
    cursor: pointer;
}
.essiow-graph-edge-hit {
    /* Hitbox transparente plus large pour le clic (l'humain ne sait pas
       cliquer une ligne d'1px). Pointer-events activé sur stroke. */
    pointer-events: stroke;
    cursor: pointer;
}
.essiow-graph-edge-hit:hover ~ .essiow-graph-edge,
.essiow-graph-edge-group:hover .essiow-graph-edge {
    stroke: #dc2626 !important;
    stroke-opacity: 1 !important;
    stroke-width: 3 !important;
}

/* ── Toolbar amélioré (filtres + toggle labels) (1.1.53) ── */
.essiow-graph-toolbar__sep {
    width: 1px;
    height: 20px;
    background: #d1d5db;
    margin: 0 6px;
}
.essiow-graph-filter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}
.essiow-graph-filter:hover {
    background: #eef2ff;
}
.essiow-graph-filter input {
    margin: 0;
}

/* ── Légende (1.1.53) ──────────────────────────────── */
.essiow-graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 8px 12px;
    background: #fafafa;
    border-bottom: 1px solid #e5e7eb;
    font-size: 12px;
    color: #4b5563;
}
.essiow-graph-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.essiow-graph-legend__dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #d1d5db;
}
.essiow-graph-legend__dot--orphan { background: #fef2f2; border-color: #dc2626; }
.essiow-graph-legend__dot--hub    { background: #f0fdf4; border-color: #16a34a; }

/* ── Focus panel : détails du node sélectionné (1.1.53) ── */
.essiow-graph-status {
    pointer-events: auto;       /* override : les liens du focus doivent être cliquables */
}
.essiow-graph-focus__title {
    font-size: 14px;
    margin-bottom: 4px;
}
.essiow-graph-focus__url {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
    word-break: break-all;
}
.essiow-graph-focus__url a { color: #2563eb; text-decoration: none; }
.essiow-graph-focus__url a:hover { text-decoration: underline; }
.essiow-graph-focus__stats {
    font-size: 12px;
    margin-bottom: 4px;
    color: #4b5563;
}
.essiow-graph-focus__hint {
    font-size: 11px;
    color: #6b7280;
    font-style: italic;
}

/* ── Global site SEO score on dashboard ──────────────────── */
.essiow-site-score__layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
    margin-top: 12px;
}
.essiow-site-score__big {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}
.essiow-site-score__big--good { background: #dcfce7; color: #166534; }
.essiow-site-score__big--mid  { background: #fef3c7; color: #92400e; }
.essiow-site-score__big--low  { background: #fee2e2; color: #991b1b; }
.essiow-site-score__value {
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
}
.essiow-site-score__total {
    font-size: 16px;
    opacity: 0.7;
    margin-top: 4px;
}
.essiow-site-score__factors {
    list-style: none;
    padding: 0;
    margin: 0;
}
.essiow-site-score__factors li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
}
.essiow-site-score__factors li:last-child { border-bottom: none; }
.essiow-site-score__pts {
    color: #6b7280;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    margin-left: 12px;
}
@media (max-width: 768px) {
    .essiow-site-score__layout { grid-template-columns: 1fr; }
}

/* ── Site SEO score as a stat card variant ───────────────── */
.essiow-stat--score {
    border-top: 4px solid #d1d5db;
}
.essiow-stat--score-good { border-top-color: #16a34a; }
.essiow-stat--score-mid  { border-top-color: #f59e0b; }
.essiow-stat--score-low  { border-top-color: #dc2626; }
.essiow-stat--score-good .essiow-stat__number { color: #166534; }
.essiow-stat--score-mid  .essiow-stat__number { color: #92400e; }
.essiow-stat--score-low  .essiow-stat__number { color: #991b1b; }
.essiow-stat__suffix {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.6;
    margin-left: 2px;
}

/* ── Automesh banner above the graph ─────────────────────── */
.essiow-automesh-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ede9fe 0%, #f0fdf4 100%);
    border: 1px solid #c4b5fd;
    border-radius: 8px;
    flex-wrap: wrap;
}
.essiow-automesh-banner__text {
    flex: 1;
    min-width: 280px;
    line-height: 1.5;
    font-size: 14px;
}
.essiow-automesh-banner__text strong {
    font-size: 16px;
    color: #5b21b6;
}
.essiow-automesh-banner .button-hero {
    white-space: nowrap;
    background: linear-gradient(135deg, #7c3aed 0%, #16a34a 100%);
    border-color: #6d28d9;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}
.essiow-automesh-banner .button-hero:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #15803d 100%);
    color: #fff;
}
