/**
 * AI Visibility Score & Suggestions — front-end styles.
 * Everything is scoped under .aivs-app / .aivs-* so it cannot leak into
 * the theme or collide with another plugin's CSS.
 */

.aivs-app {
	--aivs-primary: #1a56db;
	--aivs-accent: #0f9d58;
	--aivs-text: #16202f;
	--aivs-muted: #5b6b82;
	--aivs-line: #e3e8ef;
	--aivs-bg: #ffffff;
	--aivs-soft: #f6f8fb;
	--aivs-good: #0f9d58;
	--aivs-ok: #b98900;
	--aivs-weak: #e2711d;
	--aivs-poor: #cf2e2e;
	--aivs-radius: 14px;

	box-sizing: border-box;
	max-width: 1080px;
	margin: 0 auto;
	color: var(--aivs-text);
	font-size: 15px;
	line-height: 1.6;
}

.aivs-app *,
.aivs-app *::before,
.aivs-app *::after {
	box-sizing: border-box;
}

.aivs-app h2,
.aivs-app h3 {
	margin: 0 0 6px;
	line-height: 1.3;
	color: var(--aivs-text);
}

.aivs-muted { color: var(--aivs-muted); }
.aivs-text-center { text-align: center; }

.aivs-link {
	color: var(--aivs-primary);
	text-decoration: none;
	font-weight: 600;
}

.aivs-link:hover { text-decoration: underline; }

.aivs-fineprint {
	color: var(--aivs-muted);
	font-size: 12.5px;
	margin: 18px 2px 0;
}

/* ---------- brand + nav ---------- */

.aivs-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 18px;
}

.aivs-brand-logo { max-height: 42px; width: auto; }

.aivs-brand-mark {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--aivs-primary);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 20px;
}

.aivs-brand-text { display: flex; flex-direction: column; }

.aivs-brand-name {
	font-weight: 700;
	color: var(--aivs-text);
	text-decoration: none;
	font-size: 16px;
}

.aivs-brand-sub { color: var(--aivs-muted); font-size: 13px; }

.aivs-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: space-between;
	align-items: center;
	padding: 10px 14px;
	background: var(--aivs-soft);
	border: 1px solid var(--aivs-line);
	border-radius: var(--aivs-radius);
	margin-bottom: 18px;
}

.aivs-nav-links { display: flex; gap: 6px; flex-wrap: wrap; }

.aivs-nav-link {
	padding: 7px 14px;
	border-radius: 999px;
	text-decoration: none;
	color: var(--aivs-muted);
	font-weight: 600;
	font-size: 14px;
}

.aivs-nav-link.is-active,
.aivs-nav-link:hover {
	background: #fff;
	color: var(--aivs-primary);
	box-shadow: 0 1px 3px rgba(16, 30, 54, .1);
}

.aivs-nav-user { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.aivs-nav-name { color: var(--aivs-muted); }
.aivs-nav-logout { color: var(--aivs-muted); text-decoration: none; }
.aivs-nav-logout:hover { color: var(--aivs-poor); }

/* ---------- cards ---------- */

.aivs-card {
	background: var(--aivs-bg);
	border: 1px solid var(--aivs-line);
	border-radius: var(--aivs-radius);
	padding: 22px;
	margin-bottom: 18px;
}

.aivs-card-title { font-size: 18px; font-weight: 700; }

.aivs-card-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 14px;
	margin-bottom: 12px;
}

.aivs-grid { display: grid; gap: 18px; }
.aivs-grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.aivs-empty { color: var(--aivs-muted); padding: 10px 0; }

/* ---------- forms ---------- */

.aivs-auth-wrap { display: flex; justify-content: center; padding: 20px 0; }

.aivs-auth-card {
	width: 100%;
	max-width: 460px;
	background: #fff;
	border: 1px solid var(--aivs-line);
	border-radius: var(--aivs-radius);
	padding: 30px;
	box-shadow: 0 6px 24px rgba(16, 30, 54, .06);
}

.aivs-auth-head { margin-bottom: 18px; }
.aivs-auth-head h2 { font-size: 22px; }

.aivs-badge {
	display: inline-block;
	font-size: 11px;
	letter-spacing: .08em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--aivs-primary);
	background: rgba(26, 86, 219, .1);
	padding: 4px 10px;
	border-radius: 999px;
	margin-bottom: 10px;
}

/* ---------- auth tabs (single-page app) ---------- */

.aivs-tabs {
	display: flex;
	gap: 4px;
	padding: 4px;
	background: var(--aivs-soft);
	border-radius: 12px;
	margin-bottom: 22px;
}

