/**
 * Email Logs admin — matches Email Delivery / module chrome.
 *
 * @package EmailLogs
 */

.wrap.wpps-email-logs.wpps-el-wrap,
.wrap.wpps-email-logs {
	margin: 20px 20px 20px 0;
	max-width: none !important;
	width: auto;
	box-sizing: border-box;
	--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(--wp-admin-theme-color, #2271b1) 12%, #fff);
	--wpps-el-black: #1d2327;
	--wpps-el-muted: #50575e;
	--wpps-el-gray: #646970;
	--wpps-el-border: #c3c4c7;
	--wpps-el-divider: #dcdcde;
	--wpps-el-surface: #f0f0f1;
	--wpps-el-bg: #f6f7f7;
	--wpps-el-white: #fff;
	--wpps-el-success: #00a32a;
	--wpps-el-danger: #d63638;
	--wpps-el-warning: #dba617;
	--wpps-el-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.wrap.wpps-email-logs .wpps-page-hero,
.wrap.wpps-email-logs .wpps-el-panel {
	max-width: none;
}

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

.wpps-el-panel {
	background: var(--wpps-el-white);
	border: 1px solid var(--wpps-el-border);
	box-shadow: var(--wpps-el-shadow);
	margin-bottom: 20px;
}

.wpps-el-panel-title {
	margin: 0;
	padding: 14px 20px;
	font-size: 15px;
	font-weight: 600;
	color: var(--wpps-el-black);
	border-bottom: 1px solid var(--wpps-el-divider);
}

.wpps-el-panel-title--split {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.wpps-el-panel-meta {
	font-size: 13px;
	font-weight: 400;
	color: var(--wpps-el-gray);
}

.wpps-el-panel-body {
	padding: 16px 20px 18px;
}

.wpps-el-panel-body--table {
	padding-top: 8px;
}

.wpps-el-filter-row {
	display: grid;
	grid-template-columns: minmax(220px, 1.4fr) minmax(140px, 0.7fr) minmax(140px, 0.7fr) auto;
	gap: 12px 16px;
	align-items: end;
}

@media screen and (max-width: 1100px) {
	.wpps-el-filter-row {
		grid-template-columns: 1fr 1fr;
	}
}

@media screen and (max-width: 782px) {
	.wpps-el-filter-row {
		grid-template-columns: 1fr;
	}
}

.wpps-el-filter-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.wpps-el-filter-group label,
.wpps-el-filter-group-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--wpps-el-muted);
}

.wpps-el-filter-group input[type="search"],
.wpps-el-filter-group select {
	width: 100%;
	max-width: 100%;
}

.wpps-el-filter-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.wpps-email-logs .subsubsub {
	margin: 0 0 12px;
	padding: 0 0 12px;
	width: 100%;
	border-bottom: 1px solid var(--wpps-el-divider);
	float: none;
}

.wpps-email-logs .subsubsub a {
	padding: 4px 2px;
}

.wpps-email-logs .subsubsub a.current {
	font-weight: 600;
	color: var(--wpps-el-black);
}

.wpps-email-logs .wp-list-table {
	border: none !important;
	box-shadow: none !important;
}

.wpps-email-logs .wp-list-table thead th,
.wpps-email-logs .wp-list-table thead td {
	border-bottom: 1px solid var(--wpps-el-divider);
}

.wpps-email-logs .wp-list-table tbody td {
	vertical-align: middle;
	padding-top: 12px;
	padding-bottom: 12px;
}

.wpps-email-logs .wp-list-table .row-actions {
	left: 0;
}

.wpps-email-logs .tablenav {
	margin: 8px 0 12px;
	height: auto;
}

.wpps-email-logs .tablenav.bottom {
	margin-top: 12px;
	padding-top: 4px;
	border-top: 1px solid var(--wpps-el-divider);
}

.wpps-el-table-actions {
	display: flex;
	gap: 8px;
}

.wpps-el-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.4;
	text-transform: capitalize;
	background: var(--wpps-el-surface);
	color: var(--wpps-el-muted);
}

.wpps-el-badge--sent {
	background: #edfaef;
	color: #1a7f37;
}

.wpps-el-badge--failed {
	background: #fcf0f1;
	color: #b32d2e;
}

