/* ═══════════════════════════════════════════════
   Glance Live Search — Admin UI
   Color: Bleu (#123375) / Violet (#645fe5)
   ═══════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════
   SVG ISOLATION — protection against themes / plugins
   ══════════════════════════════════════════════════ */

/* Prevents global theme rules (max-width:100%, height:auto) from
   breaking inline icon dimensions in our admin interface.
   Scoped to plugin containers — does NOT affect WP notices. */
.glse-header svg,
.glse-card svg,
.glse-sidebar svg {
    display: inline-block;
    max-width: none !important;
    max-height: none !important;
    overflow: visible;
    vertical-align: middle;
}

/* Prevents "svg { fill: currentColor }" or "svg * { fill: inherit }" rules
   common in themes from filling our stroke-only icons. */
.glse-header svg[fill="none"],
.glse-card svg[fill="none"],
.glse-sidebar svg[fill="none"],
.glse-header svg[fill="none"] *,
.glse-card svg[fill="none"] *,
.glse-sidebar svg[fill="none"] * {
    fill: none !important;
}

/* Precise size and display for nav icons */
.glse-nav-icon svg {
    display: block;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0;
}

/* ══════════════════════
   PRO BADGES & LOCKS
   ══════════════════════ */

.glse-pro-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #fff;
    background: var(--glse-secondary);
    border-radius: 4px;
    padding: 1px 6px;
    vertical-align: middle;
    line-height: 1.5;
}

.glse-pro-locked {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--glse-text-secondary);
    margin-top: 4px;
}

.glse-pro-locked a {
    color: var(--glse-secondary);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.glse-pro-locked a:hover { text-decoration: underline; }

/* Locked preset cards */
.glse-preset-card--locked { opacity: .55; cursor: not-allowed; }
.glse-preset-preview--locked { position: relative; }
.glse-preset-lock-icon {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: rgba(0,0,0,.45);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

/* ── Sous-section (ex: Mobile dans Comportement) ── */
.glse-subsection {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.glse-subsection-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px;
    padding: 0;
}

.glse-subsection-title svg {
    color: #646970;
    flex-shrink: 0;
}

/* ══════════════════════
   LICENCE PANEL
   ══════════════════════ */

.glse-license-panel { max-width: 680px; padding: 4px 0; }

/* License notices — uses WP native .notice .notice-success / .notice-info / .notice-error */
.glse-license-panel .notice {
    margin: 0 0 18px;
}

.glse-license-status-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--glse-surface);
    border: 1px solid var(--glse-border);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 22px;
}

.glse-license-status-icon { flex-shrink: 0; margin-top: 2px; }

.glse-license-status-text strong { font-size: 15px; color: var(--glse-text-primary); }
.glse-license-status-text p { margin: 4px 0 0; font-size: 13px; color: var(--glse-text-secondary); }
.glse-license-compare h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--glse-text-primary);
    margin-bottom: 14px;
}

/* License compare table — uses WP .widefat */
.glse-license-compare-table th:not(:first-child),
.glse-license-compare-table td:not(:first-child) {
    text-align: center;
    width: 110px;
}
.glse-compare-yes  { color: #16a34a; font-weight: 600; }
.glse-compare-no   { color: #9ca3af; }
.glse-compare-text { color: var(--glse-text-secondary); font-size: 12px; }

/* Statut Pro actif */
.glse-license-status-card--active {
    border-color: #86efac;
    background: #f0fdf4;
}

.glse-license-cta {
    margin-top: 22px;
    text-align: center;
    padding: 24px 18px;
    background: var(--glse-accent-light);
    border-radius: 10px;
}

.glse-license-cta-headline {
    font-size: 15px;
    font-weight: 700;
    color: var(--glse-text-primary);
    margin: 0 0 6px;
}

.glse-license-cta-price {
    font-size: 12px;
    color: var(--glse-text-secondary);
    margin: 0 0 16px;
}

.glse-license-cta .button-primary {
    background: var(--glse-accent) !important;
    border-color: var(--glse-accent-hover) !important;
    font-size: 14px !important;
    padding: 8px 24px !important;
    height: auto !important;
}

.glse-license-activate-hint {
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--glse-text-secondary);
}

.glse-license-activate-link {
    color: var(--glse-accent);
    text-decoration: none;
    font-weight: 600;
}

.glse-license-activate-link:hover {
    text-decoration: underline;
    color: var(--glse-accent-hover);
}

/* ══════════════════════
   SIDEBAR UPGRADE CTA
   ══════════════════════ */

.glse-sidebar-card.glse-sidebar-upgrade-card {
    background: var(--glse-accent);
    border: none;
    color: #fff;
    padding: 18px;
}

.glse-sidebar-upgrade-badge {
    margin-bottom: 10px;
}

.glse-sidebar-card.glse-sidebar-upgrade-card .glse-pro-badge {
    background: rgba(255,255,255,.25);
    font-size: 11px;
    padding: 2px 8px;
}

.glse-sidebar-upgrade-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px;
    line-height: 1.35;
}

