/*
 * Esipher admin UI. Everything is scoped under .esipher-app so nothing
 * leaks into the rest of wp-admin. No external fonts or assets.
 */

.esipher-app {
	--esi-brand: #7e41fe;
	--esi-brand-dark: #6528e0;
	--esi-brand-soft: #f4effe;
	--esi-brand-line: #e4d9fb;
	--esi-text: #1d1b2e;
	--esi-muted: #6b6a7d;
	--esi-line: #e7e5f0;
	--esi-bg: #f6f5fa;
	--esi-ok: #14a76c;
	--esi-warn: #b7791f;
	--esi-err: #d63638;
	max-width: 1180px;
	margin: 20px 20px 40px 0;
	color: var(--esi-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.esipher-app * { box-sizing: border-box; }

/* ---------- header ---------- */
.esipher-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	background: #fff;
	border: 1px solid var(--esi-line);
	border-radius: 16px;
	padding: 14px 22px;
	margin-bottom: 20px;
	box-shadow: 0 1px 2px rgba(29, 27, 46, .04);
}

.esipher-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	text-decoration: none;
	color: var(--esi-text);
}

.esipher-brand img { height: 34px; width: auto; display: block; }

.esipher-brand__name { font-size: 24px; font-weight: 800; letter-spacing: -.5px; line-height: 1; }

.esipher-brand__ver {
	font-size: 11px;
	font-weight: 600;
	color: var(--esi-brand);
	background: var(--esi-brand-soft);
	border-radius: 999px;
	padding: 3px 9px;
}

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

.esipher-nav a {
	display: inline-block;
	padding: 9px 16px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	color: var(--esi-text);
	text-decoration: none;
	transition: background .15s, color .15s;
}

.esipher-nav a:hover { background: var(--esi-brand-soft); color: var(--esi-brand-dark); }

.esipher-nav a.is-active { background: var(--esi-brand-soft); color: var(--esi-brand-dark); box-shadow: inset 0 0 0 1px var(--esi-brand-line); }

.esipher-nav a:focus-visible,
.esipher-side a:focus-visible { outline: 2px solid var(--esi-brand); outline-offset: 2px; }

/* ---------- layout with optional side menu ---------- */
.esipher-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }

@media (max-width: 860px) { .esipher-layout { grid-template-columns: 1fr; } }

