/**
 * Email Logs admin styles.
 * Aligned with Redirect Manager / CPT Builder / shared PageHero screens.
 *
 * @package EmailLogs
 */

.wpps-email-logs {
	--wpps-el-accent: var(--wpps-accent, var(--wp-admin-theme-color, #2271b1));
	--wpps-el-accent-hover: var(--wpps-accent-hover, var(--wp-admin-theme-color-darker-10, #135e96));
	--wpps-el-accent-bg: color-mix(in srgb, var(--wpps-el-accent) 12%, #fff);
}

.wpps-email-logs .wpps-el-muted {
	color: #646970;
}

/* Hero meta buttons */
.wrap.wpps-email-logs .wpps-page-hero__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
}

.wrap.wpps-email-logs .wpps-page-hero__meta .button {
	margin: 0;
}

/* Privacy notice */
.wpps-email-logs .wpps-el-privacy-notice {
	margin: 0 0 16px;
}

/* Main panel */
.wpps-email-logs .wpps-el-panel {
	background: #fff;
	border: 1px solid #c3c4c7;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	padding: 20px 24px;
	margin: 0 0 24px;
}

.wpps-email-logs .wpps-el-panel-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #1d2327;
}

.wpps-email-logs .wpps-el-panel-title .wpps-el-count {
	font-weight: 400;
	color: #646970;
	margin-left: 8px;
}

.wpps-email-logs .wpps-el-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 16px 0 0;
	padding-top: 16px;
	border-top: 1px solid #dcdcde;
}

.wpps-email-logs .wpps-el-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin: 0;
}

.wpps-email-logs .wpps-el-search,
.wpps-email-logs .wpps-el-status-select {
	min-height: 32px;
}

.wpps-email-logs .wpps-el-delete-all-btn {
	color: #b32d2e;
	border-color: #b32d2e;
}

.wpps-email-logs .wpps-el-delete-all-btn:hover {
	background: #fcf0f1;
	border-color: #8a2424;
	color: #8a2424;
}

/* Log list */
.wpps-email-logs .wpps-el-logs-container {
	margin-top: 16px;
	border: 1px solid #c3c4c7;
	background: #fff;
}

.wpps-email-logs .wpps-el-log-item {
	border-bottom: 1px solid #dcdcde;
}

.wpps-email-logs .wpps-el-log-item:last-child {
	border-bottom: none;
}

.wpps-email-logs .wpps-el-log-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	cursor: pointer;
	gap: 12px;
	min-height: 52px;
	transition: background 0.15s ease;
}

.wpps-email-logs .wpps-el-log-header:hover,
.wpps-email-logs .wpps-el-log-header:focus-visible {
	background: var(--wpps-el-accent-bg);
	outline: none;
}

.wpps-email-logs .wpps-el-log-header.is-open {
	background: #f6f7f7;
}

.wpps-email-logs .wpps-el-log-main {
	flex: 1;
	min-width: 0;
}

.wpps-email-logs .wpps-el-log-subject {
	font-weight: 600;
	font-size: 14px;
	color: #1d2327;
	line-height: 1.4;
}

.wpps-email-logs .wpps-el-log-meta {
	font-size: 12px;
	color: #646970;
	margin-top: 4px;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}

.wpps-email-logs .wpps-el-meta-sep {
	opacity: 0.65;
}

.wpps-email-logs .wpps-el-log-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

/* Status pills (match CPT Builder / Redirect Manager) */
.wpps-email-logs .wpps-el-status {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.4;
	text-transform: capitalize;
}

.wpps-email-logs .wpps-el-status--sent {
	background: #edfaef;
	color: #1a7f37;
}

.wpps-email-logs .wpps-el-status--failed {
	background: #fcf0f1;
	color: #b32d2e;
}

.wpps-email-logs .wpps-el-status--pending {
	background: #f0f0f1;
	color: #646970;
}

.wpps-email-logs .wpps-el-log-content {
	display: none;
	padding: 16px;
	background: #f6f7f7;
	border-top: 1px solid #dcdcde;
}

.wpps-email-logs .wpps-el-log-content.is-open {
	display: block;
}

