@charset "UTF-8";

/* Logs list and modal */
.mail-doctor-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--mail-doctor-space-md);
	margin: var(--mail-doctor-space-xl) 0 var(--mail-doctor-space-lg);
	padding: var(--mail-doctor-space-md) var(--mail-doctor-space-lg);
	background: var(--mail-doctor-color-surface);
	border: 1px solid var(--mail-doctor-color-border);
	border-radius: var(--mail-doctor-radius-md);
	box-shadow: var(--mail-doctor-shadow-xs);
}

.mail-doctor-filter-bar label {
	display: flex;
	flex-direction: column;
	gap: var(--mail-doctor-space-xxs);
	min-width: 180px;
}

.mail-doctor-filter-bar label .mail-doctor-filter-bar__label {
	color: var(--mail-doctor-color-muted);
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.mail-doctor-filter-bar input[type="text"],
.mail-doctor-filter-bar input[type="number"],
.mail-doctor-filter-bar select {
	min-width: 160px;
	width: 100%;
	padding: 6px 10px;
	min-height: 36px;
	height: 36px;
	line-height: 1.4;
	border-radius: var(--mail-doctor-radius-sm);
	border: 1px solid var(--mail-doctor-color-border);
	background-color: var(--mail-doctor-color-surface);
	box-shadow: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mail-doctor-filter-bar .select2-container {
	min-width: 160px;
	width: 100% !important;
	min-height: 36px;
}

.mail-doctor-filter-bar .select2-container--default .select2-selection--single {
	height: 36px;
	min-height: 36px;
	padding: 6px 36px 6px 10px;
	border-radius: var(--mail-doctor-radius-sm);
	border: 1px solid var(--mail-doctor-color-border);
	display: flex;
	align-items: center;
	box-sizing: border-box;
}

.mail-doctor-filter-bar .select2-container--default .select2-selection--single .select2-selection__rendered {
	flex: 1 1 auto;
	margin: 0;
	padding: 0;
	line-height: 1.4;
}

.mail-doctor-filter-bar .select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 100%;
	top: 50%;
	transform: translateY(-50%);
	right: 10px;
}

.mail-doctor-filter-bar input[type="text"]:focus-visible,
.mail-doctor-filter-bar input[type="number"]:focus-visible,
.mail-doctor-filter-bar select:focus-visible {
	border-color: rgba(79, 70, 229, 0.6);
	box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.35);
	outline: none;
}

.mail-doctor-filter-bar .select2-container--default.select2-container--focus .select2-selection--single,
.mail-doctor-filter-bar .select2-container--default .select2-selection--single:focus {
	border-color: rgba(79, 70, 229, 0.6);
	box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.35);
	outline: none;
}

.mail-doctor-filter-bar .button {
	border-radius: var(--mail-doctor-radius-sm);
}

.mail-doctor-filter-bar .button+.button {
	margin-left: var(--mail-doctor-space-xs);
}

.mail-doctor-filter-bar .button:focus-visible {
	outline: 2px solid var(--mail-doctor-color-accent);
	outline-offset: 1px;
}

.mail-doctor-filter-bar-actions {
	display: flex;
	gap: var(--mail-doctor-space-xs);
	flex-wrap: wrap;
	margin-left: auto;
}

.mail-doctor-filter-bar-actions .button {
	margin-left: 0;
}

.maildoctor-admin-wrap .wp-list-table {
	border-spacing: 0;
	border-collapse: separate;
	border: 1px solid var(--mail-doctor-color-border);
	border-radius: var(--mail-doctor-radius-md);
	overflow: auto;
	box-shadow: var(--mail-doctor-shadow-xs);
	background: var(--mail-doctor-color-surface);
}

.maildoctor-admin-wrap .wp-list-table thead th {
	background: rgba(79, 70, 229, 0.04);
	color: var(--mail-doctor-color-muted);
	font-weight: 600;
}

.maildoctor-admin-wrap .wp-list-table tbody tr {
	transition: background 0.18s ease, box-shadow 0.18s ease;
}

