/* Lens — AI Visibility Monitor — admin styles. */

.lens-wrap { max-width: 1280px; margin-top: 18px; }
.lens-wrap > h1 { display: flex; align-items: center; gap: 12px; }
.lens-wrap > h1 .lens-icon { width: 32px; height: 32px; }

.lens-grid { display: grid; gap: 16px; }
.lens-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.lens-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .lens-grid.cols-3, .lens-grid.cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .lens-grid.cols-3, .lens-grid.cols-4 { grid-template-columns: 1fr; } }

/* Cards */
.lens-card { background: #fff; border: 1px solid #dcdcde; border-radius: 8px; padding: 18px; box-shadow: 0 1px 0 rgba(0,0,0,0.02); transition: transform .15s, box-shadow .15s; }
.lens-card.hoverable:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

.lens-kpi { display: flex; flex-direction: column; gap: 4px; }
.lens-kpi .label { font-size: 11px; font-weight: 700; color: #50575e; text-transform: uppercase; letter-spacing: .04em; }
.lens-kpi .value { font-size: 30px; font-weight: 700; color: #1d2327; line-height: 1.1; }
.lens-kpi .sub { font-size: 12px; color: #646970; }
.lens-kpi .delta { font-size: 12px; font-weight: 600; }
.lens-kpi .delta.up { color: #117a3a; }
.lens-kpi .delta.down { color: #b32d2e; }
.lens-kpi.with-spark { position: relative; }
.lens-kpi .spark { height: 36px; margin-top: 6px; }

/* Section */
.lens-section { background: #fff; border: 1px solid #dcdcde; border-radius: 8px; padding: 20px; margin-top: 20px; }
.lens-section header { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 14px; gap: 12px; }
.lens-section header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.lens-section header .actions { display: flex; gap: 8px; }

/* Chart wrappers */
.lens-chart-wrap { position: relative; height: 280px; }
.lens-chart-wrap.tall { height: 360px; }
.lens-chart-wrap.short { height: 200px; }

/* Table */
.lens-table { width: 100%; border-collapse: collapse; }
.lens-table th { text-align: left; font-size: 11px; font-weight: 700; color: #50575e; text-transform: uppercase; letter-spacing: .04em; padding: 8px 12px; border-bottom: 1px solid #dcdcde; }
.lens-table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid #f0f0f1; color: #1d2327; }
.lens-table tr:last-child td { border-bottom: 0; }
.lens-table tbody tr:hover { background: #fbfbfc; }
.lens-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.lens-table .muted { color: #646970; }
.lens-table .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }

/* Pills */
.lens-pill { display: inline-block; padding: 3px 10px; border-radius: 11px; font-size: 11px; font-weight: 600; background: #f0f0f1; color: #1d2327; }
.lens-pill.ok    { background: #e6f6ea; color: #117a3a; }
.lens-pill.warn  { background: #fcf0d3; color: #8a5a00; }
.lens-pill.bad   { background: #fbeaea; color: #b32d2e; }
.lens-pill.info  { background: #e6efff; color: #1d3a72; }
.lens-score      { display: inline-block; min-width: 36px; padding: 3px 10px; border-radius: 11px; text-align: center; font-weight: 700; font-size: 12px; }
.lens-score.s-high { background: #e6f6ea; color: #117a3a; }
.lens-score.s-mid  { background: #fcf0d3; color: #8a5a00; }
.lens-score.s-low  { background: #fbeaea; color: #b32d2e; }

/* Buttons */
.lens-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 4px; border: 1px solid #2271b1; background: #fff; color: #2271b1; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; line-height: 1.4; }
.lens-btn:hover { background: #f0f7ff; }
.lens-btn.primary { background: #2271b1; color: #fff; }
.lens-btn.primary:hover { background: #135e96; }
.lens-btn.ghost { border-color: transparent; color: #2271b1; background: transparent; }
.lens-btn.ghost:hover { background: #f0f7ff; }
.lens-btn:disabled, .lens-btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.lens-btn .spinner { display: none; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: lens-spin 0.7s linear infinite; }
.lens-btn[aria-busy="true"] .spinner { display: inline-block; }
@keyframes lens-spin { to { transform: rotate(360deg); } }

/* Inputs */
.lens-input, .lens-textarea, .lens-select { width: 100%; padding: 8px 10px; border: 1px solid #8c8f94; border-radius: 4px; font-size: 13px; line-height: 1.4; background: #fff; transition: border-color .12s, box-shadow .12s; }
.lens-input:focus, .lens-textarea:focus, .lens-select:focus { outline: none; border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; }
.lens-help { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: #e0e0e0; color: #50575e; text-align: center; font-size: 11px; font-weight: 700; line-height: 16px; cursor: help; margin-left: 6px; vertical-align: middle; }
.lens-help[data-tooltip]:hover { background: #2271b1; color: #fff; }

/* Toast notifications */
.lens-toasts { position: fixed; bottom: 24px; right: 24px; z-index: 99999; display: flex; flex-direction: column; gap: 10px; max-width: 360px; pointer-events: none; }
.lens-toast { background: #1d2327; color: #fff; padding: 12px 14px; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,0.2); display: flex; gap: 10px; align-items: flex-start; animation: lens-toast-in .25s ease; pointer-events: auto; font-size: 13px; line-height: 1.45; }
.lens-toast.ok   { background: #117a3a; }
.lens-toast.bad  { background: #b32d2e; }
.lens-toast.warn { background: #8a5a00; }
.lens-toast .close { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,0.75); cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }
.lens-toast.fade-out { animation: lens-toast-out .25s ease forwards; }
@keyframes lens-toast-in  { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes lens-toast-out { to { transform: translateX(120%); opacity: 0; } }

/* Empty state */
.lens-empty { text-align: center; padding: 48px 20px; color: #646970; }
.lens-empty h3 { color: #1d2327; margin: 0 0 8px; }
.lens-empty p { margin: 0 0 16px; max-width: 460px; margin-left: auto; margin-right: auto; }
.lens-empty .lens-icon-large { width: 64px; height: 64px; margin: 0 auto 16px; opacity: 0.6; }

/* Post picker */
.lens-picker { position: relative; }
.lens-picker .lens-picker-results { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid #dcdcde; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); max-height: 320px; overflow-y: auto; z-index: 1000; display: none; }
.lens-picker.open .lens-picker-results { display: block; }
.lens-picker-results .result { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f0f0f1; display: flex; flex-direction: column; gap: 2px; }
.lens-picker-results .result:hover, .lens-picker-results .result.active { background: #f0f7ff; }
.lens-picker-results .result .title { color: #1d2327; font-weight: 500; }
.lens-picker-results .result .meta { color: #646970; font-size: 12px; }
.lens-picker-empty { padding: 14px; color: #646970; text-align: center; font-size: 13px; }

/* Findings list */
.lens-finding { display: flex; gap: 12px; padding: 12px 14px; border-radius: 6px; background: #fbfbfc; margin-bottom: 8px; border-left: 3px solid #dcdcde; }
.lens-finding.pass { border-left-color: #117a3a; }
.lens-finding.fail { border-left-color: #b32d2e; }
.lens-finding.info { border-left-color: #2271b1; }
.lens-finding .indicator { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; }
.lens-finding.pass .indicator { background: #117a3a; }
.lens-finding.fail .indicator { background: #b32d2e; }
.lens-finding.info .indicator { background: #2271b1; }
.lens-finding .body { flex: 1; }
.lens-finding .title { font-weight: 600; color: #1d2327; font-size: 13px; }
.lens-finding .message { font-size: 13px; color: #50575e; margin-top: 2px; }

/* Welcome wizard */
.lens-welcome { max-width: 720px; margin: 40px auto; background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); overflow: hidden; }
.lens-welcome header { background: linear-gradient(135deg, #1e3a8a, #3b82f6); color: #fff; padding: 32px; text-align: center; }
.lens-welcome header h1 { color: #fff; font-size: 28px; margin: 0 0 8px; font-weight: 700; }
.lens-welcome header p { margin: 0; opacity: 0.9; font-size: 15px; }
.lens-welcome .steps { display: flex; justify-content: center; gap: 0; padding: 20px 32px; border-bottom: 1px solid #f0f0f1; }
.lens-welcome .steps .step { flex: 1; text-align: center; position: relative; color: #8c8f94; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 8px 4px; }
.lens-welcome .steps .step::before { content: ""; display: block; width: 28px; height: 28px; border-radius: 50%; background: #f0f0f1; color: #8c8f94; line-height: 28px; margin: 0 auto 8px; font-size: 13px; counter-increment: step; }
.lens-welcome .steps { counter-reset: step; }
.lens-welcome .steps .step::before { content: counter(step); }
.lens-welcome .steps .step.active { color: #2271b1; }
.lens-welcome .steps .step.active::before { background: #2271b1; color: #fff; }
.lens-welcome .steps .step.done { color: #117a3a; }
.lens-welcome .steps .step.done::before { content: "✓"; background: #117a3a; color: #fff; }
.lens-welcome .step-body { padding: 32px; }
.lens-welcome .step-body h2 { margin-top: 0; font-size: 20px; }
.lens-welcome .step-body .desc { color: #50575e; font-size: 14px; line-height: 1.5; margin-bottom: 24px; }
.lens-welcome .footer { padding: 16px 32px; background: #fbfbfc; border-top: 1px solid #f0f0f1; display: flex; justify-content: space-between; gap: 10px; }
.lens-welcome .toggle-row { display: flex; gap: 14px; padding: 14px; border: 1px solid #dcdcde; border-radius: 6px; margin-bottom: 10px; align-items: flex-start; }
.lens-welcome .toggle-row input[type=checkbox] { margin-top: 4px; }
.lens-welcome .toggle-row .label { font-weight: 600; color: #1d2327; }
.lens-welcome .toggle-row .help { display: block; font-size: 12px; color: #646970; margin-top: 2px; }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% + 6px); background: #1d2327; color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 4px; white-space: nowrap; max-width: 260px; white-space: normal; width: max-content; z-index: 1000; line-height: 1.4; }

/* Score circle (editor sidebar style) */
.lens-score-circle { position: relative; width: 120px; height: 120px; margin: 0 auto; }
.lens-score-circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.lens-score-circle .value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; color: #1d2327; }

/* Search input */
.lens-search { position: relative; }
.lens-search input { padding-left: 32px; }
.lens-search::before { content: "🔍"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); opacity: 0.5; font-size: 14px; }

/* Posts list column */
.column-lens_aeo { width: 80px; text-align: center; }
.lens-aeo-cell .lens-score { min-width: 40px; }
.lens-aeo-cell .lens-cta { display: block; font-size: 11px; color: #2271b1; margin-top: 2px; cursor: pointer; }

/* Welcome page screenshot illustrations */
.lens-illus { width: 100%; max-width: 380px; height: 180px; background: linear-gradient(135deg, #f0f7ff, #e6efff); border-radius: 8px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }

/* Masked API key — fixed width, never overflows. */
.lens-masked-key {
	display: inline-block;
	max-width: 100%;
	padding: 4px 10px;
	background: #f0f0f1;
	border-radius: 4px;
	font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
	font-size: 12px;
	color: #1d2327;
	word-break: break-all;
	overflow-wrap: anywhere;
	line-height: 1.5;
	vertical-align: middle;
}
.lens-key-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0; }
.lens-key-row label { display: flex; align-items: center; gap: 6px; }