.wpps-email-logs .wpps-el-log-block {
	margin-bottom: 16px;
}

.wpps-email-logs .wpps-el-log-block:last-child {
	margin-bottom: 0;
}

.wpps-email-logs .wpps-el-log-block-label {
	font-weight: 600;
	font-size: 13px;
	margin-bottom: 6px;
	color: #1d2327;
}

.wpps-email-logs .wpps-el-log-block-body {
	padding: 12px;
	background: #fff;
	border: 1px solid #c3c4c7;
	font-family: Consolas, Monaco, monospace;
	font-size: 12px;
	white-space: pre-wrap;
	word-wrap: break-word;
	max-height: 300px;
	overflow-y: auto;
}

.wpps-email-logs .wpps-el-log-block-body.is-error {
	color: #b32d2e;
}

.wpps-email-logs .wpps-el-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: #fff;
	border: 1px solid #c3c4c7;
	cursor: pointer;
	color: #646970;
	transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.wpps-email-logs .wpps-el-btn-icon:hover,
.wpps-email-logs .wpps-el-btn-icon:focus-visible {
	border-color: var(--wpps-el-accent);
	color: var(--wpps-el-accent);
	background: var(--wpps-el-accent-bg);
	outline: none;
}

.wpps-email-logs .wpps-el-btn-icon .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.wpps-email-logs .wpps-el-accordion-icon {
	color: #646970;
	font-size: 16px;
	width: 16px;
	height: 16px;
	transition: transform 0.2s ease;
	flex-shrink: 0;
	margin-left: 4px;
}

.wpps-email-logs .wpps-el-log-header.is-open .wpps-el-accordion-icon {
	transform: rotate(180deg);
}

/* Empty state */
.wpps-email-logs .wpps-el-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 64px 32px;
}

.wpps-email-logs .wpps-el-empty .dashicons {
	display: block;
	font-size: 48px;
	width: 48px;
	height: 48px;
	color: var(--wpps-el-accent);
	margin-bottom: 4px;
}

.wpps-email-logs .wpps-el-empty h3 {
	margin: 16px 0 0;
	font-size: 18px;
	color: #1d2327;
}

.wpps-email-logs .wpps-el-empty .description {
	margin: 8px 0 0;
	max-width: 420px;
}

/* Pagination */
.wpps-email-logs .wpps-el-pagination {
	margin-top: 16px;
}

/* Modals */
.wpps-email-logs .wpps-el-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(0, 0, 0, 0.45);
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.wpps-email-logs .wpps-el-modal.is-open {
	display: flex;
}

.wpps-email-logs .wpps-el-modal-content,
.wpps-email-logs .wpps-el-preview-content {
	background: #fff;
	max-width: 520px;
	width: 100%;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	border: 1px solid #c3c4c7;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.wpps-email-logs .wpps-el-preview-content {
	max-width: 900px;
}

.wpps-email-logs .wpps-el-modal-header,
.wpps-email-logs .wpps-el-preview-header {
	padding: 16px 20px;
	border-bottom: 1px solid #dcdcde;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.wpps-email-logs .wpps-el-modal-header h3,
.wpps-email-logs .wpps-el-preview-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #1d2327;
}

.wpps-email-logs .wpps-el-modal-body {
	padding: 20px;
	overflow-y: auto;
}

.wpps-email-logs .wpps-el-modal-body .form-table th {
	padding: 12px 10px 12px 0;
}

.wpps-email-logs .wpps-el-modal-body .form-table td {
	padding: 12px 0;
}

.wpps-email-logs .wpps-el-modal-actions {
	margin: 20px 0 0;
	padding-top: 16px;
	border-top: 1px solid #dcdcde;
	display: flex;
	gap: 10px;
	align-items: center;
}

.wpps-email-logs .wpps-el-preview-frame {
	flex: 1;
	min-height: 400px;
	border: none;
}

@media (max-width: 782px) {
	.wpps-email-logs .wpps-el-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.wpps-email-logs .wpps-el-filters {
		width: 100%;
	}

	.wpps-email-logs .wpps-el-search {
		flex: 1 1 100%;
		min-width: 0;
	}
}
