/**
 * Bulk Progress Modal
 *
 * @package BeepBeep_AI
 */

.bbai-bulk-progress-modal {
	--bbai-text: #0f172a;
	--bbai-text-muted: #64748b;
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(16px, 4vw, 28px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.24s ease, visibility 0.24s ease;
}

.bbai-bulk-progress-modal.active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.bbai-bulk-progress-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.56);
	backdrop-filter: blur(8px);
}

.bbai-bulk-progress-modal__content {
	position: relative;
	z-index: 1;
	width: min(520px, 100%);
	max-height: calc(100vh - 48px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background:
		radial-gradient(circle at top left, rgba(34, 197, 94, 0.12), transparent 40%),
		linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
	border: 1px solid rgba(148, 163, 184, 0.2);
	border-radius: 22px;
	box-shadow: 0 22px 70px rgba(15, 23, 42, 0.24);
	transform: scale(0.96);
	opacity: 0;
	transition: transform 0.24s ease, opacity 0.24s ease;
}

.bbai-bulk-progress-modal.active .bbai-bulk-progress-modal__content {
	transform: scale(1);
	opacity: 1;
}

.bbai-bulk-progress__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 24px 28px 0;
}

.bbai-bulk-progress__header-text {
	flex: 1;
	min-width: 0;
}

.bbai-bulk-progress__title {
	margin: 0;
	font-size: clamp(1.45rem, 1.8vw, 1.85rem);
	line-height: 1.12;
	font-weight: 800;
	color: var(--bbai-text);
}

.bbai-bulk-progress__subtitle {
	margin: 10px 0 0;
	font-size: 1rem;
	line-height: 1.55;
	color: var(--bbai-text-muted);
}

.bbai-bulk-progress__helper {
	margin: 8px 0 0;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--bbai-text-muted);
}

.bbai-bulk-progress__header-actions {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.bbai-bulk-progress__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid rgba(148, 163, 184, 0.22);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.7);
	color: var(--bbai-text-muted);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.bbai-bulk-progress__close:hover,
.bbai-bulk-progress__close:focus-visible {
	background: rgba(255, 255, 255, 0.95);
	color: var(--bbai-text);
	border-color: rgba(100, 116, 139, 0.28);
}

.bbai-bulk-progress__body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	overflow-y: auto;
	padding: 18px 28px 24px;
}

.bbai-bulk-progress__stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.bbai-bulk-progress__stat {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid rgba(148, 163, 184, 0.18);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.74);
}

.bbai-bulk-progress__stat-label {
	color: var(--bbai-text-muted);
	font-size: 0.76rem;
	font-weight: 700;
	line-height: 1.2;
}

.bbai-bulk-progress__stat-value {
	color: var(--bbai-text);
	font-size: 0.95rem;
	font-weight: 800;
	line-height: 1.25;
}

.bbai-bulk-progress__meter-label {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--bbai-text-muted);
}

.bbai-bulk-progress__bar-container {
	margin: 0;
	max-height: 20px;
	opacity: 1;
	transform: translateY(0);
	transition: opacity 0.2s ease, max-height 0.2s ease, transform 0.2s ease;
}

.bbai-bulk-progress__bar {
	position: relative;
	height: 8px;
	background: rgba(241, 245, 249, 0.95);
	border-radius: 999px;
	overflow: hidden;
	box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
	outline: none;
}

.bbai-bulk-progress__bar:focus-visible {
	box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06), 0 0 0 2px #fff, 0 0 0 4px rgba(37, 99, 235, 0.35);
}

.bbai-bulk-progress__bar-fill {
	height: 100%;
	width: 0;
	max-width: 100%;
	border-radius: 999px;
	background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
	box-shadow: 0 6px 16px rgba(34, 197, 94, 0.28);
	transition: width 300ms ease;
}

.bbai-bulk-progress__status-note {
	margin: 0;
	padding: 12px 14px;
	border-radius: 14px;
	font-size: 0.95rem;
	line-height: 1.5;
	background: rgba(148, 163, 184, 0.12);
	color: var(--bbai-text-muted);
}