.maildoctor-admin-wrap .wp-list-table tbody tr:nth-child(odd) {
	background: rgba(246, 247, 247, 0.55);
}

.maildoctor-admin-wrap .wp-list-table tbody tr:hover,
.maildoctor-admin-wrap .wp-list-table tbody tr:focus-within {
	background: var(--mail-doctor-color-neutral-soft);
	box-shadow: inset 2px 0 0 rgba(79, 70, 229, 0.35);
}

.maildoctor-admin-wrap .wp-list-table td,
.maildoctor-admin-wrap .wp-list-table th {
	padding: var(--mail-doctor-space-md) var(--mail-doctor-space-lg);
	vertical-align: middle;
}

.maildoctor-admin-wrap .wp-list-table td.column-status {
	position: relative;
}

.maildoctor-admin-wrap .wp-list-table td.column-status .mail-doctor-badge {
	display: inline-flex;
	align-items: center;
	gap: var(--mail-doctor-space-xs);
}

.maildoctor-admin-wrap .wp-list-table td.column-status .mail-doctor-badge.is-ok {
	box-shadow: 0 0 8px rgba(16, 185, 129, 0.25), inset 0 0 0 1px rgba(16, 185, 129, 0.15) !important;
}

.maildoctor-admin-wrap .wp-list-table td.column-status .mail-doctor-badge.is-warn {
	box-shadow: 0 0 0 1px rgba(138, 75, 31, 0.25);
}

.maildoctor-admin-wrap .wp-list-table td.column-status .mail-doctor-badge.is-fail {
	box-shadow: 0 0 4px rgba(239, 68, 68, 0.2), inset 0 0 0 1px rgba(239, 68, 68, 0.15);
	animation: mail-doctor-badge-pulse-red 2.5s infinite ease-in-out;
}

.maildoctor-admin-wrap .wp-list-table td.column-status .mail-doctor-badge.is-retrying {
	box-shadow: 0 0 8px rgba(249, 115, 22, 0.2), inset 0 0 0 1px rgba(249, 115, 22, 0.15) !important;
}

.maildoctor-admin-wrap .wp-list-table td.column-actions {
	min-width: 120px;
	white-space: normal;
	overflow-wrap: anywhere;
}

.maildoctor-admin-wrap .wp-list-table td.column-actions .mail-doctor-log-action {
	color: var(--mail-doctor-color-accent);
	text-decoration: none;
	padding: 0;
	margin: 0;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.maildoctor-admin-wrap .wp-list-table td.column-actions .mail-doctor-log-action:hover,
.maildoctor-admin-wrap .wp-list-table td.column-actions .mail-doctor-log-action:focus-visible {
	text-decoration: underline;
	outline: none;
}

.maildoctor-admin-wrap .wp-list-table .no-items,
.mail-doctor-log-empty,
.mail-doctor-log-loading {
	padding: var(--mail-doctor-space-xl);
	text-align: center;
	color: var(--mail-doctor-color-muted);
}

.mail-doctor-log-empty strong,
.mail-doctor-log-loading strong {
	display: block;
	margin-bottom: var(--mail-doctor-space-sm);
	color: var(--mail-doctor-color-text);
	font-size: 16px;
}

.mail-doctor-log-loading::after {
	content: '';
	display: inline-block;
	width: 16px;
	height: 16px;
	margin-left: var(--mail-doctor-space-xs);
	border: 2px solid var(--mail-doctor-color-accent);
	border-top-color: transparent;
	border-radius: 50%;
	animation: mail-doctor-spinner 0.8s linear infinite;
	vertical-align: middle;
}

.mail-doctor-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	padding: var(--mail-doctor-space-lg);
}

.mail-doctor-modal:not(.mail-doctor-hidden) {
	animation: mail-doctor-overlay-fade 0.2s ease;
}

.mail-doctor-modal__overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(12, 18, 28, 0.45);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.mail-doctor-modal:not(.mail-doctor-hidden) .mail-doctor-modal__overlay {
	opacity: 1;
}