.aivs-tab {
	flex: 1 1 0;
	text-align: center;
	padding: 9px 10px;
	border-radius: 9px;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--aivs-muted);
	text-decoration: none;
	white-space: nowrap;
	transition: background .12s ease, color .12s ease;
}

.aivs-tab:hover { color: var(--aivs-primary); }

.aivs-tab.is-active {
	background: #fff;
	color: var(--aivs-primary);
	box-shadow: 0 1px 3px rgba(16, 30, 54, .12);
}

.aivs-tab-panel[hidden] { display: none; }

.aivs-panel-title { font-size: 19px; margin: 0 0 6px; }
.aivs-panel-foot { margin-top: 16px; text-align: center; color: var(--aivs-muted); font-size: 14px; }

.aivs-auth-card .aivs-brand { margin-bottom: 10px; }

.aivs-field { margin-bottom: 14px; }
.aivs-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.aivs-field label {
	display: block;
	font-weight: 600;
	font-size: 13.5px;
	margin-bottom: 5px;
}

.aivs-optional { font-weight: 400; color: var(--aivs-muted); }

.aivs-app input[type="text"],
.aivs-app input[type="email"],
.aivs-app input[type="url"],
.aivs-app input[type="password"] {
	width: 100%;
	padding: 11px 13px;
	border: 1px solid var(--aivs-line);
	border-radius: 10px;
	font-size: 15px;
	background: #fff;
	color: var(--aivs-text);
}

.aivs-app input:focus {
	outline: none;
	border-color: var(--aivs-primary);
	box-shadow: 0 0 0 3px rgba(26, 86, 219, .15);
}

.aivs-hint { color: var(--aivs-muted); font-size: 12.5px; }

.aivs-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.aivs-check input { margin-top: 3px; }

.aivs-field-inline {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}

.aivs-hp-field {
	position: absolute !important;
	left: -9999px !important;
	height: 1px;
	overflow: hidden;
}

.aivs-auth-foot { margin-top: 16px; text-align: center; color: var(--aivs-muted); }

.aivs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 11px 20px;
	border-radius: 10px;
	border: 1px solid transparent;
	background: var(--aivs-soft);
	color: var(--aivs-text);
	font-weight: 600;
	font-size: 14.5px;
	text-decoration: none;
	cursor: pointer;
	transition: transform .08s ease, box-shadow .12s ease;
}

.aivs-btn:hover { box-shadow: 0 2px 8px rgba(16, 30, 54, .12); }
.aivs-btn:active { transform: translateY(1px); }
.aivs-btn[disabled] { opacity: .6; cursor: not-allowed; }