.glse-sidebar-upgrade-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    font-size: 12px;
    color: rgba(255,255,255,.85);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.glse-sidebar-card.glse-sidebar-upgrade-card .description {
    color: rgba(255,255,255,.85);
    font-size: 12.5px;
    margin: 0 0 16px;
}

.glse-sidebar-upgrade-btn {
    display: block;
    text-align: center;
    background: #fff;
    color: var(--glse-accent) !important;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 12px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: background .15s, color .15s;
}

.glse-sidebar-upgrade-btn:hover {
    background: var(--glse-accent-light);
    color: var(--glse-accent-hover) !important;
}

:root {
    --glse-accent: #123375;
    --glse-secondary: #645fe5;
    --glse-accent-hover: #0d2560;
    --glse-accent-light: #e6ecf7;
    --glse-accent-medium: #8fa8d8;
    --glse-accent-text: #123375;
    --glse-accent-glow: rgba(18,51,117,.15);
    --glse-accent-glow-strong: rgba(18,51,117,.25);
    --glse-surface: #ffffff;
    --glse-border: #dde3ef;
    --glse-border-light: #edf0f7;
    --glse-text-primary: #0e1830;
    --glse-text-secondary: #4a5570;
    --glse-text-muted: #8a93a8;
}


/* ── Reset — scoped to plugin UI containers, not WP notices ── */
.glse-wrap { max-width: none; margin-right: 20px; }
.glse-header *,
.glse-card *,
.glse-sidebar * { box-sizing: border-box; }
.glse-header h1, .glse-header h2, .glse-header h3,
.glse-card h1, .glse-card h2:not(.hndle), .glse-card h3,
.glse-sidebar h1, .glse-sidebar h2, .glse-sidebar h3 { margin: 0; padding: 0; }

/* ══════════════════════
   HEADER
   ══════════════════════ */
.glse-header {
    position: relative;
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--glse-surface);
    border: 1px solid var(--glse-border);
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 2px 8px rgba(18,51,117,.04);
}

.glse-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
}

.glse-header-brand {
    display: flex;
    align-items: center;
}

.glse-header-logo {
    height: 44px;
    width: auto;
    display: block;
}

.glse-header-upgrade-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--glse-accent);
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: background .15s;
    line-height: 1;
}
.glse-header-upgrade-btn:hover {
    background: var(--glse-accent-hover);
    color: #fff !important;
}
.glse-header-upgrade-btn svg {
    flex-shrink: 0;
}

/* ══════════════════════
   LAYOUT
   ══════════════════════ */
.glse-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* ══════════════════════
   MAIN CARD
   ══════════════════════ */
.glse-card {
    flex: 1 1 0%;
    min-width: 0;
    background: var(--glse-surface);
    border: 1px solid var(--glse-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 2px 8px rgba(18,51,117,.04);
    overflow: hidden;
}

.glse-card-inner {
    display: flex;
    min-height: 480px;
}

/* ── Vertical Nav ── */
.glse-nav {
    width: 210px;
    flex-shrink: 0;
    padding: 16px 12px;
    background: #f3f7fc;
    border-right: 1px solid var(--glse-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.glse-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--glse-text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s ease;
    border: 1px solid transparent;
}

.glse-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: .6;
    transition: opacity .15s;
}
.glse-nav-icon svg { width: 18px; height: 18px; }

.glse-nav-item:hover {
    background: var(--glse-accent-light);
    color: var(--glse-accent-text);
}
.glse-nav-item:hover .glse-nav-icon { opacity: .9; }

.glse-nav-item--active {
    background: var(--glse-accent-light);
    color: var(--glse-accent-text);
    font-weight: 600;
    border-color: var(--glse-accent-medium);
    box-shadow: 0 0 0 1px var(--glse-accent-glow);
}
.glse-nav-item--active .glse-nav-icon {
    opacity: 1;
    color: var(--glse-accent);
}

/* ── Content area ── */
.glse-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.glse-settings-form {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Panel header ── */
.glse-panel-header {
    padding: 20px 28px 0;
}
.glse-panel-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--glse-text-primary);
    letter-spacing: -.01em;
}

/* ── Tab panels ── */
.glse-tab-panel { display: none; flex: 1; padding: 0 28px 12px; }
.glse-tab-panel--active {
    display: block;
    animation: glseFadeIn .2s ease;
}

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

@media (prefers-reduced-motion: reduce) {
    .glse-tab-panel {
        animation: none !important;
    }
}