.wpps-el-badge--pending {
	background: var(--wpps-el-surface);
	color: var(--wpps-el-gray);
}

.wpps-el-delivery--accepted,
.wpps-el-delivery--delivered {
	background: #edfaef;
	color: #1a7f37;
}

.wpps-el-delivery--bounced,
.wpps-el-delivery--rejected,
.wpps-el-delivery--complained {
	background: #fcf0f1;
	color: #b32d2e;
}

.wpps-el-delivery--deferred {
	background: #fcf9e8;
	color: #996800;
}

.wpps-el-mono,
.wpps-el-provider {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
}

.wpps-el-meta,
.wpps-el-date {
	font-size: 13px;
	color: var(--wpps-el-muted);
}

.wpps-el-muted {
	color: var(--wpps-el-gray);
}

.wpps-el-error {
	color: var(--wpps-el-danger);
}

.wpps-el-loading {
	color: var(--wpps-el-muted);
	margin: 8px 0;
}

.wpps-el-pre {
	margin: 0;
	white-space: pre-wrap;
	word-break: break-word;
	max-height: 280px;
	overflow: auto;
	background: var(--wpps-el-bg);
	padding: 12px 14px;
	border: 1px solid var(--wpps-el-divider);
	font-size: 12px;
	line-height: 1.5;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.wpps-el-view {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.wpps-el-view-meta {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px 16px;
	padding: 14px 16px;
	background: var(--wpps-el-bg);
	border: 1px solid var(--wpps-el-divider);
}

@media screen and (max-width: 600px) {
	.wpps-el-view-meta {
		grid-template-columns: 1fr;
	}
}

.wpps-el-view-meta__item {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.wpps-el-view-meta__label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--wpps-el-gray);
}

.wpps-el-view-meta__value {
	font-size: 13px;
	color: var(--wpps-el-black);
	word-break: break-word;
}

.wpps-el-view-meta__value a {
	color: var(--wpps-el-accent);
	text-decoration: none;
}

.wpps-el-view-meta__value a:hover {
	color: var(--wpps-el-accent-hover);
	text-decoration: underline;
}

.wpps-el-view-msgid {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.wpps-el-view-msgid__row {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.wpps-el-view-msgid code {
	flex: 1 1 auto;
	min-width: 0;
	padding: 8px 10px;
	background: var(--wpps-el-bg);
	border: 1px solid var(--wpps-el-divider);
	font-size: 12px;
	word-break: break-all;
}

.wpps-el-view-alert {
	padding: 12px 14px;
	background: #fcf0f1;
	border: 1px solid #f0b7b8;
	color: #8a2424;
}

.wpps-el-view-alert strong {
	display: block;
	margin-bottom: 4px;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.wpps-el-view-alert p {
	margin: 0;
	font-size: 13px;
	line-height: 1.45;
}

.wpps-el-view-panel {
	border: 1px solid var(--wpps-el-divider);
	background: var(--wpps-el-white);
}

.wpps-el-view-panel > summary {
	cursor: pointer;
	list-style: none;
	padding: 10px 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--wpps-el-black);
	background: var(--wpps-el-bg);
	border-bottom: 1px solid transparent;
	user-select: none;
}

.wpps-el-view-panel > summary.wpps-el-view-panel__summary {
	display: flex;
	align-items: center;
	gap: 8px;
}

.wpps-el-view-panel__label {
	flex: 0 0 auto;
	min-width: 0;
}

.wpps-el-view-panel__summary:not(:has(.wpps-el-view-panel__hint)):not(:has(.wpps-el-preview-eye)) .wpps-el-view-panel__label {
	flex: 1 1 auto;
}

.wpps-el-view-panel__hint {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 12px;
	font-weight: 400;
	color: var(--wpps-el-gray);
	text-align: right;
}

.wpps-el-view-panel .wpps-el-view-meta,
.wpps-el-view-panel .wpps-el-view-msgid {
	padding: 12px 14px;
}

.wpps-el-view-panel .wpps-el-view-msgid {
	padding-top: 0;
	border-top: 0;
}

.wpps-el-view-panel[open] > summary {
	border-bottom-color: var(--wpps-el-divider);
}

.wpps-el-view-panel > summary::-webkit-details-marker {
	display: none;
}

.wpps-el-view-panel > summary::after {
	content: "\f140";
	font-family: dashicons;
	color: var(--wpps-el-gray);
	font-weight: 400;
	font-size: 16px;
	line-height: 1.2;
	flex: 0 0 auto;
}

.wpps-el-view-panel[open] > summary::after {
	content: "\f142";
}

.wpps-el-preview-eye {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: 0 0 0 auto;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--wpps-el-gray);
	cursor: pointer;
	flex: 0 0 auto;
	line-height: 1;
}

.wpps-el-preview-eye .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.wpps-el-preview-eye:hover,
.wpps-el-preview-eye:focus {
	color: var(--wpps-el-accent);
	background: var(--wpps-el-accent-bg);
	outline: none;
}

.wpps-el-view-panel .wpps-el-pre {
	border: 0;
	max-height: 240px;
}

.wpps-el-view-panel .wpps-el-headers-grid + .wpps-el-pre {
	border-top: 1px solid var(--wpps-el-divider);
}

.wpps-el-headers-grid {
	margin: 0;
	padding: 12px 14px;
	display: grid;
	gap: 8px 16px;
}

.wpps-el-headers-grid__row {
	display: grid;
	grid-template-columns: 120px minmax(0, 1fr);
	gap: 8px 12px;
	align-items: start;
}

.wpps-el-headers-grid__row dt {
	margin: 0;
	font-size: 12px;
	font-weight: 600;
	color: var(--wpps-el-gray);
}

.wpps-el-headers-grid__row dd {
	margin: 0;
	font-size: 13px;
	color: var(--wpps-el-black);
	word-break: break-word;
}

.wpps-el-attachments {
	list-style: none;
	margin: 0;
	padding: 8px 0;
}

.wpps-el-attachments__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--wpps-el-divider);
	font-size: 13px;
}

