/**
 * MergeImagez Tools — video engine styles (video-to-GIF / MP4-to-JPG).
 *
 * Self-contained: video pages enqueue ONLY this stylesheet (not
 * miz-tools.css), so the shared base styles (buttons, dropzone, status,
 * panels, fields, preview) are included here with the same values as
 * the converter sheet. Class prefix: miz-. Brand palette via CSS
 * variables (with fallbacks so the tool still looks right if the theme
 * does not define them).
 */

.miz-tool {
	--miz-primary: #2563EB;
	--miz-primary-dark: #1D4ED8;
	--miz-ink: #0F172A;
	--miz-body: #334155;
	--miz-bg: #F8FAFC;
	--miz-border: #E2E8F0;
	--miz-accent: #0891B2;
	--miz-error-bg: #FEF2F2;
	--miz-error-border: #FECACA;
	--miz-error-text: #991B1B;
	--miz-radius: 10px;

	color: var(--miz-body, #334155);
	font-size: 1rem;
	line-height: 1.5;
	margin: 2rem 0;
}

.miz-tool *,
.miz-tool *::before,
.miz-tool *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.miz-btn {
	appearance: none;
	border: 1px solid transparent;
	border-radius: 8px;
	cursor: pointer;
	display: inline-block;
	font: inherit;
	font-weight: 600;
	line-height: 1.4;
	padding: 0.6rem 1.1rem;
	text-align: center;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.miz-btn:focus-visible {
	outline: 3px solid var(--miz-accent, #0891B2);
	outline-offset: 2px;
}

.miz-btn:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.miz-btn-primary {
	background: var(--miz-primary, #2563EB);
	color: #fff;
}

.miz-btn-primary:hover:not(:disabled) {
	background: var(--miz-primary-dark, #1D4ED8);
}

.miz-btn-secondary {
	background: #fff;
	border-color: var(--miz-border, #E2E8F0);
	color: var(--miz-ink, #0F172A);
}

.miz-btn-secondary:hover:not(:disabled) {
	border-color: var(--miz-primary, #2563EB);
	color: var(--miz-primary, #2563EB);
}

.miz-btn-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

/* ------------------------------------------------------------------ */
/* Dropzone                                                            */
/* ------------------------------------------------------------------ */

.miz-dropzone {
	background: var(--miz-bg, #F8FAFC);
	border: 2px dashed var(--miz-border, #E2E8F0);
	border-radius: var(--miz-radius);
	cursor: pointer;
	padding: 2.5rem 1.5rem;
	text-align: center;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.miz-dropzone:hover,
.miz-dropzone:focus-visible,
.miz-dropzone.is-dragover {
	border-color: var(--miz-primary, #2563EB);
	background: #EFF6FF;
}

.miz-dropzone:focus-visible {
	outline: 3px solid var(--miz-accent, #0891B2);
	outline-offset: 2px;
}

.miz-file-input {
	/* Visually hidden but still focusable / clickable via label-less JS. */
	height: 1px;
	left: -9999px;
	opacity: 0;
	position: absolute;
	width: 1px;
}

.miz-dropzone-title {
	color: var(--miz-ink, #0F172A);
	font-size: 1.15rem;
	font-weight: 700;
	margin: 0 0 0.4rem;
}

.miz-dropzone-hint {
	margin: 0 0 1.1rem;
}

/* ------------------------------------------------------------------ */
/* Status / errors                                                     */
/* ------------------------------------------------------------------ */

.miz-status {
	color: var(--miz-body, #334155);
	margin: 0.9rem 0 0;
	min-height: 1.5em;
}

.miz-error {
	background: var(--miz-error-bg, #FEF2F2);
	border: 1px solid var(--miz-error-border, #FECACA);
	border-radius: 8px;
	color: var(--miz-error-text, #991B1B);
	margin: 0.9rem 0 0;
	padding: 0.7rem 1rem;
}

/* ------------------------------------------------------------------ */
/* Workspace layout                                                    */
/* ------------------------------------------------------------------ */

.miz-workspace {
	margin-top: 1.5rem;
}

.miz-panels {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	margin-top: 1.25rem;
}

.miz-panel {
	background: #fff;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: var(--miz-radius);
	margin: 0;
	padding: 1rem 1.1rem 1.1rem;
}

.miz-panel legend {
	color: var(--miz-ink, #0F172A);
	font-weight: 700;
	padding: 0 0.35rem;
}

/* ------------------------------------------------------------------ */
/* Fields                                                              */
/* ------------------------------------------------------------------ */

.miz-field {
	margin-bottom: 0.9rem;
}

.miz-field:last-child {
	margin-bottom: 0;
}

.miz-field label {
	color: var(--miz-ink, #0F172A);
	display: block;
	font-weight: 600;
	margin-bottom: 0.3rem;
}

.miz-field select,
.miz-field input[type="number"] {
	background: #fff;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: 6px;
	color: var(--miz-ink, #0F172A);
	font: inherit;
	padding: 0.45rem 0.6rem;
	width: 100%;
}

.miz-field input[type="range"] {
	width: 100%;
}

.miz-field input[type="color"] {
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: 6px;
	height: 2.4rem;
	padding: 2px;
	width: 4rem;
}

.miz-field-inline {
	align-items: center;
	display: flex;
	gap: 0.75rem;
}

.miz-field-inline label {
	margin-bottom: 0;
}

.miz-field-note {
	font-size: 0.9rem;
	margin: 0.4rem 0 0;
}

.miz-value {
	color: var(--miz-accent, #0891B2);
	font-weight: 700;
}

.miz-output-size {
	color: var(--miz-ink, #0F172A);
	font-weight: 700;
	margin: 0 0 0.8rem;
}

/* ------------------------------------------------------------------ */
/* Input info line                                                     */
/* ------------------------------------------------------------------ */

.miz-video-info {
	background: #fff;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: var(--miz-radius);
	color: var(--miz-ink, #0F172A);
	font-size: 0.95rem;
	font-weight: 600;
	overflow-wrap: anywhere;
	padding: 0.7rem 1rem;
}

.miz-video-info:empty {
	display: none;
}

/* ------------------------------------------------------------------ */
/* Preview                                                             */
/* ------------------------------------------------------------------ */

.miz-preview-wrap {
	margin-top: 1.5rem;
}

.miz-preview-title {
	color: var(--miz-ink, #0F172A);
	font-size: 1.1rem;
	margin: 0 0 0.6rem;
}

.miz-canvas-scroll {
	background:
		linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%),
		linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%);
	background-color: #f9fafb;
	background-position: 0 0, 12px 12px;
	background-size: 24px 24px;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: var(--miz-radius);
	overflow: auto;
	padding: 1rem;
	text-align: center;
}

.miz-canvas-scroll canvas {
	display: inline-block;
	max-width: 100%;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

/* ------------------------------------------------------------------ */
/* Result panel                                                        */
/* ------------------------------------------------------------------ */

.miz-result {
	background: #EFF6FF;
	border: 1px solid #BFDBFE;
	border-radius: 8px;
	margin-top: 1rem;
	padding: 0.9rem 1rem;
}

.miz-result-text {
	color: var(--miz-ink, #0F172A);
	margin: 0 0 0.8rem;
}

.miz-result .miz-preview-img {
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: 8px;
	display: block;
	margin-top: 0.8rem;
	max-width: 100%;
}

/* ------------------------------------------------------------------ */
/* Video player                                                        */
/* ------------------------------------------------------------------ */

.miz-video-player {
	background: #000;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: var(--miz-radius);
	display: block;
	margin: 1.25rem 0 0;
	max-height: 480px;
	max-width: 100%;
	width: 100%;
}

/* ------------------------------------------------------------------ */
/* Mode tabs (radio pills) — single timestamp vs interval              */
/* ------------------------------------------------------------------ */

.miz-mode-tabs {
	border: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0 0 1rem;
	padding: 0;
}

.miz-mode-tabs legend {
	color: var(--miz-ink, #0F172A);
	font-weight: 700;
	margin-bottom: 0.4rem;
	padding: 0;
}

.miz-mode-tab {
	cursor: pointer;
	display: inline-block;
}

.miz-mode-tab input {
	height: 1px;
	left: -9999px;
	opacity: 0;
	position: absolute;
	width: 1px;
}

.miz-mode-tab span {
	background: #fff;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: 999px;
	color: var(--miz-ink, #0F172A);
	display: inline-block;
	font-weight: 600;
	padding: 0.35rem 0.9rem;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.miz-mode-tab input:checked + span {
	background: var(--miz-primary, #2563EB);
	border-color: var(--miz-primary, #2563EB);
	color: #fff;
}

.miz-mode-tab input:focus-visible + span {
	outline: 3px solid var(--miz-accent, #0891B2);
	outline-offset: 2px;
}

.miz-mode-tab:hover span {
	border-color: var(--miz-primary, #2563EB);
}

/* ------------------------------------------------------------------ */
/* Extracted stills grid (MP4 to JPG)                                  */
/* ------------------------------------------------------------------ */

.miz-video-stills {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	margin-top: 1.25rem;
}

.miz-video-stills:empty {
	display: none;
}

.miz-video-still {
	background: #fff;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: var(--miz-radius);
	margin: 0;
	padding: 0.75rem;
}

.miz-video-still canvas {
	border-radius: 6px;
	display: block;
	max-width: 100%;
}

.miz-video-still figcaption {
	font-size: 0.9rem;
	margin: 0.6rem 0;
}

@media (max-width: 640px) {
	.miz-dropzone {
		padding: 1.8rem 1rem;
	}

	.miz-panels {
		grid-template-columns: 1fr;
	}

	.miz-btn-row .miz-btn {
		flex: 1 1 100%;
	}

	.miz-btn {
		padding: 0.7rem 1rem;
	}
}

@media (min-width: 901px) {
	:is(.miz-videotogif, .miz-mp4tojpg, .miz-video-v15) .miz-more-options-wrap {
		position: relative;
	}

	:is(.miz-videotogif, .miz-mp4tojpg, .miz-video-v15) .miz-more-options-wrap .miz-advanced-panel {
		top: calc(100% + 8px);
		right: 0;
		max-height: min(60vh, 32rem);
		overflow: auto;
	}
}

:is(.miz-videotogif, .miz-mp4tojpg) .miz-canvas-scroll .miz-video-player {
	width: 100%;
}

.miz-video-v15 .miz-video-still button {
	margin: 0.25rem;
}