/* ── Form table — minimal overrides on top of WP native .form-table ── */
.glse-tab-panel .form-table { margin: 0; }
.glse-tab-panel .form-table th { vertical-align: middle; }
.glse-tab-panel .form-table td { vertical-align: middle; }

/* ── Inputs — only color picker needs custom styling, rest uses WP native ── */
.glse-tab-panel input[type="color"] {
    width: 38px; height: 34px;
    padding: 3px;
    border: 1px solid var(--glse-border);
    border-radius: 8px;
    cursor: pointer;
    vertical-align: middle;
}
.glse-tab-panel label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* ── Design preset cards ── */
.glse-preset-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 4px 0 8px;
}
.glse-preset-card {
    flex: 0 0 auto;
    width: 136px;
    border: 2px solid var(--glse-border);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s, transform .12s;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.glse-preset-card:hover {
    border-color: var(--glse-accent-medium);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(18,51,117,.1);
}
.glse-preset-card--active {
    border-color: var(--glse-accent);
    box-shadow: 0 0 0 3px var(--glse-accent-glow);
}
.glse-preset-card--active .glse-preset-name {
    color: var(--glse-accent);
}
.glse-preset-card input[type="radio"] {
    display: none !important;
    width: auto; height: auto;
    background: none; border: none;
    border-radius: 0;
}
.glse-preset-card input[type="radio"]::after { display: none; }
.glse-preset-preview {
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
}
.glse-preset-bar {
    display: flex;
    align-items: center;
    padding: 0 5px 0 9px;
    height: 28px;
    width: 100%;
    gap: 5px;
    background: #fff;
}
.glse-preset-bar-ph {
    flex: 1;
    font-size: 8.5px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
}
.glse-preset-bar-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.glse-preset-custom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0 0;
    color: var(--glse-accent);
    opacity: .5;
}
.glse-preset-card--active .glse-preset-custom-icon { opacity: 1; }
.glse-preset-name {
    text-align: center;
    padding: 5px 6px 2px;
    font-size: 11.5px;
    font-weight: 700;
    border-top: 1px solid var(--glse-border-light);
    color: var(--glse-text-primary);
}
.glse-preset-desc {
    text-align: center;
    padding: 0 6px 7px;
    font-size: 9.5px;
    color: var(--glse-text-muted);
    line-height: 1.3;
}

/* ── Override label styles inside preset grid ── */
.glse-tab-panel .glse-preset-grid label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    font-size: inherit;
    color: inherit;
}

/* ── Toggle switches ── */
.glse-tab-panel input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 40px; height: 22px;
    background: #d1cdd8;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s;
}
.glse-tab-panel input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    transition: transform .2s cubic-bezier(.175,.885,.32,1.275);
}
.glse-tab-panel input[type="checkbox"]:checked {
    background: var(--glse-accent);
}
.glse-tab-panel input[type="checkbox"]:checked::after {
    transform: translateX(18px);
}
.glse-tab-panel input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px var(--glse-accent-glow-strong);
    outline: none;
}

/* ── Save footer — uses WP .button .button-primary ── */
.glse-form-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--glse-border);
    background: #f3f7fc;
    margin-top: auto;
}
.glse-form-footer .button-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.glse-spin {
    display: inline-block;
    animation: glseBtnSpin .7s linear infinite;
    vertical-align: middle;
}
@keyframes glseBtnSpin { to { transform: rotate(360deg); } }

/* ══════════════════════
   SIDEBAR
   ══════════════════════ */
.glse-sidebar {
    width: 260px;
    flex: 0 0 260px;
    position: sticky;
    top: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.glse-sidebar-card {
    background: var(--glse-surface);
    border: 1px solid var(--glse-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    overflow: hidden;
}

.glse-sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-size: 12px;
    font-weight: 700;
    color: var(--glse-text-primary);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--glse-border-light);
    background: #f3f7fc;
}
.glse-sidebar-header svg { color: var(--glse-accent); flex-shrink: 0; }

.glse-sidebar-body { padding: 14px 18px; }

.glse-sidebar-label {
    margin: 10px 0 5px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--glse-text-muted);
}
.glse-code-block {
    background: var(--glse-accent-light);
    border: 1px solid var(--glse-accent-medium);
    border-radius: 8px;
    padding: 9px 14px;
    margin-bottom: 4px;
}
.glse-code-block code {
    font-size: 12px;
    color: var(--glse-accent-text);
    background: none; border: none; padding: 0;
    word-break: break-all;
    font-weight: 500;
}

/* ══════════════════════
   RESPONSIVE
   ══════════════════════ */