.wpps-el-attachments__item:last-child {
	border-bottom: 0;
}

.wpps-el-attachments__item .dashicons {
	color: var(--wpps-el-gray);
	font-size: 18px;
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
}

.wpps-el-attachments__name {
	flex: 1 1 auto;
	min-width: 0;
	word-break: break-all;
	color: var(--wpps-el-black);
}

.wpps-el-attachments__size {
	flex: 0 0 auto;
	color: var(--wpps-el-muted);
	font-size: 12px;
	white-space: nowrap;
}

.wpps-el-view-empty {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 16px 14px;
	color: var(--wpps-el-muted);
	font-size: 13px;
	line-height: 1.45;
}

.wpps-el-view-empty .dashicons {
	color: var(--wpps-el-gray);
	margin-top: 1px;
}

.wpps-el-view-empty p {
	margin: 0;
}

/* Modals */
body.wpps-el-modal-open {
	overflow: hidden;
}

.wpps-email-logs .wpps-el-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100100;
	background: rgba(0, 0, 0, 0.55);
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

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

.wpps-email-logs .wpps-el-modal-dialog {
	background: var(--wpps-el-white);
	width: min(560px, 100%);
	max-height: min(90vh, 900px);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	border: 1px solid var(--wpps-el-border);
}

.wpps-email-logs .wpps-el-modal-dialog--wide {
	width: min(760px, 100%);
}

.wpps-email-logs .wpps-el-modal-dialog--view {
	width: min(720px, 100%);
}

.wpps-email-logs .wpps-el-modal-dialog--preview {
	width: min(920px, 100%);
	height: min(80vh, 740px);
}

.wpps-email-logs .wpps-el-modal-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px;
	border-bottom: 1px solid var(--wpps-el-divider);
	background: var(--wpps-el-bg);
	flex: 0 0 auto;
}

.wpps-email-logs .wpps-el-modal-header__text {
	min-width: 0;
	flex: 1 1 auto;
}

.wpps-email-logs .wpps-el-modal-kicker {
	margin: 0 0 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wpps-el-gray);
}

.wpps-email-logs .wpps-el-modal-header h2 {
	margin: 0;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--wpps-el-black);
	word-break: break-word;
}

.wpps-email-logs .wpps-el-modal-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
}

