/* ═══════════════════════════════════════════════
   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;
}

/* ── 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;
}

: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;
}

/* ══════════════════════
   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-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;
    background-image: none;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s;
    color: transparent;
    font-size: 0;
    line-height: 0;
}
.glse-tab-panel input[type="checkbox"]::before {
    display: none !important;
}
.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);
    background-image: none;
}
.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; }
}

/* ══════════════════════
   NAV — PRO CTA ITEM
   ══════════════════════ */

.glse-nav-item--cta {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--glse-border);
    color: var(--glse-secondary);
    font-weight: 600;
}
.glse-nav-item--cta .glse-nav-icon { color: var(--glse-secondary); opacity: .8; }
.glse-nav-item--cta:hover {
    background: #f0eeff;
    color: var(--glse-secondary);
}
.glse-nav-item--cta:hover .glse-nav-icon { opacity: 1; }
.glse-nav-item--cta.glse-nav-item--active {
    background: #ece9ff;
    color: var(--glse-secondary);
    border-color: #b5b0f0;
    box-shadow: 0 0 0 1px rgba(100,95,229,.15);
}
.glse-nav-item--cta.glse-nav-item--active .glse-nav-icon {
    opacity: 1;
    color: var(--glse-secondary);
}

/* ══════════════════════
   UPGRADE PANEL
   ══════════════════════ */

.glse-upgrade-panel { padding: 0; }

.glse-upgrade-hero {
    text-align: center;
    padding: 36px 32px 28px;
    background: linear-gradient(140deg, #f4f2ff 0%, #fafafe 100%);
    border-bottom: 1px solid var(--glse-border-light);
}
.glse-upgrade-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--glse-secondary);
    border-radius: 50%;
    color: #fff;
    margin-bottom: 14px;
}
.glse-upgrade-hero h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--glse-text-primary);
}
.glse-upgrade-hero p {
    color: var(--glse-text-secondary);
    font-size: 13px;
    margin: 0 0 20px;
}
.glse-upgrade-cta.button-primary {
    background: var(--glse-secondary) !important;
    border-color: var(--glse-secondary) !important;
    font-size: 13px !important;
    padding: 7px 22px !important;
    height: auto !important;
    line-height: 1.6 !important;
    box-shadow: none !important;
}
.glse-upgrade-cta.button-primary:hover {
    background: #524db8 !important;
    border-color: #524db8 !important;
}

.glse-upgrade-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}
.glse-upgrade-group {
    padding: 18px 24px;
    border-right: 1px solid var(--glse-border-light);
    border-bottom: 1px solid var(--glse-border-light);
}
.glse-upgrade-group:nth-child(2n) { border-right: none; }
.glse-upgrade-group:nth-last-child(-n+2) { border-bottom: none; }
.glse-upgrade-group h3 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--glse-secondary);
    margin: 0 0 10px;
}
.glse-upgrade-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.glse-upgrade-group ul li {
    font-size: 13px;
    color: var(--glse-text-secondary);
    padding: 4px 0 4px 18px;
    position: relative;
}
.glse-upgrade-group ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--glse-secondary);
    font-weight: 700;
}

@media (max-width: 680px) {
    .glse-upgrade-grid { grid-template-columns: 1fr; }
    .glse-upgrade-group:nth-child(2n) { border-right: none; }
    .glse-upgrade-group { border-bottom: 1px solid var(--glse-border-light); }
    .glse-upgrade-group:last-child { border-bottom: none; }
}