.mail-doctor-modal__content {
	position: relative;
	background: var(--mail-doctor-color-surface);
	border-radius: var(--mail-doctor-radius-lg);
	max-width: 640px;
	width: 90%;
	max-height: 80vh;
	overflow: auto;
	padding: var(--mail-doctor-space-xl);
	box-shadow: var(--mail-doctor-shadow-lg);
	z-index: 2;
	transform: translateY(12px) scale(0.97);
	opacity: 0;
	transition: transform 0.24s ease, opacity 0.24s ease;
}

.mail-doctor-modal:not(.mail-doctor-hidden) .mail-doctor-modal__content {
	transform: translateY(0) scale(1);
	opacity: 1;
}

.mail-doctor-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	border: none;
	background: var(--mail-doctor-color-neutral-soft);
	color: var(--mail-doctor-color-text);
	font-size: 24px;
	cursor: pointer;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mail-doctor-modal__close:hover,
.mail-doctor-modal__close:focus-visible {
	background: var(--mail-doctor-color-accent-soft);
	color: var(--mail-doctor-color-accent);
	outline: none;
	box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25);
}

.mail-doctor-modal__body {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: var(--mail-doctor-space-xl);
}

.mail-doctor-log-overview {
	background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(79, 70, 229, 0.01));
	border: 1px solid rgba(79, 70, 229, 0.15);
	border-radius: var(--mail-doctor-radius-lg);
	padding: var(--mail-doctor-space-lg);
}

.mail-doctor-log-overview__header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--mail-doctor-space-md);
	margin-bottom: var(--mail-doctor-space-lg);
	padding-bottom: var(--mail-doctor-space-md);
	border-bottom: 1px solid rgba(79, 70, 229, 0.1);
}

.mail-doctor-log-subject {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: var(--mail-doctor-color-text);
	line-height: 1.3;
}

.mail-doctor-log-status {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	border-radius: 9999px;
	white-space: nowrap;
}
.mail-doctor-log-status:empty { display: none; }
.mail-doctor-log-status:contains("sent"), .mail-doctor-log-status[data-value="sent"] {
	background: #ecfdf5;
	color: #065f46;
	box-shadow: 0 0 8px rgba(16, 185, 129, 0.25), 0 0 0 1px rgba(16, 185, 129, 0.2) !important;
}
.mail-doctor-log-status:contains("failed"), .mail-doctor-log-status[data-value="failed"] {
	background: #fef2f2;
	color: #991b1b;
	box-shadow: 0 0 4px rgba(239, 68, 68, 0.2), 0 0 0 1px rgba(239, 68, 68, 0.2);
	animation: mail-doctor-badge-pulse-red 2.5s infinite ease-in-out;
}
.mail-doctor-log-status:contains("retrying"), .mail-doctor-log-status[data-value="retrying"] {
	background: #fff7ed;
	color: #c2410c;
	box-shadow: 0 0 8px rgba(249, 115, 22, 0.2), 0 0 0 1px rgba(249, 115, 22, 0.2) !important;
}
.mail-doctor-log-status:contains("retrying")::before, .mail-doctor-log-status[data-value="retrying"]::before {
	font-family: dashicons;
	content: "\f463";
	margin-right: 6px;
	animation: mail-doctor-spin 1.5s linear infinite;
	display: inline-block;
}

.mail-doctor-log-overview__grid,
.mail-doctor-log-tech-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: var(--mail-doctor-space-md) var(--mail-doctor-space-lg);
}

.mail-doctor-log-detail-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.mail-doctor-log-detail-full {
	grid-column: 1 / -1;
}

.mail-doctor-log-detail-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
	color: var(--mail-doctor-color-muted);
}

.mail-doctor-log-detail-value {
	font-size: 14px;
	color: var(--mail-doctor-color-text);
	word-break: break-all;
}

.mail-doctor-error-text {
	color: #d63638;
	font-family: monospace;
	background: rgba(214, 54, 56, 0.05);
	padding: var(--mail-doctor-space-xs) var(--mail-doctor-space-sm);
	border-radius: var(--mail-doctor-radius-sm);
	border-left: 3px solid #d63638;
}

