/* ==========================================================================
   AwoBom v1.0.0 — AI Destekli Ürün Reçetesi (BOM) & Maliyet Stüdyosu
   Adaptive Day/Night Theme + Live A4 Cost Engineering Sheet
   ========================================================================== */

.abm-root {
	--abm-bg: #f1f5f9;
	--abm-surface: #ffffff;
	--abm-surface-2: #f8fafc;
	--abm-border: #cbd5e1;
	--abm-text: #0f172a;
	--abm-text-muted: #64748b;
	--abm-primary: #4f46e5;
	--abm-primary-hover: #4338ca;
	--abm-primary-soft: #eef2ff;
	--abm-emerald: #059669;
	--abm-emerald-soft: #ecfdf5;
	--abm-amber: #d97706;
	--abm-amber-soft: #fffbeb;
	--abm-rose: #e11d48;
	--abm-rose-soft: #fff1f2;
	--abm-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
	--abm-radius: 14px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: var(--abm-text);
	background: var(--abm-bg);
	padding: 24px;
	border-radius: 16px;
	box-sizing: border-box;
	line-height: 1.5;
}

.abm-root *,
.abm-root *::before,
.abm-root *::after {
	box-sizing: border-box;
}

.abm-root[data-theme="dark"] {
	--abm-bg: #0b1120;
	--abm-surface: #111827;
	--abm-surface-2: #1e293b;
	--abm-border: #334155;
	--abm-text: #f8fafc;
	--abm-text-muted: #94a3b8;
	--abm-primary: #6366f1;
	--abm-primary-hover: #818cf8;
	--abm-primary-soft: rgba(99, 102, 241, 0.16);
	--abm-emerald: #10b981;
	--abm-emerald-soft: rgba(16, 185, 129, 0.15);
	--abm-amber: #f59e0b;
	--abm-amber-soft: rgba(245, 158, 11, 0.15);
	--abm-rose: #fb7185;
	--abm-rose-soft: rgba(244, 63, 94, 0.16);
	--abm-shadow: 0 8px 28px -4px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
	.abm-root[data-theme="auto"] {
		--abm-bg: #0b1120;
		--abm-surface: #111827;
		--abm-surface-2: #1e293b;
		--abm-border: #334155;
		--abm-text: #f8fafc;
		--abm-text-muted: #94a3b8;
		--abm-primary: #6366f1;
		--abm-primary-hover: #818cf8;
		--abm-primary-soft: rgba(99, 102, 241, 0.16);
		--abm-emerald: #10b981;
		--abm-emerald-soft: rgba(16, 185, 129, 0.15);
		--abm-amber: #f59e0b;
		--abm-amber-soft: rgba(245, 158, 11, 0.15);
		--abm-rose: #fb7185;
		--abm-rose-soft: rgba(244, 63, 94, 0.16);
		--abm-shadow: 0 8px 28px -4px rgba(0, 0, 0, 0.45);
	}
}

.abm-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	background: var(--abm-surface);
	border: 1px solid var(--abm-border);
	border-radius: var(--abm-radius);
	padding: 18px 22px;
	box-shadow: var(--abm-shadow);
	margin-bottom: 20px;
}

.abm-brand {
	display: flex;
	align-items: center;
	gap: 14px;
}

