/**
 * Cloudflare Images Sync — Admin styles.
 */

/* ── Toolbar (counts + actions above tables) ─────────────────────────── */

.cfimg-tablenav {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 12px 0;
}

/* ── Log-level badges ────────────────────────────────────────────────── */

.cfimg-log-level {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 12px;
	line-height: 1.4;
	font-weight: 500;
}

.cfimg-log-level--info {
	background: #e7f5fe;
	color: #0a4b78;
}

.cfimg-log-level--error {
	background: #fcf0f1;
	color: #8a1116;
}

.cfimg-log-level--warning {
	background: #fef8ee;
	color: #6e4600;
}

.cfimg-log-level--debug {
	background: #f0f0f1;
	color: #50575e;
}

/* ── Preview page ────────────────────────────────────────────────────── */

.cfimg-preset-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
	margin-top: 12px;
}

.cfimg-preset-card {
	border: 1px solid #c3c4c7;
	padding: 12px;
	border-radius: 4px;
	background: #fff;
}

.cfimg-preset-card h4 {
	margin: 0 0 8px;
}

.cfimg-preset-card img {
	max-width: 100%;
	height: auto;
}

.cfimg-preset-card code {
	font-size: 11px;
	word-break: break-all;
	cursor: pointer;
}

.cfimg-preset-card p {
	margin: 8px 0 0;
}

.cfimg-copy-url.copied {
	color: #00a32a;
}

.cfimg-preview-img {
	max-width: 600px;
	height: auto;
}

/* ── Count badge ─────────────────────────────────────────────────────── */

.cfimg-count-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 10px;
	background: #f0f0f1;
	color: #50575e;
	font-size: 12px;
	line-height: 1.5;
}

/* ── Mapping list cards ─────────────────────────────────────────────── */

.cfimg-mapping-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 16px;
	margin: 12px 0;
}

.cfimg-mapping-card__header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
	padding-bottom: 10px;
	border-bottom: 1px solid #f0f0f1;
}

.cfimg-mapping-card__header strong {
	font-size: 14px;
}

.cfimg-mapping-card__id {
	font-size: 11px;
	color: #a7aaad;
	font-family: monospace;
}

.cfimg-mapping-card__body {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 24px;
	margin-bottom: 12px;
}

.cfimg-mapping-card__arrow {
	color: #a7aaad;
	font-size: 16px;
}

.cfimg-mapping-card__field {
	font-size: 13px;
}

.cfimg-mapping-card__label {
	color: #646970;
	margin-right: 4px;
}

.cfimg-mapping-card__label::after {
	content: ":";
}

.cfimg-mapping-card__actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.cfimg-inline-form {
	display: inline;
}

.cfimg-mapping-card__delete {
	color: #b32d2e;
	text-decoration: none;
	font-size: 13px;
}

.cfimg-mapping-card__delete:hover {
	color: #a00;
}

/* ── Mapping form sections ──────────────────────────────────────────── */

.cfimg-form-section {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 16px 20px;
	margin: 16px 0;
}

.cfimg-form-section h3 {
	margin: 0 0 4px;
	padding: 0;
	font-size: 14px;
}

.cfimg-section-desc {
	margin: 0 0 8px;
	color: #646970;
}

.cfimg-form-section .form-table {
	margin-top: 0;
}

/* ── Validation errors ──────────────────────────────────────────────── */

.cfimg-field-error {
	color: #d63638;
	font-size: 13px;
	margin: 4px 0 0;
	display: none;
}

.cfimg-field-error.visible {
	display: block;
}

.form-invalid {
	border-color: #d63638 !important;
	box-shadow: 0 0 0 1px #d63638 !important;
}

/* ── Autocomplete dropdown ─────────────────────────────────────────── */

.cfimg-autocomplete {
	position: relative;
	display: inline-block;
	vertical-align: top;
}

.cfimg-autocomplete__panel {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 100000;
	min-width: 100%;
	max-width: 500px;
	max-height: 220px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #8c8f94;
	border-top: 0;
	border-radius: 0 0 4px 4px;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.cfimg-autocomplete__panel.is-open {
	display: block;
}

.cfimg-autocomplete__item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	cursor: pointer;
	font-size: 13px;
	line-height: 1.4;
	border-bottom: 1px solid #f0f0f1;
}

.cfimg-autocomplete__item:last-child {
	border-bottom: 0;
}

.cfimg-autocomplete__item:hover,
.cfimg-autocomplete__item.is-active {
	background: #f0f0f1;
}

.cfimg-autocomplete__item-name {
	font-family: monospace;
	font-weight: 600;
	color: #1d2327;
	white-space: nowrap;
}