.bbai-bulk-progress__status-note[data-tone="warning"] {
	background: rgba(245, 158, 11, 0.14);
	color: #92400e;
}

.bbai-bulk-progress__steps {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	padding: 10px;
	border-radius: 16px;
	border: 1px solid rgba(148, 163, 184, 0.22);
	background: rgba(255, 255, 255, 0.72);
}

.bbai-bulk-progress__step {
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 52px;
	padding: 9px 10px;
	border-radius: 13px;
	border: 1px solid rgba(148, 163, 184, 0.18);
	background: rgba(255, 255, 255, 0.9);
}

.bbai-bulk-progress__step-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	border-radius: 999px;
	font-weight: 800;
	font-size: 0.8rem;
	line-height: 1;
	background: rgba(148, 163, 184, 0.16);
	color: #0f172a;
}

.bbai-bulk-progress__step-label {
	min-width: 0;
	font-size: 0.9rem;
	line-height: 1.25;
	font-weight: 750;
	color: var(--bbai-text);
}

.bbai-bulk-progress__step.bbai-step--active,
.bbai-bulk-progress__step.is-active {
	border-left: 3px solid #10b981;
	background: rgba(16, 185, 129, 0.05);
	animation: bbai-pulse 1.2s ease-in-out infinite;
}

.bbai-bulk-progress__step.bbai-step--complete,
.bbai-bulk-progress__step.is-done {
	opacity: 0.6;
}

.bbai-bulk-progress__step.bbai-step--pending {
	opacity: 0.4;
}

@keyframes bbai-pulse {
	0% { opacity: 1; }
	50% { opacity: 0.7; }
	100% { opacity: 1; }
}

.bbai-bulk-progress__log-container {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	border-radius: 16px;
	border: 1px solid rgba(148, 163, 184, 0.22);
	background: rgba(255, 255, 255, 0.72);
}