.mail-doctor-log-section-title {
	margin: 0 0 var(--mail-doctor-space-md) 0;
	padding-bottom: var(--mail-doctor-space-sm);
	border-bottom: 1px solid var(--mail-doctor-color-border);
	font-size: 14px;
	font-weight: 600;
	color: var(--mail-doctor-color-text);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.mail-doctor-log-code-blocks {
	margin-top: var(--mail-doctor-space-xl);
	display: flex;
	flex-direction: column;
	gap: var(--mail-doctor-space-lg);
}

.mail-doctor-log-code-title {
	margin: 0 0 var(--mail-doctor-space-sm) 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--mail-doctor-color-muted);
}

.mail-doctor-log-code-item pre {
	margin: 0;
	padding: var(--mail-doctor-space-md);
	background: var(--mail-doctor-color-neutral-soft);
	border-radius: var(--mail-doctor-radius-md);
	border: 1px solid var(--mail-doctor-color-border);
	max-height: 250px;
	overflow: auto;
	font-size: 12px;
	line-height: 1.5;
	color: var(--mail-doctor-color-text);
	white-space: pre-wrap;
	word-wrap: break-word;
	word-break: break-all;
}

.mail-doctor-log-view-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.mail-doctor-log-view-columns {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: var(--mail-doctor-space-xl);
	align-items: start;
	min-width: 0;
}

.mail-doctor-log-view-main,
.mail-doctor-log-view-sidebar {
	min-width: 0;
}

.mail-doctor-log-view-main {
	display: flex;
	flex-direction: column;
	gap: var(--mail-doctor-space-xl);
	min-width: 0;
}

.mail-doctor-log-view-sidebar {
	display: flex;
	flex-direction: column;
	gap: var(--mail-doctor-space-xl);
	min-width: 0;
}

.mail-doctor-log-sidebar-card {
	background: var(--mail-doctor-color-surface);
	border: 1px solid var(--mail-doctor-color-border);
	border-radius: var(--mail-doctor-radius-lg);
	padding: var(--mail-doctor-space-lg);
	box-shadow: var(--mail-doctor-shadow-sm);
}

.mail-doctor-log-actions-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--mail-doctor-space-sm);
}

.mail-doctor-log-actions-list li {
	margin: 0;
}

.mail-doctor-action-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--mail-doctor-color-accent);
	text-decoration: none;
	font-weight: 500;
	font-size: 13px;
	padding: var(--mail-doctor-space-xs) 0;
	transition: color 0.15s ease;
}

.mail-doctor-action-link:hover,
.mail-doctor-action-link:focus {
	color: var(--mail-doctor-color-text);
}

.mail-doctor-action-link.mail-doctor-color-error {
	color: var(--mail-doctor-color-error);
}

.mail-doctor-action-link.mail-doctor-color-error:hover,
.mail-doctor-action-link.mail-doctor-color-error:focus {
	color: #a00;
}

.mail-doctor-action-link .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