.cfimg-autocomplete__item-label {
	color: #646970;
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cfimg-autocomplete__item-group {
	color: #a7aaad;
	font-size: 11px;
	white-space: nowrap;
}

.cfimg-autocomplete__item-type {
	display: inline-block;
	padding: 1px 6px;
	border-radius: 3px;
	background: #e7f5fe;
	color: #0a4b78;
	font-size: 11px;
	white-space: nowrap;
	flex-shrink: 0;
}

.cfimg-autocomplete__empty {
	padding: 8px 10px;
	color: #646970;
	font-size: 13px;
	font-style: italic;
}

/* ── Copy buttons ────────────────────────────────────────────────────── */

.cfimg-input-with-copy {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.cfimg-copy-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #f6f7f7;
	color: #50575e;
	cursor: pointer;
	flex-shrink: 0;
	transition: color 0.2s, border-color 0.2s;
}

.cfimg-copy-btn:hover:not(:disabled) {
	color: #2271b1;
	border-color: #2271b1;
}

.cfimg-copy-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.cfimg-copy-btn.copied {
	color: #00a32a;
	border-color: #00a32a;
}

.cfimg-copy-btn svg {
	width: 16px;
	height: 16px;
}

.cfimg-copy-btn-all {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
}

.cfimg-copy-btn-all svg {
	width: 16px;
	height: 16px;
}

.cfimg-copy-btn-all.copied {
	color: #00a32a;
	border-color: #00a32a;
}

/* ── Badges ──────────────────────────────────────────────────────────── */

.cfimg-badge {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 3px;
	font-size: 11px;
	font-weight: 500;
	vertical-align: middle;
	margin-left: 6px;
}

.cfimg-badge--recommended {
	background: #e7f5e8;
	color: #1a5e1f;
}

.cfimg-badge--flexible {
	background: #e7f5fe;
	color: #0a4b78;
}

.cfimg-badge--flex-warn {
	background: #fff3cd;
	color: #856404;
}

.cfimg-badge--flex-unknown {
	background: #f0f0f1;
	color: #646970;
}

.cfimg-badge--universal {
	background: #d4edda;
	color: #155724;
}

/* ── Highlighted preset card (deep link) ─────────────────────────────── */

.cfimg-preset-card--highlighted {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

/* ── Loading form spinner ────────────────────────────────────────────── */

.cfimg-loading-form {
	position: relative;
}

.cfimg-loading-form .cfimg-form-spinner {
	float: none;
	margin: 0 4px;
	vertical-align: middle;
}

.cfimg-loading-form.is-loading .cfimg-form-spinner {
	visibility: visible;
}

.cfimg-loading-form.is-loading button,
.cfimg-loading-form.is-loading input[type="submit"] {
	pointer-events: none;
	opacity: 0.6;
}

/* ── Post + Mapping form ─────────────────────────────────────────────── */

.cfimg-post-mapping-form {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.cfimg-no-spinner::-webkit-outer-spin-button,
.cfimg-no-spinner::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.cfimg-no-spinner {
	-moz-appearance: textfield;
}

.cfimg-form-arrow {
	font-size: 18px;
	color: #646970;
	margin: 0 4px;
}

/* ── Attachment ID validation ────────────────────────────────────────── */

#cfimg-attachment-status {
	margin-left: 8px;
	font-size: 13px;
}

#cfimg-attachment-status .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	vertical-align: text-bottom;
}

.cfimg-att-valid {
	color: #00a32a;
}

.cfimg-att-invalid {
	color: #d63638;
}

.cfimg-suggestions {
	margin-top: 8px;
	padding: 8px 12px;
	background: #f0f6fc;
	border-left: 4px solid #72aee6;
	font-size: 13px;
}

.cfimg-suggestions a {
	text-decoration: none;
	font-weight: 500;
}

/* ── Empty state ─────────────────────────────────────────────────────── */

.cfimg-empty-state {
	background: #f6f7f7;
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
	padding: 24px;
	text-align: center;
	margin-top: 16px;
}

.cfimg-empty-state p {
	margin: 0 0 12px;
	color: #646970;
}

/* ── Test Mapping results ─────────────────────────────────────────── */

.cfimg-test-results {
	display: none;
	margin-top: 12px;
	padding: 12px 16px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #f6f7f7;
	font-size: 13px;
	line-height: 1.6;
}

.cfimg-test-results dl {
	margin: 0;
	display: grid;
	grid-template-columns: 140px 1fr;
	gap: 4px 12px;
}

.cfimg-test-results dt {
	color: #646970;
	font-weight: 600;
}

.cfimg-test-results dd {
	margin: 0;
	word-break: break-all;
}

.cfimg-test-results .cfimg-test-status {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 500;
}

.cfimg-test-status--found {
	background: #e7f5e8;
	color: #1a5e1f;
}

.cfimg-test-status--missing {
	background: #fcf0f1;
	color: #8a1116;
}

.cfimg-test-status--new {
	background: #e7f5e8;
	color: #1a5e1f;
}

.cfimg-test-status--reupload {
	background: #fff3cd;
	color: #856404;
}

.cfimg-test-status--cached {
	background: #e5f5fa;
	color: #0a4b78;
}

.cfimg-test-status--skip {
	background: #f0f0f1;
	color: #50575e;
}

.cfimg-test-results .cfimg-test-error {
	color: #d63638;
	font-weight: 500;
}

/* ── Flexible Variants status ─────────────────────────────────────── */

.cfimg-flex-badge {
	font-weight: 600;
	display: inline-block;
}

.cfimg-flex--enabled {
	color: #00a32a;
}

.cfimg-flex--disabled {
	color: #d63638;
}

.cfimg-flex--unknown {
	color: #646970;
}

.cfimg-flex-actions {
	margin-top: 8px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.cfimg-flex-placeholder {
	background: #f0f0f1;
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
	padding: 40px 16px;
	text-align: center;
	color: #646970;
	font-style: italic;
}

/* ── FV Callout banner ───────────────────────────────────────────── */

.cfimg-fv-callout {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-left-width: 4px;
	border-radius: 4px;
	padding: 12px 16px;
	margin: 16px 0;
}

.cfimg-fv-callout--enabled {
	border-left-color: #00a32a;
}

.cfimg-fv-callout--disabled {
	border-left-color: #d63638;
}

.cfimg-fv-callout--unknown {
	border-left-color: #dba617;
}

.cfimg-fv-callout__title {
	font-weight: 600;
	margin: 0 0 4px;
}

.cfimg-fv-callout__text {
	margin: 0 0 8px;
	color: #646970;
}

.cfimg-fv-callout__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.cfimg-copy-url--disabled {
	opacity: 0.4;
	cursor: not-allowed;
	pointer-events: none;
}

/* ── Settings page sections ──────────────────────────────────────── */

.cfimg-settings-section {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 0 20px 16px;
	margin: 16px 0;
}

.cfimg-settings-section > h2 {
	margin: 16px 0 4px;
	padding: 0;
	font-size: 16px;
}

.cfimg-settings-section > p.description {
	margin: 0 0 8px;
}

.cfimg-settings-section .form-table {
	margin-top: 0;
}

.cfimg-settings-section .form-table th {
	width: 160px;
	padding-left: 0;
}

.cfimg-settings-advanced {
	background: #f6f7f7;
}

.cfimg-settings-advanced > summary {
	cursor: pointer;
	padding: 12px 0;
	list-style: none;
}

.cfimg-settings-advanced > summary::-webkit-details-marker {
	display: none;
}

.cfimg-settings-advanced > summary::before {
	content: "▶ ";
	font-size: 10px;
	margin-right: 6px;
	color: #646970;
}

.cfimg-settings-advanced[open] > summary::before {
	content: "▼ ";
}

/* ── Help details (expandable) ───────────────────────────────────── */

.cfimg-help-details {
	margin-top: 6px;
	font-size: 13px;
}

.cfimg-help-details summary {
	color: #2271b1;
	cursor: pointer;
	font-size: 12px;
}

.cfimg-help-details summary:hover {
	color: #135e96;
}

.cfimg-help-details p,
.cfimg-help-details ul {
	margin: 6px 0 0;
	padding-left: 16px;
	color: #646970;
	font-size: 12px;
}

.cfimg-help-details ul {
	margin-left: 4px;
	list-style: disc;
}

/* ── Connection Status box ───────────────────────────────────────── */

.cfimg-status-box {
	background: #f6f7f7;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 12px 16px;
	margin: 12px 0 0;
	max-width: 400px;
}

.cfimg-status-box h4 {
	margin: 0 0 10px;
	font-size: 13px;
	color: #1d2327;
}

.cfimg-status-box dl {
	margin: 0;
	display: grid;
	grid-template-columns: 120px 1fr;
	gap: 6px 12px;
	font-size: 13px;
}

.cfimg-status-box dt {
	color: #646970;
}

.cfimg-status-box dd {
	margin: 0;
}

.cfimg-status-indicator {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 500;
}

.cfimg-status--ok {
	background: #e7f5e8;
	color: #1a5e1f;
}

.cfimg-status--error {
	background: #fcf0f1;
	color: #8a1116;
}

.cfimg-status--pending {
	background: #f0f0f1;
	color: #646970;
}

.cfimg-status-timestamp {
	margin: 10px 0 0;
	font-size: 12px;
	color: #646970;
}

/* ── Dashboard page ──────────────────────────────────────────────────── */

.cfimg-dashboard-title {
	display: flex;
	align-items: center;
	gap: 12px;
}

.cfimg-cloudflare-icon {
	flex-shrink: 0;
}

.cfimg-dashboard-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 20px;
	margin-top: 20px;
}

.cfimg-dashboard-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 16px 20px;
}