.aivs-btn-primary { background: var(--aivs-primary); color: #fff; }
.aivs-btn-ghost { background: transparent; border-color: var(--aivs-line); color: var(--aivs-muted); }
.aivs-btn-danger { background: transparent; border-color: rgba(207, 46, 46, .3); color: var(--aivs-poor); }
.aivs-btn-block { width: 100%; }
.aivs-btn-small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- alerts ---------- */

.aivs-alert {
	padding: 12px 14px;
	border-radius: 10px;
	margin-bottom: 14px;
	font-size: 14px;
	border: 1px solid transparent;
}

.aivs-alert-error { background: #fdeeee; border-color: #f5c6c6; color: #8c1c1c; }
.aivs-alert-success { background: #eaf7f0; border-color: #b9e3cd; color: #10603c; }
.aivs-alert-info { background: #eef3fd; border-color: #c7d7f7; color: #1c3d8f; }

.aivs-form-error { color: var(--aivs-poor); font-size: 14px; margin: 10px 0 0; }

/* ---------- scan form + progress ---------- */

.aivs-scan-card { background: linear-gradient(180deg, #fbfcfe, #fff); }

.aivs-scan-input { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.aivs-scan-input input { flex: 1 1 280px; }

.aivs-quota { color: var(--aivs-muted); font-size: 13px; margin: 10px 0 0; }

.aivs-progress { margin-top: 18px; }

.aivs-progress-head {
	display: flex;
	justify-content: space-between;
	font-size: 13.5px;
	font-weight: 600;
	margin-bottom: 6px;
}

.aivs-progress-percent { color: var(--aivs-primary); }

.aivs-progress-track {
	height: 10px;
	background: var(--aivs-soft);
	border-radius: 999px;
	overflow: hidden;
}

.aivs-progress-fill {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--aivs-primary), var(--aivs-accent));
	transition: width .5s ease;
}

.aivs-progress-note { color: var(--aivs-muted); font-size: 12.5px; margin: 8px 0 0; }

/* ---------- gauge + bars ---------- */

.aivs-gauge { position: relative; }
.aivs-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.aivs-gauge-track {
	fill: none;
	stroke: var(--aivs-soft);
	stroke-width: 16;
}

.aivs-gauge-value {
	fill: none;
	stroke: var(--aivs-primary);
	stroke-width: 16;
	stroke-linecap: round;
	transition: stroke-dashoffset .8s ease;
}

.aivs-band-good .aivs-gauge-value { stroke: var(--aivs-good); }
.aivs-band-ok .aivs-gauge-value { stroke: var(--aivs-ok); }
.aivs-band-weak .aivs-gauge-value { stroke: var(--aivs-weak); }
.aivs-band-poor .aivs-gauge-value { stroke: var(--aivs-poor); }

.aivs-gauge-inner {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.aivs-gauge-score { font-size: 46px; font-weight: 800; }
.aivs-gauge-out { font-size: 13px; color: var(--aivs-muted); margin-top: 2px; }

.aivs-gauge-grade {
	margin-top: 8px;
	font-weight: 700;
	font-size: 13px;
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--aivs-soft);
}

.aivs-bar {
	display: block;
	height: 7px;
	background: var(--aivs-soft);
	border-radius: 999px;
	overflow: hidden;
	margin-top: 8px;
}

.aivs-bar-fill { display: block; height: 100%; background: var(--aivs-primary); border-radius: 999px; }
.aivs-band-good .aivs-bar-fill { background: var(--aivs-good); }
.aivs-band-ok .aivs-bar-fill { background: var(--aivs-ok); }
.aivs-band-weak .aivs-bar-fill { background: var(--aivs-weak); }
.aivs-band-poor .aivs-bar-fill { background: var(--aivs-poor); }

/* ---------- summary ---------- */

.aivs-summary { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.aivs-summary-body { flex: 1 1 320px; }
.aivs-summary-title { font-size: 24px; }
.aivs-summary-url { color: var(--aivs-muted); word-break: break-all; margin: 0 0 10px; }
.aivs-summary-verdict { font-size: 15.5px; margin: 0 0 12px; }

.aivs-summary-meta {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	padding: 0;
	margin: 0 0 16px;
	color: var(--aivs-muted);
	font-size: 13.5px;
}

.aivs-summary-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }

/* ---------- category grid ---------- */

.aivs-cat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 12px;
}

.aivs-cat-card {
	display: block;
	padding: 14px;
	border: 1px solid var(--aivs-line);
	border-radius: 12px;
	text-decoration: none;
	color: inherit;
	background: #fff;
}

.aivs-cat-card:hover { border-color: var(--aivs-primary); }

.aivs-cat-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.aivs-cat-card-label { font-weight: 600; font-size: 14px; }
.aivs-cat-card-score { font-weight: 800; font-size: 18px; }
.aivs-cat-card-weight { display: block; color: var(--aivs-muted); font-size: 12.5px; margin-top: 8px; }

.aivs-band-good .aivs-cat-card-score { color: var(--aivs-good); }
.aivs-band-ok .aivs-cat-card-score { color: var(--aivs-ok); }
.aivs-band-weak .aivs-cat-card-score { color: var(--aivs-weak); }
.aivs-band-poor .aivs-cat-card-score { color: var(--aivs-poor); }

.aivs-cat-list, .aivs-engine-list { list-style: none; padding: 0; margin: 0; }

.aivs-cat-list li, .aivs-engine-list li {
	padding: 10px 0;
	border-bottom: 1px solid var(--aivs-line);
}

.aivs-cat-list li:last-child, .aivs-engine-list li:last-child { border-bottom: 0; }

.aivs-cat-name, .aivs-engine-name { font-weight: 600; }
.aivs-cat-weight { float: right; color: var(--aivs-muted); font-size: 13px; }
.aivs-cat-desc, .aivs-engine-note { display: block; color: var(--aivs-muted); font-size: 13px; }

/* ---------- pills ---------- */

.aivs-pill {
	display: inline-block;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: .02em;
	background: var(--aivs-soft);
	color: var(--aivs-muted);
	white-space: nowrap;
}

.aivs-pill-pass { background: rgba(15, 157, 88, .12); color: #0b6b3d; }
.aivs-pill-warn { background: rgba(185, 137, 0, .14); color: #7a5b00; }
.aivs-pill-fail { background: rgba(207, 46, 46, .12); color: #99201f; }

.aivs-prio-high { background: rgba(207, 46, 46, .12); color: #99201f; }
.aivs-prio-medium { background: rgba(226, 113, 29, .14); color: #8a4410; }
.aivs-prio-low { background: rgba(91, 107, 130, .12); color: #4a5a70; }

.aivs-status-complete { background: rgba(15, 157, 88, .12); color: #0b6b3d; }
.aivs-status-failed { background: rgba(207, 46, 46, .12); color: #99201f; }
.aivs-status-queued,
.aivs-status-crawling,
.aivs-status-analyzing { background: rgba(26, 86, 219, .1); color: #1c3d8f; }

.aivs-score-chip {
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
	padding: 5px 12px;
	border-radius: 999px;
	font-weight: 800;
	background: var(--aivs-soft);
}

.aivs-score-chip small { font-weight: 700; font-size: 11px; opacity: .75; }
.aivs-band-good.aivs-score-chip { background: rgba(15, 157, 88, .12); color: #0b6b3d; }
.aivs-band-ok.aivs-score-chip { background: rgba(185, 137, 0, .14); color: #7a5b00; }
.aivs-band-weak.aivs-score-chip { background: rgba(226, 113, 29, .14); color: #8a4410; }
.aivs-band-poor.aivs-score-chip { background: rgba(207, 46, 46, .12); color: #99201f; }

/* ---------- fix list ---------- */

.aivs-fix-list { list-style: none; padding: 0; margin: 14px 0 0; counter-reset: aivs-fix; }

.aivs-fix {
	border: 1px solid var(--aivs-line);
	border-left: 4px solid var(--aivs-line);
	border-radius: 12px;
	padding: 14px 16px;
	margin-bottom: 10px;
	background: #fff;
}

.aivs-fix-high { border-left-color: var(--aivs-poor); }
.aivs-fix-medium { border-left-color: var(--aivs-weak); }
.aivs-fix-low { border-left-color: var(--aivs-line); }

.aivs-fix-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 6px; }

.aivs-fix-rank {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--aivs-soft);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 12.5px;
}

.aivs-fix-label { font-weight: 700; flex: 1 1 auto; }
.aivs-fix-gain { color: var(--aivs-muted); font-size: 12.5px; }
.aivs-fix-evidence { color: var(--aivs-muted); font-size: 13.5px; margin: 0 0 8px; }
.aivs-fix-action { font-size: 14px; }

/* ---------- checks ---------- */

.aivs-checks { margin-top: 8px; }

.aivs-check-pass summary .aivs-check-label,
.aivs-check-warn summary .aivs-check-label,
.aivs-check-fail summary .aivs-check-label { font-weight: 600; }

details.aivs-check {
	border: 1px solid var(--aivs-line);
	border-radius: 12px;
	padding: 12px 14px;
	margin-bottom: 8px;
	background: #fff;
}

details.aivs-check > summary { cursor: pointer; list-style: none; }
details.aivs-check > summary::-webkit-details-marker { display: none; }

.aivs-check-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.aivs-check-label { flex: 1 1 220px; }
.aivs-check-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.aivs-check-score { color: var(--aivs-muted); font-size: 12.5px; font-weight: 700; }

.aivs-check-body { padding-top: 12px; border-top: 1px solid var(--aivs-line); margin-top: 12px; font-size: 14px; }
.aivs-check-body p { margin: 0 0 8px; }
.aivs-check-evidence, .aivs-check-why { color: var(--aivs-muted); }
.aivs-check-fix { background: var(--aivs-soft); border-radius: 10px; padding: 10px 12px; }
.aivs-check-fix p { margin: 4px 0 0; }

/* ---------- tables ---------- */

.aivs-table-wrap { overflow-x: auto; }

.aivs-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.aivs-table th {
	text-align: left;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--aivs-muted);
	padding: 10px 12px;
	border-bottom: 1px solid var(--aivs-line);
	white-space: nowrap;
}

.aivs-table td { padding: 12px; border-bottom: 1px solid var(--aivs-line); vertical-align: middle; }
.aivs-table tr:last-child td { border-bottom: 0; }

.aivs-col-site { min-width: 200px; }
.aivs-site-host { display: block; font-weight: 600; }
.aivs-site-url { display: block; color: var(--aivs-muted); font-size: 12.5px; word-break: break-all; }
.aivs-col-actions { white-space: nowrap; }
.aivs-col-actions .aivs-btn { margin-right: 4px; }

.aivs-pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

.aivs-page-link {
	padding: 6px 11px;
	border-radius: 8px;
	border: 1px solid var(--aivs-line);
	text-decoration: none;
	color: var(--aivs-muted);
	font-size: 13px;
}

.aivs-page-link.is-active { background: var(--aivs-primary); border-color: var(--aivs-primary); color: #fff; }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
	.aivs-field-row { grid-template-columns: 1fr; }
	.aivs-auth-card { padding: 22px; }
	.aivs-card { padding: 16px; }
	.aivs-summary { gap: 18px; }
	.aivs-gauge { margin: 0 auto; }
}
