/**
 * Zamai DXF to PDF Converter - Frontend Styles
 * Clean, professional, real-estate-appropriate aesthetic.
 */

.zamai-dxf-converter {
	--zdxf-bg: #ffffff;
	--zdxf-surface: #f8fafc;
	--zdxf-border: #e2e8f0;
	--zdxf-border-strong: #cbd5e1;
	--zdxf-text: #0f172a;
	--zdxf-text-muted: #64748b;
	--zdxf-primary: #0f172a;
	--zdxf-primary-hover: #1e293b;
	--zdxf-accent: #b8860b;
	--zdxf-accent-soft: rgba(184, 134, 11, 0.08);
	--zdxf-success: #047857;
	--zdxf-success-bg: #ecfdf5;
	--zdxf-error: #b91c1c;
	--zdxf-error-bg: #fef2f2;
	--zdxf-info: #1e40af;
	--zdxf-info-bg: #eff6ff;
	--zdxf-radius: 10px;
	--zdxf-radius-sm: 6px;
	--zdxf-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.05);

	max-width: 720px;
	margin: 2rem auto;
	padding: 2rem;
	background: var(--zdxf-bg);
	border: 1px solid var(--zdxf-border);
	border-radius: var(--zdxf-radius);
	box-shadow: var(--zdxf-shadow);
	color: var(--zdxf-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	box-sizing: border-box;
}

.zamai-dxf-converter *,
.zamai-dxf-converter *::before,
.zamai-dxf-converter *::after {
	box-sizing: border-box;
}

/* Header */
.zamai-dxf-header {
	text-align: center;
	margin-bottom: 1.5rem;
}

.zamai-dxf-title {
	margin: 0 0 0.5rem;
	font-size: 1.5rem;
	font-weight: 600;
	color: var(--zdxf-text);
	letter-spacing: -0.01em;
}

.zamai-dxf-subtitle {
	margin: 0;
	font-size: 0.95rem;
	color: var(--zdxf-text-muted);
}

/* DXF info note (expandable) */
.zamai-dxf-note {
	margin: 0 0 1.25rem;
	background: var(--zdxf-accent-soft);
	border: 1px solid rgba(184, 134, 11, 0.25);
	border-left: 3px solid var(--zdxf-accent);
	border-radius: var(--zdxf-radius-sm);
	overflow: hidden;
	transition: background 0.15s ease;
}

.zamai-dxf-note[open] {
	background: #ffffff;
	border-color: var(--zdxf-border-strong);
}

.zamai-dxf-note-summary {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.75rem 1rem;
	cursor: pointer;
	list-style: none;
	font-size: 0.9rem;
	user-select: none;
	-webkit-user-select: none;
}

.zamai-dxf-note-summary::-webkit-details-marker {
	display: none;
}

.zamai-dxf-note-summary::marker {
	display: none;
	content: '';
}

.zamai-dxf-note-icon {
	width: 18px;
	height: 18px;
	color: var(--zdxf-accent);
	flex-shrink: 0;
}

.zamai-dxf-note-title {
	flex: 1;
	font-weight: 500;
	color: var(--zdxf-text);
}

.zamai-dxf-note-toggle {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--zdxf-accent);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	white-space: nowrap;
	flex-shrink: 0;
}

.zamai-dxf-note-toggle::after {
	content: ' ▾';
	display: inline-block;
	transition: transform 0.2s ease;
}

.zamai-dxf-note[open] .zamai-dxf-note-toggle::after {
	transform: rotate(180deg);
}

.zamai-dxf-note[open] .zamai-dxf-note-toggle {
	color: var(--zdxf-text-muted);
}

.zamai-dxf-note-body {
	padding: 0.25rem 1rem 1rem;
	border-top: 1px solid var(--zdxf-border);
	font-size: 0.88rem;
	color: var(--zdxf-text);
}

.zamai-dxf-note-body p {
	margin: 0.75rem 0;
	color: var(--zdxf-text-muted);
	line-height: 1.55;
}

.zamai-dxf-note-list {
	margin: 0.75rem 0;
	padding-left: 1.25rem;
	list-style: disc;
}

.zamai-dxf-note-list li {
	margin-bottom: 0.45rem;
	color: var(--zdxf-text-muted);
	line-height: 1.5;
}

.zamai-dxf-note-list li strong {
	color: var(--zdxf-text);
	font-weight: 600;
}

.zamai-dxf-note-tip {
	margin-top: 0.75rem !important;
	padding: 0.6rem 0.85rem;
	background: var(--zdxf-surface);
	border-radius: var(--zdxf-radius-sm);
	font-size: 0.82rem;
	border-left: 2px solid var(--zdxf-accent);
}

.zamai-dxf-note-tip strong {
	color: var(--zdxf-text);
}

/* Dropzone */
.zamai-dxf-dropzone {
	display: block;
	padding: 2.5rem 1.5rem;
	background: var(--zdxf-surface);
	border: 2px dashed var(--zdxf-border-strong);
	border-radius: var(--zdxf-radius);
	cursor: pointer;
	text-align: center;
	transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.zamai-dxf-dropzone:hover,
.zamai-dxf-dropzone:focus-within {
	border-color: var(--zdxf-accent);
	background: var(--zdxf-accent-soft);
}

.zamai-dxf-dropzone.is-dragging {
	border-color: var(--zdxf-accent);
	background: var(--zdxf-accent-soft);
	transform: scale(1.01);
}

.zamai-dxf-dropzone.is-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

.zamai-dxf-dropzone-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
}