.esipher-side {
	background: #fff;
	border: 1px solid var(--esi-line);
	border-radius: 16px;
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.esipher-side a {
	display: block;
	padding: 11px 14px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	color: var(--esi-text);
	text-decoration: none;
}

.esipher-side a:hover { background: var(--esi-bg); }

.esipher-side a.is-active { background: var(--esi-brand-soft); color: var(--esi-brand-dark); }

/* ---------- cards ---------- */
.esipher-card {
	background: #fff;
	border: 1px solid var(--esi-line);
	border-radius: 16px;
	margin-bottom: 20px;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(29, 27, 46, .04);
}

.esipher-card__head {
	background: var(--esi-brand-soft);
	border-bottom: 1px solid var(--esi-brand-line);
	padding: 16px 24px;
}

.esipher-card__title { margin: 0; font-size: 17px; font-weight: 700; color: var(--esi-text); line-height: 1.3; }

.esipher-card__desc { margin: 4px 0 0; color: var(--esi-muted); font-size: 13px; line-height: 1.5; }

.esipher-card__body { padding: 22px 24px; }

.esipher-card__body > p:first-child { margin-top: 0; }

.esipher-card__body > :last-child { margin-bottom: 0; }

/* ---------- forms ---------- */
.esipher-app .form-table { margin: 0; }

.esipher-app .form-table th {
	width: 210px;
	padding: 18px 20px 18px 0;
	font-weight: 600;
	font-size: 14px;
	color: var(--esi-text);
	vertical-align: top;
}

.esipher-app .form-table td { padding: 14px 0; }

.esipher-app .form-table tr + tr th,
.esipher-app .form-table tr + tr td { border-top: 1px solid var(--esi-line); }

@media (max-width: 782px) {
	.esipher-app .form-table th { width: auto; padding-bottom: 4px; }
}

.esipher-app input[type="text"],
.esipher-app input[type="url"],
.esipher-app input[type="password"],
.esipher-app textarea,
.esipher-app select {
	border: 1px solid #d9d6e7;
	border-radius: 10px;
	padding: 9px 12px;
	min-height: 40px;
	font-size: 14px;
	background: #fff;
	color: var(--esi-text);
	box-shadow: none;
	max-width: 100%;
}

.esipher-app input[type="text"]:focus,
.esipher-app input[type="url"]:focus,
.esipher-app input[type="password"]:focus,
.esipher-app textarea:focus,
.esipher-app select:focus {
	border-color: var(--esi-brand);
	box-shadow: 0 0 0 3px rgba(126, 65, 254, .18);
	outline: none;
}

.esipher-app input[type="checkbox"] {
	border: 1.5px solid #bdb8d4;
	border-radius: 5px;
	width: 18px;
	height: 18px;
	margin-right: 8px;
}

.esipher-app input[type="checkbox"]:checked { background: var(--esi-brand); border-color: var(--esi-brand); }

.esipher-app input[type="checkbox"]:checked::before { filter: brightness(0) invert(1); margin: -3px 0 0 -4px; }

.esipher-app input[type="checkbox"]:focus { box-shadow: 0 0 0 3px rgba(126, 65, 254, .2); border-color: var(--esi-brand); }

.esipher-app input[type="file"] {
	border: 1.5px dashed #c9bff0;
	background: #faf8ff;
	border-radius: 12px;
	padding: 18px;
	width: 100%;
	max-width: 520px;
	cursor: pointer;
}

.esipher-app .description,
.esipher-app p.description { color: var(--esi-muted); font-size: 13px; line-height: 1.55; }

.esipher-app code { background: var(--esi-brand-soft); color: var(--esi-brand-dark); border-radius: 6px; padding: 2px 7px; font-size: 12.5px; }

/* ---------- buttons ---------- */
.esipher-app .button,
.esipher-app .button-secondary {
	border-radius: 10px;
	border: 1px solid #d9d6e7;
	background: #fff;
	color: var(--esi-text);
	font-weight: 600;
	min-height: 38px;
	line-height: 36px;
	padding: 0 16px;
	transition: background .15s, border-color .15s;
}

.esipher-app .button:hover { background: var(--esi-bg); border-color: #c4c0d8; color: var(--esi-text); }

.esipher-app .button-small { min-height: 30px; line-height: 28px; padding: 0 12px; font-size: 12.5px; }

.esipher-app .button-primary {
	background: var(--esi-brand);
	border-color: var(--esi-brand);
	color: #fff;
	box-shadow: 0 2px 6px rgba(126, 65, 254, .28);
}

.esipher-app .button-primary:hover,
.esipher-app .button-primary:focus { background: var(--esi-brand-dark); border-color: var(--esi-brand-dark); color: #fff; }

.esipher-app .button:focus-visible { outline: 2px solid var(--esi-brand); outline-offset: 2px; }

.esipher-app .submit { margin: 18px 0 0; padding: 0; }

/* ---------- notices ---------- */
.esipher-app .notice {
	border-radius: 12px;
	border: 1px solid var(--esi-line);
	border-left-width: 4px;
	margin: 0 0 20px;
	box-shadow: none;
}

.esipher-app .notice-success { border-left-color: var(--esi-ok); background: #effaf5; }
.esipher-app .notice-error { border-left-color: var(--esi-err); background: #fdf1f1; }
.esipher-app .notice-warning { border-left-color: var(--esi-warn); background: #fdf8ec; }
.esipher-app .notice-info { border-left-color: var(--esi-brand); background: var(--esi-brand-soft); }

/* ---------- tables ---------- */
.esipher-app table.widefat {
	border: 1px solid var(--esi-line);
	border-radius: 12px;
	overflow: hidden;
	box-shadow: none;
}

.esipher-app table.widefat thead th {
	background: var(--esi-bg);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--esi-muted);
	border-bottom: 1px solid var(--esi-line);
	padding: 12px 14px;
}

.esipher-app table.widefat td { padding: 14px; vertical-align: middle; }

.esipher-app table.widefat.striped > tbody > :nth-child(odd) { background: #fcfbff; }

/* ---------- status pills ---------- */
.esipher-pill {
	display: inline-block;
	font-size: 12px;
	font-weight: 700;
	border-radius: 999px;
	padding: 4px 11px;
	background: var(--esi-bg);
	color: var(--esi-muted);
}

.esipher-pill--ok { background: #e3f6ec; color: #0e7a4e; }
.esipher-pill--warn { background: #fdf0d5; color: #8a5a0b; }
.esipher-pill--err { background: #fde4e4; color: #b42325; }
.esipher-pill--info { background: var(--esi-brand-soft); color: var(--esi-brand-dark); }

/* ---------- misc ---------- */
.esipher-app details { margin-top: 12px; border: 1px solid var(--esi-line); border-radius: 12px; padding: 12px 16px; background: #fcfbff; }

.esipher-app details summary { cursor: pointer; font-weight: 600; color: var(--esi-brand-dark); }

.esipher-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--esi-text); line-height: 1.6; }

.esipher-steps li::marker { color: var(--esi-brand); font-weight: 700; }

.esipher-log {
	max-height: 320px;
	overflow-y: auto;
	background: #15131f;
	color: #e9e6f5;
	border-radius: 12px;
	padding: 14px 16px;
	font-size: 12px;
	line-height: 1.65;
	white-space: pre-wrap;
}

.esipher-stat { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 4px; }

.esipher-app .esipher-muted { color: var(--esi-muted); }

.esipher-app hr { border: 0; border-top: 1px solid var(--esi-line); margin: 20px 0; }

@media (prefers-reduced-motion: reduce) {
	.esipher-app * { transition: none !important; }
}

/* ---------- text helpers ---------- */
.esipher-app .esipher-notice-text { font-size: 15px; line-height: 1.6; }

.esipher-app .esipher-error-text { color: var(--esi-err); font-size: 15px; font-style: normal; }

.esipher-app .esipher-card .esipher-card__title { margin: 0; padding: 0; font-size: 17px; font-weight: 700; line-height: 1.3; }

.esipher-app .esipher-card .esipher-card__desc { margin: 4px 0 0; }

.esipher-app .esipher-wrap-text { word-break: break-all; }

.esipher-app .esipher-icon-preview { max-width: 96px; max-height: 96px; margin-bottom: 8px; border: 1px solid var(--esi-line); border-radius: 12px; }

.esipher-app .esipher-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 18px 0 0; }

.esipher-app .esipher-lead { color: var(--esi-muted); font-size: 14px; line-height: 1.6; margin: 0 0 18px; }