.abm-logo-icon {
	width: 46px;
	height: 46px;
	border-radius: 12px;
	background: linear-gradient(135deg, #4f46e5, #0ea5e9);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	color: #fff;
	box-shadow: 0 6px 14px rgba(79, 70, 229, 0.3);
}

.abm-title-row {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.abm-title {
	margin: 0;
	font-size: 21px;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--abm-text);
}

.abm-version {
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 99px;
	background: var(--abm-surface-2);
	border: 1px solid var(--abm-border);
	color: var(--abm-text-muted);
}

.abm-plan-badge {
	font-size: 11px;
	font-weight: 700;
	padding: 3px 10px;
	border-radius: 99px;
}

.abm-plan-badge.is-free {
	background: var(--abm-amber-soft);
	color: var(--abm-amber);
	border: 1px solid rgba(217, 119, 6, 0.3);
}

.abm-plan-badge.is-pro {
	background: var(--abm-emerald-soft);
	color: var(--abm-emerald);
	border: 1px solid rgba(5, 150, 105, 0.3);
}

.abm-ai-pill {
	font-size: 11px;
	font-weight: 700;
	padding: 3px 10px;
	border-radius: 99px;
	background: var(--abm-primary-soft);
	color: var(--abm-primary);
	border: 1px solid rgba(79, 70, 229, 0.3);
}

.abm-subtitle {
	margin: 2px 0 0;
	font-size: 13px;
	color: var(--abm-text-muted);
}

.abm-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.abm-theme-group {
	display: inline-flex;
	background: var(--abm-surface-2);
	border: 1px solid var(--abm-border);
	border-radius: 10px;
	padding: 3px;
}

.abm-theme-btn {
	border: none;
	background: transparent;
	color: var(--abm-text-muted);
	padding: 5px 10px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 7px;
	cursor: pointer;
}

.abm-theme-btn.active {
	background: var(--abm-surface);
	color: var(--abm-text);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.abm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 9px 14px;
	border-radius: 10px;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	border: 1px solid transparent;
	transition: all 0.15s ease;
}

.abm-btn-primary {
	background: var(--abm-primary);
	color: #ffffff;
}

.abm-btn-primary:hover {
	background: var(--abm-primary-hover);
}

.abm-btn-emerald {
	background: var(--abm-emerald);
	color: #ffffff;
}

.abm-btn-secondary {
	background: var(--abm-surface-2);
	color: var(--abm-text);
	border-color: var(--abm-border);
}

.abm-btn-secondary:hover {
	border-color: var(--abm-primary);
}

.abm-btn-ai {
	background: var(--abm-primary-soft);
	color: var(--abm-primary);
	border-color: rgba(79, 70, 229, 0.35);
	font-weight: 700;
}

.abm-btn-pro {
	background: linear-gradient(135deg, #f59e0b, #d97706);
	color: #ffffff;
	font-weight: 700;
	box-shadow: 0 4px 12px rgba(245, 158, 11, 0.28);
}

.abm-btn-pro.is-unlocked {
	background: linear-gradient(135deg, #059669, #10b981);
	box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
}

.abm-btn-link {
	background: none;
	border: none;
	color: var(--abm-primary);
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
}

.abm-pro-pill {
	font-size: 10px;
	font-weight: 800;
	padding: 1px 6px;
	border-radius: 99px;
	background: rgba(245, 158, 11, 0.18);
	color: #d97706;
	border: 1px solid rgba(245, 158, 11, 0.35);
}

/* KPI Strip */
.abm-kpi-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-bottom: 20px;
}

.abm-kpi-card {
	background: var(--abm-surface);
	border: 1px solid var(--abm-border);
	border-radius: var(--abm-radius);
	padding: 16px 18px;
	box-shadow: var(--abm-shadow);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.abm-kpi-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--abm-text-muted);
}

.abm-kpi-value {
	font-size: 24px;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--abm-text);
}

.abm-kpi-sub {
	font-size: 12px;
	color: var(--abm-text-muted);
}

.abm-text-emerald {
	color: var(--abm-emerald);
}

.abm-text-indigo {
	color: var(--abm-primary);
}

.abm-text-amber {
	color: var(--abm-amber);
}

.abm-toast {
	padding: 12px 16px;
	border-radius: 10px;
	background: var(--abm-primary-soft);
	border: 1px solid var(--abm-primary);
	color: var(--abm-text);
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 18px;
}

/* Main Grid */
.abm-main-grid {
	display: grid;
	grid-template-columns: 1.15fr 1fr;
	gap: 20px;
	align-items: start;
}

.abm-editor-col,
.abm-preview-col {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.abm-card {
	background: var(--abm-surface);
	border: 1px solid var(--abm-border);
	border-radius: var(--abm-radius);
	padding: 20px;
	box-shadow: var(--abm-shadow);
}

.abm-ai-card {
	border-color: rgba(79, 70, 229, 0.45);
}

.abm-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--abm-border);
	flex-wrap: wrap;
}

.abm-card-title {
	margin: 0;
	font-size: 15.5px;
	font-weight: 700;
	color: var(--abm-text);
}

.abm-card-desc {
	margin: 3px 0 0;
	font-size: 12px;
	color: var(--abm-text-muted);
}

/* Forms */
.abm-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.abm-row-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.abm-row-3 {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 10px;
}

.abm-row-5 {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 8px;
}

.abm-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.abm-field label {
	font-size: 11.5px;
	font-weight: 600;
	color: var(--abm-text-muted);
}

.abm-field input,
.abm-field select,
.abm-field textarea {
	width: 100%;
	padding: 8px 10px;
	border-radius: 9px;
	border: 1px solid var(--abm-border);
	background: var(--abm-surface-2);
	color: var(--abm-text);
	font-size: 12.5px;
	font-family: inherit;
}

.abm-stock-picker {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-radius: 10px;
	background: var(--abm-surface-2);
	border: 1px dashed var(--abm-border);
	flex-wrap: wrap;
}

.abm-action-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding-top: 6px;
}