/* ── Tablet ≤ 1200px ── */
@media (max-width: 1200px) {
    .glse-layout { flex-direction: column; }
    .glse-header,
    .glse-card,
    .glse-sidebar { width: 100%; }
    .glse-card { flex: 0 0 auto; }
    .glse-sidebar {
        flex: 0 0 auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }
    .glse-sidebar-card { flex: 1 1 auto; min-width: 0; }
}

/* ── WP Mobile ≤ 782px ── */
@media (max-width: 782px) {

    /* Wrap spacing */
    .glse-wrap { margin-right: 10px; margin-left: 0; }
    .glse-layout { gap: 16px; }

    /* Header — wrap badge on small widths */
    .glse-header { border-radius: 10px; margin-bottom: 18px; }
    .glse-header-inner {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .glse-header-logo { height: 36px; }

    /* Card — full width, auto height */
    .glse-header,
    .glse-card {
        width: 100%;
        flex: 0 0 auto;
        border-radius: 10px;
    }
    .glse-card-inner {
        flex-direction: column;
        min-height: auto;
    }

    /* Nav — horizontal scrollable pills */
    .glse-nav {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--glse-border);
        padding: 8px 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
    }
    .glse-nav::-webkit-scrollbar { display: none; }
    .glse-nav-item {
        white-space: nowrap;
        padding: 9px 14px;
        border-radius: 8px;
        min-height: 40px;
    }
    .glse-nav-label { font-size: 12px; }

    /* Content panels */
    .glse-tab-panel { padding: 0 16px 12px; }
    .glse-panel-header { padding: 14px 16px 0; }
    .glse-panel-header h2 { font-size: 14px; }

    /* Form table — stack label/input vertically */
    .glse-tab-panel .form-table th {
        display: block;
        width: 100%;
        padding: 12px 0 2px 0;
    }
    .glse-tab-panel .form-table td {
        display: block;
        padding: 4px 0 10px 0;
    }

    /* Toggles — bigger for touch (44px tap target) */
    .glse-tab-panel input[type="checkbox"] {
        width: 44px; height: 24px;
    }
    .glse-tab-panel input[type="checkbox"]::after {
        width: 18px; height: 18px;
    }
    .glse-tab-panel input[type="checkbox"]:checked::after {
        transform: translateX(20px);
    }

    /* Save button — full width */
    .glse-form-footer { padding: 14px 16px; }
    .glse-form-footer .button-primary {
        width: 100%;
        justify-content: center;
    }

    /* Sidebar — stack full width auto */
    .glse-sidebar {
        width: 100%;
        flex: 0 0 auto;
        flex-direction: column;
        gap: 12px;
        position: static;
    }
    .glse-sidebar-card {
        width: 100%;
        min-width: 0;
        flex: 0 0 auto;
    }
}

/* ── Small phones ≤ 480px ── */
@media (max-width: 480px) {
    .glse-wrap { margin-right: 6px; }

    /* Header compact */
    .glse-header { border-radius: 8px; margin-bottom: 14px; }
    .glse-header-inner { padding: 12px 14px; }
    .glse-header-logo { height: 30px; }

    .glse-header,
    .glse-card { width: 100%; border-radius: 8px; }

    /* Nav — icon-only mode */
    .glse-nav { padding: 6px 8px; justify-content: center; overflow-x: visible; }
    .glse-nav-item { padding: 10px 14px; gap: 0; }
    .glse-nav-label { display: none; }
    .glse-nav-icon { width: 22px; height: 22px; }
    .glse-nav-icon svg { width: 20px; height: 20px; }

    /* Tighter content padding */
    .glse-tab-panel { padding: 0 12px 10px; }
    .glse-panel-header { padding: 12px 12px 0; }
    .glse-panel-header h2 { font-size: 13px; }
    .glse-form-footer { padding: 12px; }

    /* Color picker — ensure hex code wraps */
    .glse-tab-panel input[type="color"] { width: 34px; height: 30px; }
    .glse-tab-panel code { font-size: 11px; }

    /* Sidebar compact */
    .glse-code-block { padding: 7px 10px; }
    .glse-code-block code { font-size: 11px; }
    .glse-sidebar-body { padding: 10px 14px; }
    .glse-sidebar-header { padding: 12px 14px; font-size: 11px; }
}

/* ══════════════════════
   ANALYTICS PANEL
   — Uses WP native: .postbox, .widefat, .tablenav, .notice, .button
   ══════════════════════ */

.glse-analytics-wrap {
    padding: 4px 0 16px;
}

/* Postboxes inside analytics panel */
.glse-analytics-wrap .postbox { margin-bottom: 20px; }
.glse-analytics-wrap .postbox .hndle { cursor: default; }

/* Two-column grid for Keywords + No Results */
.glse-analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.glse-analytics-grid .postbox { margin-bottom: 0; }

@media (max-width: 900px) {
    .glse-analytics-grid { grid-template-columns: 1fr; }
}