@media (max-width: 960px) {
	.mail-doctor-filter-bar {
		gap: var(--mail-doctor-space-sm);
	}

	.mail-doctor-filter-bar label {
		min-width: 45%;
	}
	
	.mail-doctor-log-view-columns {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 782px) {
	.mail-doctor-filter-bar {
		flex-direction: column;
		align-items: stretch;
	}

	.mail-doctor-filter-bar label,
	.mail-doctor-filter-bar input[type="text"],
	.mail-doctor-filter-bar input[type="number"],
	.mail-doctor-filter-bar select {
		min-width: 100%;
	}

	.mail-doctor-filter-bar .button,
	.mail-doctor-filter-bar-actions {
		width: 100%;
	}

	.mail-doctor-filter-bar .button {
		margin-left: 0;
	}

	.mail-doctor-filter-bar-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.mail-doctor-modal {
		padding: var(--mail-doctor-space-md);
	}

	.mail-doctor-modal__content {
		padding: var(--mail-doctor-space-lg);
	}

	.mail-doctor-modal__body dl {
		grid-template-columns: 1fr;
	}
}

@keyframes mail-doctor-spinner {
	to {
		transform: rotate(360deg);
	}
}

@keyframes mail-doctor-overlay-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

/* ==========================================================================
   Slide-over Drawer for Log Details
   ========================================================================== */

.mail-doctor-drawer {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 99999;
	visibility: hidden;
	pointer-events: none;
}

body.admin-bar .mail-doctor-drawer {
	top: 32px;
	height: calc(100% - 32px);
}

.mail-doctor-drawer.is-active {
	visibility: visible;
	pointer-events: auto;
}

/* Overlay Backdrop */
.mail-doctor-drawer__overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(11, 28, 48, 0.45);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.mail-doctor-drawer.is-active .mail-doctor-drawer__overlay {
	opacity: 1;
}

/* Drawer Content Panel */
.mail-doctor-drawer__content {
	position: absolute;
	top: 0;
	right: 0;
	width: 650px;
	max-width: 100%;
	height: 100%;
	background: var(--mail-doctor-color-surface);
	box-shadow: -4px 0 24px rgba(11, 28, 48, 0.15);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mail-doctor-drawer.is-active .mail-doctor-drawer__content {
	transform: translateX(0);
}

/* Drawer Header */
.mail-doctor-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 24px;
	border-bottom: 1px solid var(--mail-doctor-color-border);
	background: var(--mail-doctor-color-surface);
}

.mail-doctor-drawer__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: var(--mail-doctor-color-text);
}

.mail-doctor-drawer__close {
	border: none;
	background: transparent;
	padding: 6px;
	cursor: pointer;
	color: var(--mail-doctor-color-muted);
	border-radius: var(--mail-doctor-radius-sm);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, color 0.15s ease;
}

.mail-doctor-drawer__close:hover,
.mail-doctor-drawer__close:focus {
	background: var(--mail-doctor-color-neutral-soft);
	color: var(--mail-doctor-color-danger);
	outline: none;
}

.mail-doctor-drawer__close .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* Drawer Body */
.mail-doctor-drawer__body {
	flex: 1;
	overflow-y: auto;
	padding: 24px;
	background: #f8fafc;
}

/* Scroll Lock */
body.mail-doctor-drawer-open {
	overflow: hidden !important;
}

/* Loading & Error States */
.mail-doctor-drawer-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 80px 24px;
	text-align: center;
	color: var(--mail-doctor-color-muted);
}

.mail-doctor-drawer-loading .spinner {
	margin-bottom: 16px;
}

.mail-doctor-drawer-error {
	padding: 40px 24px;
	text-align: center;
	color: var(--mail-doctor-color-danger);
	font-weight: 500;
}

/* Stacking and Adjustments Inside Drawer */
.mail-doctor-drawer__body .mail-doctor-log-view-columns {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.mail-doctor-drawer__body .mail-doctor-log-view-sidebar {
	order: -1; /* Move Actions & Details card to the top */
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.mail-doctor-drawer__body .mail-doctor-log-view-main {
	width: 100%;
}

.mail-doctor-drawer__body .mail-doctor-log-actions-list {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mail-doctor-drawer__body .mail-doctor-log-actions-list li {
	margin: 0;
}

.mail-doctor-drawer__body .mail-doctor-action-link {
	border: 1px solid var(--mail-doctor-color-border);
	padding: 8px 14px;
	border-radius: var(--mail-doctor-radius-sm);
	background: var(--mail-doctor-color-surface);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
	transition: all 0.2s ease;
	text-decoration: none;
}

.mail-doctor-drawer__body .mail-doctor-action-link:hover {
	background: var(--mail-doctor-color-neutral-soft);
	border-color: var(--mail-doctor-color-accent);
	color: var(--mail-doctor-color-accent);
}

.mail-doctor-drawer__body .mail-doctor-action-link.mail-doctor-color-error:hover {
	border-color: var(--mail-doctor-color-danger);
	color: var(--mail-doctor-color-danger);
	background: #fff8f8;
}

@media (max-width: 782px) {
	body.admin-bar .mail-doctor-drawer {
		top: 46px;
		height: calc(100% - 46px);
	}
	
	.mail-doctor-drawer__content {
		width: 100%;
	}
}

