/*
 * MCP Log – Cell + modal + security panel styles on top of @wordpress/dataviews.
 */

/* ── DataViews wrapper card ── */
.alfmcp-admin .dataviews-wrapper {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.alfmcp-admin .dataviews-view-table tr {
	border-top-color: #e0e0e0;
}
.alfmcp-admin .dataviews-view-table tr:hover {
	background: #f6f7f7;
}
.alfmcp-admin .dataviews-view-table tr:hover .dataviews-view-table__actions-column--sticky {
	background-color: #f6f7f7;
}
/* Always show row actions so the "View" button isn't hidden until hover. */
.alfmcp-admin .dataviews-view-table .dataviews-item-actions .components-button {
	opacity: 1 !important;
}
/* Pipe separator between adjacent row action buttons. */
.alfmcp-admin .dataviews-view-table .dataviews-item-actions .components-button + .components-button::before {
	content: '|';
	color: #c3c4c7;
	margin-right: 8px;
	pointer-events: none;
}
/* Dim rows that have been marked reviewed. */
.alfmcp-admin .dataviews-view-table tr:has(.alfmcp-row-reviewed) {
	opacity: 0.55;
}
.alfmcp-admin .dataviews-view-table tr:has(.alfmcp-row-reviewed):hover {
	opacity: 1;
}
/* Allow long text in selected cells to wrap instead of overflowing. */
.alfmcp-admin .dataviews-view-table .alfmcp-cell-multiline {
	white-space: normal;
	word-break: break-word;
	line-height: 1.4;
}

/* ── Tab-row action buttons (Logs tab Export CSV / Clear) ── */
.alfmcp-tabs-wrapper {
	position: relative;
}
.alfmcp-tab-actions {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 1;
	display: flex;
	gap: 8px;
	height: 40px;
	align-items: center;
}

/* ── Cell styling ── */
.alfmcp-code {
	background: #f0f0f0;
	padding: 2px 6px;
	border-radius: 2px;
	font-family: Consolas, Monaco, monospace;
	font-size: 12px;
}
.alfmcp-route {
	font-family: Consolas, Monaco, monospace;
	font-size: 12px;
	color: #646970;
	display: block;
	max-width: 280px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.alfmcp-muted {
	color: #949494;
	font-size: 12px;
}
.alfmcp-user {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
}
.alfmcp-user .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	color: #949494;
}
.alfmcp-cell-date {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

/* ── Status pills ── */
.alfmcp-pill {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 10px;
	font-size: 12px;
	font-weight: 500;
	background: #f0f0f0;
	color: #50575e;
}
.alfmcp-status-success {
	background: #d1fae5;
	color: #065f46;
}
.alfmcp-status-error {
	background: #fee2e2;
	color: #991b1b;
}
.alfmcp-status-unknown {
	background: #f0f0f0;
	color: #50575e;
}

/* ── Severity pills ── */
.alfmcp-severity-critical {
	background: #d63638;
	color: #fff;
}
.alfmcp-severity-warning {
	background: #dba617;
	color: #1d2327;
}

/* ── Modal panels ── */
.alfmcp-modal .components-panel__body > .components-panel__body-title > .components-button:hover {
	background: none !important;
}
.alfmcp-modal .components-panel__row {
	justify-content: flex-start !important;
	gap: 12px;
	margin: 0;
	padding: 8px 0;
}

/* ── Modal detail view ── */
.alfmcp-summary-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin: 16px 0;
	padding: 0;
	background: transparent;
}
.alfmcp-summary-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.alfmcp-copyable {
	display: flex;
	align-items: center;
	gap: 4px;
	min-width: 0;
}
.alfmcp-code-wrap {
	word-break: break-all;
}
.alfmcp-body-section {
	margin-top: 16px;
}
.alfmcp-body-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}
.alfmcp-body-header h5 {
	margin: 0;
}
.alfmcp-code-block {
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 12px;
	margin: 0;
	font-family: Consolas, Monaco, monospace;
	font-size: 12px;
	line-height: 1.6;
	overflow: auto;
	max-height: 300px;
	white-space: pre-wrap;
	word-break: break-word;
}

/* ── Session activity table (inside SessionReplay modal) ── */
.alfmcp-session-log {
	border: 1px solid #dcdcde;
	border-radius: 4px;
	overflow: hidden;
}
.alfmcp-session-log__header {
	display: grid;
	grid-template-columns: 80px 60px 1fr;
	gap: 12px;
	padding: 8px 12px;
	background: #f6f7f7;
	border-bottom: 1px solid #dcdcde;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #646970;
}
.alfmcp-session-log__body {
	max-height: 360px;
	overflow-y: auto;
}
.alfmcp-session-log__row {
	display: grid;
	grid-template-columns: 80px 60px 1fr;
	gap: 12px;
	align-items: center;
	padding: 8px 12px;
	border-bottom: 1px solid #f0f0f1;
	font-size: 13px;
}
.alfmcp-session-log__row:last-child {
	border-bottom: none;
}
.alfmcp-session-log__row:hover {
	background: #f6f7f7;
}

/* ── Settings layout ── */
.alfmcp-settings-row {
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: 24px;
	margin-bottom: 20px;
	align-items: start;
}
.alfmcp-settings-row__label {
	padding-top: 12px;
}
.alfmcp-settings-row__field .components-card {
	margin: 0;
}

/* Compact threshold / window / severity row */
.alfmcp-rule-fields {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 8px;
}
.alfmcp-rule-fields .components-base-control {
	margin-bottom: 0;
}
.alfmcp-rule-fields .components-text-control__input,
.alfmcp-rule-fields .components-select-control__input {
	min-width: 0;
}

/* Uniform 40px height for select inputs on the Settings tab.
 * !important needed to beat @wordpress/components emotion CSS-in-JS specificity. */
.alfmcp-settings-row .components-select-control__input,
.alfmcp-rule-fields .components-select-control__input,
.alfmcp-email-row .components-select-control__input {
	height: 40px !important;
	min-height: 40px !important;
}

/* ── Email list rows ── */
.alfmcp-email-row {
	display: flex;
	align-items: center;
	gap: 4px;
}
.alfmcp-email-row .components-base-control {
	flex: 1;
	margin-bottom: 0;
}

/* ── Responsive ── */
@media screen and (max-width: 782px) {
	.alfmcp-settings-row {
		grid-template-columns: 1fr;
		gap: 8px;
	}
	.alfmcp-settings-row__label {
		padding-top: 0;
	}
	.alfmcp-rule-fields {
		grid-template-columns: 1fr;
	}
	.alfmcp-stats-cards > div {
		grid-template-columns: repeat(2, 1fr);
	}
}