.wpps-email-logs .wpps-el-modal-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #50575e;
	cursor: pointer;
	text-decoration: none;
	flex: 0 0 auto;
}

.wpps-email-logs .wpps-el-modal-close:hover {
	color: #1d2327;
}

.wpps-email-logs .wpps-el-modal-body {
	padding: 16px 18px 18px;
	overflow: auto;
	flex: 1 1 auto;
}

.wpps-email-logs .wpps-el-modal-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 18px;
	border-top: 1px solid var(--wpps-el-divider);
	background: var(--wpps-el-bg);
	flex: 0 0 auto;
}

.wpps-email-logs .wpps-el-modal-footer[hidden] {
	display: none;
}

.wpps-email-logs .wpps-el-modal-footer__start,
.wpps-email-logs .wpps-el-modal-footer__end {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.wpps-email-logs .wpps-el-modal-actions {
	display: flex;
	gap: 8px;
	margin: 8px 0 0;
}

.wpps-el-preview-toolbar {
	display: flex;
	justify-content: flex-end;
	padding: 8px 14px 0;
}

.wpps-email-logs .wpps-el-preview-frame {
	flex: 1 1 auto;
	width: 100%;
	border: 0;
	background: #fff;
	min-height: 360px;
	height: 100%;
}

/* Dashboard widget — aligned with Content Report / 404 widgets */
#wpps_email_logs_dashboard .inside {
	padding: 14px 16px;
	margin: 0;
}

.wpps-el-dash {
	min-width: 0;
}

.wpps-el-dash-intro {
	margin: 0 0 12px;
}

.wpps-el-dash-stats {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
	margin: 0 0 14px;
	min-width: 0;
}

.wpps-el-dash-stat {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 12px 10px;
	text-align: center;
	min-width: 0;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.wpps-el-dash-stat a {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	text-decoration: none;
	color: inherit;
	box-sizing: border-box;
}

.wpps-el-dash-stat:hover {
	border-color: #cbd5e1;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.wpps-el-dash-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin-bottom: 6px;
	color: #646970;
}

.wpps-el-dash-icon .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.wpps-el-dash-value {
	display: block;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.3;
	color: #1e293b;
	margin-bottom: 2px;
}

.wpps-el-dash-label {
	display: block;
	font-size: 11px;
	font-weight: 500;
	color: #64748b;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}

.wpps-el-dash-stat--today .wpps-el-dash-icon { color: #2271b1; }
.wpps-el-dash-stat--today:hover {
	border-color: #2271b1;
	box-shadow: 0 2px 8px rgba(34, 113, 177, 0.12);
}
.wpps-el-dash-stat--today:hover .wpps-el-dash-value { color: #2271b1; }

.wpps-el-dash-stat--sent .wpps-el-dash-icon { color: #00a32a; }
.wpps-el-dash-stat--sent:hover {
	border-color: #00a32a;
	box-shadow: 0 2px 8px rgba(0, 163, 42, 0.12);
}
.wpps-el-dash-stat--sent:hover .wpps-el-dash-value { color: #00a32a; }

.wpps-el-dash-stat--failed .wpps-el-dash-icon { color: #d63638; }
.wpps-el-dash-stat--failed:hover {
	border-color: #d63638;
	box-shadow: 0 2px 8px rgba(214, 54, 56, 0.12);
}
.wpps-el-dash-stat--failed:hover .wpps-el-dash-value { color: #d63638; }

.wpps-el-dash-stat--bounced .wpps-el-dash-icon { color: #dba617; }
.wpps-el-dash-stat--bounced:hover {
	border-color: #dba617;
	box-shadow: 0 2px 8px rgba(219, 166, 23, 0.14);
}
.wpps-el-dash-stat--bounced:hover .wpps-el-dash-value { color: #dba617; }

.wpps-el-dash-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
}

.wpps-el-dash-actions .button {
	flex: 1 1 auto;
	text-align: center;
	justify-content: center;
	box-sizing: border-box;
}

@media screen and (max-width: 782px) {
	.wpps-el-dash-stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media screen and (max-width: 400px) {
	.wpps-el-dash-stats {
		grid-template-columns: minmax(0, 1fr);
	}
}