.cfimg-dashboard-card h3 {
	margin: 0 0 12px;
	padding: 0;
	font-size: 14px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.cfimg-dashboard-card--status {
	border-left: 4px solid #2271b1;
}

.cfimg-dashboard-card--wide {
	grid-column: 1 / -1;
}

.cfimg-status-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 11px;
	font-weight: 500;
}

.cfimg-status-badge--ok {
	background: #e7f5e8;
	color: #1a5e1f;
}

.cfimg-status-list {
	margin: 0;
	display: grid;
	grid-template-columns: 130px 1fr;
	gap: 8px 12px;
	font-size: 13px;
}

.cfimg-status-list dt {
	color: #646970;
}

.cfimg-status-list dd {
	margin: 0;
}

.cfimg-status-actions {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid #f0f0f1;
}

/* Quick stats */
.cfimg-stats-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cfimg-stats-list li {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 0;
	border-bottom: 1px solid #f0f0f1;
}

.cfimg-stats-list li:last-child {
	border-bottom: 0;
}

.cfimg-stat-value {
	font-size: 24px;
	font-weight: 600;
	color: #1d2327;
	min-width: 40px;
}

.cfimg-stat-label {
	flex: 1;
	color: #646970;
}

.cfimg-stat-link {
	font-size: 13px;
	text-decoration: none;
}