.zamai-dxf-icon {
	width: 48px;
	height: 48px;
	color: var(--zdxf-text-muted);
	flex-shrink: 0;
}

.zamai-dxf-dropzone:hover .zamai-dxf-icon,
.zamai-dxf-dropzone.is-dragging .zamai-dxf-icon {
	color: var(--zdxf-accent);
}

.zamai-dxf-dropzone-primary {
	font-size: 1rem;
	font-weight: 500;
	color: var(--zdxf-text);
}

.zamai-dxf-dropzone-secondary {
	font-size: 0.85rem;
	color: var(--zdxf-text-muted);
}

/* File info */
.zamai-dxf-fileinfo {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	background: var(--zdxf-surface);
	border: 1px solid var(--zdxf-border);
	border-radius: var(--zdxf-radius-sm);
	font-size: 0.9rem;
}

.zamai-dxf-fileinfo svg {
	width: 18px;
	height: 18px;
	color: var(--zdxf-text-muted);
	flex-shrink: 0;
}

.zamai-dxf-fileinfo span {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.zamai-dxf-remove {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--zdxf-text-muted);
	padding: 0;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: background 0.15s, color 0.15s;
}

.zamai-dxf-remove:hover {
	background: var(--zdxf-error-bg);
	color: var(--zdxf-error);
}

/* Preview */
.zamai-dxf-preview {
	margin-top: 1.25rem;
	padding: 1rem;
	background: #ffffff;
	border: 1px solid var(--zdxf-border);
	border-radius: var(--zdxf-radius-sm);
	min-height: 240px;
	max-height: 480px;
	overflow: auto;
	display: flex;
	align-items: center;
	justify-content: center;
}

.zamai-dxf-preview svg {
	max-width: 100%;
	max-height: 460px;
	width: auto;
	height: auto;
	display: block;
}

/* Options */
.zamai-dxf-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	margin-top: 1.25rem;
}

.zamai-dxf-option label {
	display: block;
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--zdxf-text-muted);
	margin-bottom: 0.35rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.zamai-dxf-option select {
	width: 100%;
	padding: 0.6rem 0.8rem;
	border: 1px solid var(--zdxf-border-strong);
	border-radius: var(--zdxf-radius-sm);
	background: var(--zdxf-bg);
	font-size: 0.95rem;
	color: var(--zdxf-text);
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s;
	font-family: inherit;
}

.zamai-dxf-option select:focus {
	outline: none;
	border-color: var(--zdxf-accent);
	box-shadow: 0 0 0 3px var(--zdxf-accent-soft);
}

/* Status */
.zamai-dxf-status {
	margin-top: 1.25rem;
	padding: 0.75rem 1rem;
	border-radius: var(--zdxf-radius-sm);
	font-size: 0.9rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.zamai-dxf-status.is-loading {
	background: var(--zdxf-info-bg);
	color: var(--zdxf-info);
}

.zamai-dxf-status.is-success {
	background: var(--zdxf-success-bg);
	color: var(--zdxf-success);
}

.zamai-dxf-status.is-error {
	background: var(--zdxf-error-bg);
	color: var(--zdxf-error);
}

/* Convert button */
.zamai-dxf-convert {
	margin-top: 1.5rem;
	width: 100%;
	padding: 0.9rem 1.5rem;
	background: var(--zdxf-primary);
	color: #ffffff;
	border: none;
	border-radius: var(--zdxf-radius-sm);
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, transform 0.05s, opacity 0.15s;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	font-family: inherit;
	letter-spacing: 0.01em;
}

.zamai-dxf-convert:hover:not(:disabled) {
	background: var(--zdxf-primary-hover);
}

.zamai-dxf-convert:active:not(:disabled) {
	transform: translateY(1px);
}

.zamai-dxf-convert:disabled {
	background: var(--zdxf-border-strong);
	cursor: not-allowed;
	opacity: 0.7;
}

.zamai-dxf-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: zamai-dxf-spin 0.7s linear infinite;
}

@keyframes zamai-dxf-spin {
	to { transform: rotate(360deg); }
}

/* Footnote */
.zamai-dxf-footnote {
	margin: 1rem 0 0;
	font-size: 0.8rem;
	color: var(--zdxf-text-muted);
	text-align: center;
	font-style: italic;
}

/* Hidden helper canvas for preview rendering */
.zamai-dxf-render-target {
	position: absolute;
	left: -10000px;
	top: -10000px;
	visibility: hidden;
}

/* Responsive */
@media (max-width: 540px) {
	.zamai-dxf-converter {
		padding: 1.25rem;
		margin: 1rem;
	}
	.zamai-dxf-title {
		font-size: 1.25rem;
	}
	.zamai-dxf-dropzone {
		padding: 1.75rem 1rem;
	}
	.zamai-dxf-options {
		grid-template-columns: 1fr;
	}
}