.abm-ai-output {
	padding: 12px;
	border-radius: 10px;
	background: var(--abm-surface-2);
	border: 1px solid var(--abm-primary);
	font-size: 12.5px;
	color: var(--abm-text);
	white-space: pre-line;
}

/* Tables */
.abm-table-wrap {
	overflow-x: auto;
}

.abm-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 12.5px;
}

.abm-table th,
.abm-table td {
	padding: 8px 8px;
	border-bottom: 1px solid var(--abm-border);
	text-align: left;
	vertical-align: middle;
}

.abm-table th {
	font-size: 11px;
	font-weight: 700;
	color: var(--abm-text-muted);
	background: var(--abm-surface-2);
}

.abm-line-input {
	width: 100%;
	padding: 6px 8px;
	border-radius: 7px;
	border: 1px solid var(--abm-border);
	background: var(--abm-surface);
	color: var(--abm-text);
	font-size: 12px;
}

.abm-mini-btn {
	border: 1px solid var(--abm-border);
	background: var(--abm-surface);
	color: var(--abm-text-muted);
	padding: 4px 8px;
	border-radius: 7px;
	font-size: 11.5px;
	font-weight: 600;
	cursor: pointer;
}

.abm-mini-btn:hover {
	color: var(--abm-text);
	border-color: var(--abm-primary);
}

/* Live Cost Engineering Sheet Preview */
.abm-sheet-preview {
	background: #ffffff;
	color: #0f172a;
	border: 1px solid #cbd5e1;
	border-radius: 12px;
	padding: 20px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.abm-sheet-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	border-bottom: 2px solid #0f172a;
	padding-bottom: 12px;
	margin-bottom: 14px;
}

.abm-sheet-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 11.5px;
	margin-bottom: 14px;
}

.abm-sheet-table th,
.abm-sheet-table td {
	border: 1px solid #cbd5e1;
	padding: 6px 8px;
	text-align: left;
}

.abm-sheet-table th {
	background: #f1f5f9;
	font-weight: 700;
}

.abm-summary-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 12px;
}

.abm-summary-box {
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	padding: 10px 12px;
	background: #f8fafc;
	font-size: 12px;
}

/* Modal */
.abm-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.65);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	padding: 16px;
}

.abm-modal-backdrop[hidden] {
	display: none !important;
}

.abm-modal {
	background: var(--abm-surface);
	border: 1px solid var(--abm-border);
	border-radius: 16px;
	max-width: 540px;
	width: 100%;
	padding: 22px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.abm-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.abm-modal-header h3 {
	margin: 0;
	font-size: 17px;
	color: var(--abm-text);
}

.abm-modal-close {
	background: none;
	border: none;
	font-size: 24px;
	color: var(--abm-text-muted);
	cursor: pointer;
}

.abm-modal-lead {
	font-size: 13px;
	color: var(--abm-text-muted);
	margin: 0 0 12px;
}

.abm-pro-features {
	margin: 0 0 16px;
	padding-left: 18px;
	font-size: 13px;
	color: var(--abm-text);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.abm-license-box {
	background: var(--abm-surface-2);
	border: 1px solid var(--abm-border);
	border-radius: 12px;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.abm-license-row {
	display: flex;
	gap: 8px;
}

.abm-license-row input {
	flex: 1;
	padding: 9px 12px;
	border-radius: 8px;
	border: 1px solid var(--abm-border);
	background: var(--abm-surface);
	color: var(--abm-text);
	font-family: monospace;
	font-size: 13px;
}

.abm-license-hint {
	font-size: 11.5px;
	color: var(--abm-text-muted);
}

.abm-pro-feedback {
	font-size: 12.5px;
	font-weight: 600;
}

.abm-modal-footer {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid var(--abm-border);
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.abm-btn-danger-outline {
	border: 1px solid var(--abm-rose);
	color: var(--abm-rose);
	background: transparent;
}

.abm-print-only {
	display: none;
}

@media (max-width: 1150px) {
	.abm-kpi-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.abm-main-grid {
		grid-template-columns: 1fr;
	}
	.abm-row-5 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media print {
	@page {
		size: A4 portrait;
		margin: 10mm;
	}

	body * {
		visibility: hidden;
	}

	#awobom-app,
	#abm-print-host,
	#abm-print-host * {
		visibility: visible;
	}

	.no-print {
		display: none !important;
	}

	#awobom-app {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		background: #ffffff !important;
		color: #0f172a !important;
		padding: 0 !important;
		margin: 0 !important;
		box-shadow: none !important;
	}

	.abm-print-only {
		display: block !important;
		width: 100%;
	}
}