.bbai-bulk-progress__log-heading {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.bbai-bulk-progress__log-title {
	margin: 0;
	font-size: 1rem;
	line-height: 1.3;
	font-weight: 700;
	color: var(--bbai-text);
}

.bbai-bulk-progress__log-count {
	font-size: 0.9rem;
	line-height: 1.3;
	font-weight: 600;
	color: var(--bbai-text-muted);
}

.bbai-bulk-progress__current-image {
	display: grid;
	grid-template-columns: 10px minmax(0, 1fr);
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 12px;
	border: 1px solid rgba(16, 185, 129, 0.22);
	background: rgba(236, 253, 245, 0.72);
}

.bbai-bulk-progress__current-image[hidden] {
	display: none !important;
}

.bbai-bulk-progress__current-dot {
	width: 10px;
	height: 10px;
	border-radius: 999px;
	background: #10b981;
	box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.bbai-bulk-progress__current-copy {
	display: grid;
	gap: 2px;
	min-width: 0;
}

.bbai-bulk-progress__current-status {
	color: #047857;
	font-size: 0.78rem;
	font-weight: 800;
	line-height: 1.2;
	text-transform: uppercase;
}

.bbai-bulk-progress__current-name {
	overflow: hidden;
	color: var(--bbai-text);
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bbai-bulk-progress__current-image[data-tone="queued"] {
	border-color: rgba(100, 116, 139, 0.2);
	background: rgba(248, 250, 252, 0.86);
}

.bbai-bulk-progress__current-image[data-tone="queued"] .bbai-bulk-progress__current-dot {
	background: #64748b;
	box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.12);
}

.bbai-bulk-progress__current-image[data-tone="queued"] .bbai-bulk-progress__current-status {
	color: #475569;
}

.bbai-bulk-progress__current-image[data-tone="success"] {
	border-color: rgba(34, 197, 94, 0.24);
	background: rgba(240, 253, 244, 0.8);
}

.bbai-bulk-progress__current-image[data-tone="success"] .bbai-bulk-progress__current-dot {
	background: #22c55e;
	box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.bbai-bulk-progress__current-image[data-tone="success"] .bbai-bulk-progress__current-status {
	color: #166534;
}

.bbai-bulk-progress__current-image[data-tone="error"] {
	border-color: rgba(239, 68, 68, 0.22);
	background: rgba(254, 242, 242, 0.82);
}

.bbai-bulk-progress__current-image[data-tone="error"] .bbai-bulk-progress__current-dot {
	background: #ef4444;
	box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.bbai-bulk-progress__current-image[data-tone="error"] .bbai-bulk-progress__current-status {
	color: #991b1b;
}

.bbai-bulk-progress__log {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 132px;
	overflow: auto;
	padding-right: 4px;
}

.bbai-bulk-progress__log-empty {
	padding: 9px 10px;
	border-radius: 12px;
	border: 1px solid rgba(148, 163, 184, 0.24);
	background: rgba(248, 250, 252, 0.75);
	color: var(--bbai-text-muted);
	font-size: 0.88rem;
	line-height: 1.4;
}

.bbai-bulk-progress__log-entry {
	display: grid;
	grid-template-columns: 22px 1fr auto;
	align-items: flex-start;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 14px;
	border: 1px solid rgba(148, 163, 184, 0.18);
	background: rgba(255, 255, 255, 0.9);
	box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.bbai-log-item {
	font-size: 13px;
	opacity: 0.8;
}

.bbai-bulk-progress__log-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 999px;
	font-weight: 800;
	font-size: 0.9rem;
	line-height: 1;
	color: #0f172a;
	background: rgba(148, 163, 184, 0.16);
}

.bbai-bulk-progress__log-text {
	min-width: 0;
	color: var(--bbai-text);
	font-size: 0.95rem;
	line-height: 1.45;
	font-weight: 600;
}

.bbai-bulk-progress__log-time {
	color: var(--bbai-text-muted);
	font-size: 0.85rem;
	line-height: 1.45;
	font-weight: 600;
	white-space: nowrap;
}

.bbai-bulk-progress__log-entry--success {
	border-left: 3px solid rgba(34, 197, 94, 0.9);
}

.bbai-bulk-progress__log-entry--success .bbai-bulk-progress__log-icon {
	background: rgba(34, 197, 94, 0.16);
	color: #166534;
}

.bbai-bulk-progress__log-entry--error {
	border-left: 3px solid rgba(239, 68, 68, 0.9);
}

.bbai-bulk-progress__log-entry--error .bbai-bulk-progress__log-icon {
	background: rgba(239, 68, 68, 0.14);
	color: #991b1b;
}

.bbai-bulk-progress__log-entry--processing {
	border-left: 3px solid rgba(16, 185, 129, 0.9);
}

.bbai-bulk-progress__log-entry--processing .bbai-bulk-progress__log-icon {
	background: rgba(16, 185, 129, 0.16);
	color: #047857;
}

.bbai-bulk-progress__log-entry--queued {
	border-left: 3px solid rgba(100, 116, 139, 0.55);
	background: rgba(248, 250, 252, 0.92);
}

.bbai-bulk-progress__log-entry--queued .bbai-bulk-progress__log-icon {
	background: rgba(100, 116, 139, 0.14);
	color: #475569;
}

.bbai-bulk-progress__complete {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 4px 0 0;
	text-align: center;
}

.bbai-bulk-progress__complete[hidden],
.bbai-bulk-progress__complete-actions[hidden],
.bbai-bulk-progress__action[hidden],
.bbai-bulk-progress__supporting-line[hidden],
.bbai-bulk-progress__meter-label[hidden],
.bbai-bulk-progress__status-note[hidden] {
	display: none !important;
}

.bbai-bulk-progress__success-check {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: 999px;
	background: rgba(34, 197, 94, 0.14);
	color: #16a34a;
	box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.14), 0 10px 24px rgba(34, 197, 94, 0.12);
	opacity: 0;
	transform: scale(0.88);
	transition: opacity 0.24s ease, transform 0.24s ease;
}

.bbai-bulk-progress__success-check.is-visible {
	opacity: 1;
	transform: scale(1);
}

.bbai-bulk-progress__success-checkmark {
	font-size: 1.75rem;
	font-weight: 700;
	line-height: 1;
}

.bbai-bulk-progress__complete-title {
	margin: 0;
	font-size: clamp(1.65rem, 2vw, 2rem);
	line-height: 1.1;
	font-weight: 800;
	color: var(--bbai-text);
	letter-spacing: -0.03em;
}

.bbai-bulk-progress__complete-subtitle {
	margin: 0;
	max-width: 32ch;
	font-size: 1rem;
	line-height: 1.5;
	font-weight: 500;
	color: var(--bbai-text-muted);
}

.bbai-bulk-progress-modal .bbai-modal-footer,
.bbai-bulk-progress__running-actions,
.bbai-bulk-progress__complete-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: center;
	width: 100%;
	max-width: 280px;
	margin: 0 auto;
	padding-top: 2px;
}

.bbai-bulk-progress__running-actions[hidden] {
	display: none;
}

.bbai-bulk-progress__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 0 18px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: -0.01em;
	text-decoration: none;
	transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.bbai-bulk-progress__action--primary {
	border: none;
	background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
	box-shadow: 0 14px 28px rgba(34, 197, 94, 0.24);
}

.bbai-bulk-progress__action--primary:hover,
.bbai-bulk-progress__action--primary:focus-visible {
	background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.bbai-bulk-progress__action--secondary {
	border: 1px solid rgba(148, 163, 184, 0.24);
	background: #ffffff;
	color: #0f172a;
}

.bbai-bulk-progress__supporting-line {
	margin: 0;
	max-width: 34ch;
	font-size: 13px;
	line-height: 1.5;
	font-weight: 600;
	color: #64748b;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__header {
	justify-content: flex-end;
	padding-bottom: 0;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__header-text {
	display: none;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__body {
	align-items: center;
	gap: 12px;
	padding: 8px 28px 24px;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__bar-container {
	max-height: 20px;
	opacity: 1;
	transform: translateY(0);
	overflow: visible;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress-modal__content {
	width: min(520px, 100%);
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__steps {
	width: 100%;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	padding: 10px;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__step {
	padding: 8px 10px;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__log-container {
	width: 100%;
	padding: 10px 12px;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__log {
	max-height: 92px;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__complete {
	gap: 10px;
	padding-top: 2px;
}

.bbai-bulk-progress-modal[data-bbai-bulk-progress-mode="complete"] .bbai-bulk-progress__success-check {
	width: 56px;
	height: 56px;
}

.bbai-modal--complete .bbai-bulk-progress-modal__content {
	animation: bbai-success 300ms ease-out;
}

@keyframes bbai-success {
	0% { transform: scale(0.98); }
	100% { transform: scale(1); }
}

.bbai-bulk-progress__action:hover:not(:disabled),
.bbai-bulk-progress__action:focus-visible:not(:disabled) {
	transform: translateY(-1px);
}

@media (max-width: 640px) {
	.bbai-bulk-progress-modal {
		padding: 16px;
	}

	.bbai-bulk-progress-modal__content {
		max-height: calc(100vh - 32px);
	}

	.bbai-bulk-progress__header {
		padding: 22px 22px 0;
	}

	.bbai-bulk-progress__body {
		padding: 18px 22px 22px;
	}

	.bbai-bulk-progress__steps {
		grid-template-columns: 1fr;
	}

	.bbai-bulk-progress__stats {
		grid-template-columns: 1fr;
	}

	.bbai-bulk-progress__complete-actions {
		flex-direction: column;
	}

	.bbai-bulk-progress__action {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bbai-bulk-progress-modal,
	.bbai-bulk-progress-modal__content,
	.bbai-bulk-progress__bar-fill,
	.bbai-bulk-progress__success-check {
		transition: none;
	}
}