/* Quick actions */
.cfimg-quick-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cfimg-quick-actions .button {
	text-align: center;
}

/* Recent activity mini table */
.cfimg-logs-mini {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.cfimg-logs-mini td {
	padding: 6px 8px;
	border-bottom: 1px solid #f0f0f1;
	vertical-align: top;
}

.cfimg-logs-mini tr:last-child td {
	border-bottom: 0;
}

.cfimg-logs-mini .cfimg-log-level {
	width: 60px;
	text-align: center;
}

.cfimg-logs-mini .cfimg-log-message {
	color: #1d2327;
	word-break: break-word;
}

.cfimg-logs-mini .cfimg-log-time {
	width: 80px;
	color: #646970;
	text-align: right;
	white-space: nowrap;
}

.cfimg-dashboard .cfimg-empty-state {
	margin-top: 0;
}

/* ── Dashboard Widget ────────────────────────────────────────────────── */

.cfimg-widget-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 8px;
}

.cfimg-widget-table td {
	padding: 4px 0;
	font-size: 13px;
	border: 0;
}

.cfimg-widget-table td:first-child {
	color: #646970;
}

.cfimg-widget-table td:last-child {
	text-align: right;
}

.cfimg-widget-timestamp {
	font-size: 12px;
	color: #646970;
	margin: 0 0 12px;
	padding-top: 4px;
	border-top: 1px solid #f0f0f1;
}

.cfimg-widget-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	font-size: 13px;
	padding: 10px 0;
	border-top: 1px solid #f0f0f1;
	margin-bottom: 10px;
}

.cfimg-widget-stats a {
	display: flex;
	align-items: center;
	gap: 4px;
	color: #646970;
	text-decoration: none;
}

.cfimg-widget-stats a:hover {
	color: #2271b1;
}

.cfimg-widget-stats .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.cfimg-widget-sep {
	color: #c3c4c7;
}

#cfimg_status_widget .cfimg-widget-stats .cfimg-widget-sep {
	display: none;
}

.cfimg-widget-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
}

.cfimg-widget-actions a {
	text-decoration: none;
}

.cfimg-widget-actions a:hover {
	text-decoration: underline;
}

/* ── Utility: initially hidden (JS-toggled) ─────────────────────────── */

.cfimg-hidden {
	display: none;
}

#cfimg-attachment-suggestions {
	display: none;
}

/* ── SVG icon in dashboard widget title ──────────────────────────────── */

.cfimg-cloudflare-icon-svg {
	width: 18px;
	height: 18px;
	vertical-align: text-bottom;
	margin-right: 6px;
}

/* ── Presets page: header row ────────────────────────────────────────── */

.cfimg-presets-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 20px 0 12px;
}

.cfimg-presets-header h2 {
	margin: 0;
}

/* ── Description variants ────────────────────────────────────────────── */

.cfimg-description-error {
	color: #d63638;
}

.cfimg-description-compact {
	margin: 8px 0;
}

/* ── Submit row: compact ─────────────────────────────────────────────── */

.cfimg-submit-compact {
	margin-top: 0;
	padding-top: 0;
}

/* ── Heading: inline ─────────────────────────────────────────────────── */

.cfimg-heading-inline {
	display: inline;
}

/* ── Notice: inline compact ──────────────────────────────────────────── */

.cfimg-notice-inline {
	padding: 8px 12px;
}
