/* ==========================================================================
   AwoProof v2.2.0 — Açık Hava Reklamı Yayın ve Montaj Kanıtı (Proof of Posting)
   Adaptive Day/Night Theme + A4 Client Proof Report & Photo Evidence Print Engine
   ========================================================================== */

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

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

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

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

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

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

.ap-logo-icon {
	width: 46px;
	height: 46px;
	border-radius: 12px;
	background: linear-gradient(135deg, #7c3aed, #2563eb);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	color: #fff;
	box-shadow: 0 6px 14px rgba(124, 58, 237, 0.32);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.ap-btn-amber {
	background: linear-gradient(135deg, #f59e0b, #d97706);
	color: #ffffff;
	font-weight: 700;
}

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

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

.ap-btn-block {
	width: 100%;
	padding: 11px 16px;
}

.ap-btn-link {
	background: none;
	border: none;
	color: var(--ap-primary);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	padding: 0;
}

.ap-btn-link:hover {
	text-decoration: underline;
}

.ap-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 Grid */
.ap-kpi-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-bottom: 18px;
}

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

.ap-kpi-missing-card {
	border-color: rgba(244, 63, 94, 0.38);
}

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

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

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

.ap-progress-track {
	width: 100%;
	height: 7px;
	background: var(--ap-surface-2);
	border-radius: 99px;
	overflow: hidden;
	border: 1px solid var(--ap-border);
}

.ap-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, #7c3aed, #10b981);
	border-radius: 99px;
	transition: width 0.3s ease;
}

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

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

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

.ap-text-rose {
	color: var(--ap-rose);
}

/* Missing Locations Alert Banner */
.ap-missing-banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding: 14px 18px;
	border-radius: var(--ap-radius);
	background: var(--ap-amber-soft);
	border: 1px solid var(--ap-amber);
	margin-bottom: 18px;
}

.ap-missing-banner[hidden] {
	display: none !important;
}

.ap-missing-banner-left {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 13.5px;
}

.ap-missing-icon {
	font-size: 24px;
}

.ap-missing-banner-sub {
	font-size: 12px;
	color: var(--ap-text-muted);
	margin-top: 2px;
}

.ap-missing-banner-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

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

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

.ap-sidebar,
.ap-content {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

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

.ap-bridge-card {
	border-color: rgba(139, 92, 246, 0.45);
}

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

.ap-board-header {
	flex-wrap: wrap;
}

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

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

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

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

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

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

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

.ap-field input:focus,
.ap-field select:focus {
	outline: none;
	border-color: var(--ap-primary);
}

/* Photo Upload & Watermark Box */
.ap-photo-box {
	border: 1px dashed var(--ap-border);
	border-radius: 10px;
	padding: 12px;
	background: var(--ap-surface-2);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ap-photo-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 12px;
	font-weight: 700;
	color: var(--ap-text);
}

.ap-file-input {
	font-size: 12px;
	color: var(--ap-text-muted);
}

.ap-checkbox-row {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 11.5px;
	color: var(--ap-text-muted);
	cursor: pointer;
}

.ap-photo-preview-wrap {
	border-radius: 9px;
	overflow: hidden;
	border: 1px solid var(--ap-border);
	background: #0f172a;
}

.ap-photo-preview-img {
	width: 100%;
	max-height: 195px;
	object-fit: cover;
	display: block;
}

/* Quick Filter Pills */
.ap-pill-group {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.ap-filter-pill {
	border: 1px solid var(--ap-border);
	background: var(--ap-surface-2);
	color: var(--ap-text-muted);
	padding: 5px 11px;
	border-radius: 99px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}

.ap-filter-pill.active {
	background: var(--ap-primary);
	border-color: var(--ap-primary);
	color: #ffffff;
}

/* Visual Gallery Grid */
.ap-gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
	gap: 14px;
}

.ap-unit-card {
	border: 1px solid var(--ap-border);
	background: var(--ap-surface-2);
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: transform 0.15s ease, border-color 0.15s ease;
}

.ap-unit-card:hover {
	transform: translateY(-2px);
	border-color: var(--ap-primary);
}

.ap-unit-card.is-missing {
	border-color: var(--ap-rose);
	background: var(--ap-rose-soft);
}

.ap-unit-card.is-issue {
	border-color: var(--ap-amber);
	background: var(--ap-amber-soft);
}

.ap-unit-card.is-posted {
	border-color: rgba(16, 185, 129, 0.45);
}

.ap-unit-thumb {
	width: 100%;
	height: 155px;
	background: #0f172a;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-bottom: 1px solid var(--ap-border);
}

.ap-unit-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ap-missing-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 14px;
	color: #fda4af;
	font-size: 12px;
	font-weight: 600;
	gap: 6px;
}

.ap-unit-code-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 9px;
	border-radius: 6px;
	background: #0f172a;
	color: #f8fafc;
	font-family: 'Inter', monospace;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.03em;
}

.ap-status-pill {
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 99px;
	display: inline-block;
}

.ap-status-pill.posted {
	background: var(--ap-emerald-soft);
	color: var(--ap-emerald);
}

.ap-status-pill.missing {
	background: var(--ap-rose-soft);
	color: var(--ap-rose);
}

.ap-status-pill.issue {
	background: var(--ap-amber-soft);
	color: var(--ap-amber);
}

.ap-unit-body {
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.ap-unit-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.ap-unit-title {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	color: var(--ap-text);
}

.ap-unit-meta {
	font-size: 12px;
	color: var(--ap-text-muted);
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.ap-unit-actions {
	display: flex;
	gap: 6px;
	margin-top: auto;
	padding-top: 8px;
}

/* Table & Filters */
.ap-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.ap-filter-input,
.ap-filter-select {
	padding: 7px 11px;
	border-radius: 9px;
	border: 1px solid var(--ap-border);
	background: var(--ap-surface-2);
	color: var(--ap-text);
	font-size: 12.5px;
}

.ap-table-wrap {
	overflow-x: auto;
}

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

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

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

.ap-table-thumb {
	width: 84px;
	height: 54px;
	border-radius: 7px;
	object-fit: cover;
	border: 1px solid var(--ap-border);
	display: block;
	background: #0f172a;
}

.ap-table-thumb-empty {
	width: 84px;
	height: 54px;
	border-radius: 7px;
	border: 1px dashed var(--ap-rose);
	background: var(--ap-rose-soft);
	color: var(--ap-rose);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	font-weight: 800;
	text-align: center;
	padding: 4px;
}

.ap-badge {
	font-size: 11px;
	font-weight: 700;
	padding: 3px 9px;
	border-radius: 99px;
	background: var(--ap-primary-soft);
	color: var(--ap-primary);
}

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

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

.ap-mini-btn.pri {
	background: var(--ap-primary);
	border-color: var(--ap-primary);
	color: #ffffff;
}

/* Modal */
.ap-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;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@media (max-width: 1100px) {
	.ap-kpi-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.ap-main-grid {
		grid-template-columns: 1fr;
	}
}

/* ==========================================================================
   @media print — A4 Client Proof-of-Posting Report, Photo Grid & Missing Sheet
   ========================================================================== */
@media print {
	@page {
		size: A4 portrait;
		margin: 10mm;
	}

	body * {
		visibility: hidden;
	}

	#awoproof-app,
	#ap-print-host,
	#ap-print-host * {
		visibility: visible;
	}

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

	#awoproof-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;
	}

	.ap-print-only {
		display: block !important;
		width: 100%;
		color: #0f172a;
		font-family: 'Inter', -apple-system, sans-serif;
	}

	.ap-print-sheet {
		border: 1px solid #cbd5e1;
		border-radius: 10px;
		padding: 16px;
		background: #ffffff;
	}

	.ap-print-table {
		width: 100%;
		border-collapse: collapse;
		font-size: 10.5px;
		margin-top: 10px;
	}

	.ap-print-table th,
	.ap-print-table td {
		border: 1px solid #cbd5e1;
		padding: 6px 8px;
		text-align: left;
		vertical-align: middle;
	}

	.ap-print-table th {
		background: #f1f5f9;
		font-weight: 700;
	}

	.ap-print-photo-grid {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
		margin-top: 12px;
	}

	.ap-print-photo-card {
		border: 1px solid #cbd5e1;
		border-radius: 8px;
		padding: 10px;
		page-break-inside: avoid;
		background: #ffffff;
	}

	.ap-print-photo-card img {
		width: 100%;
		height: 130px;
		object-fit: cover;
		border-radius: 6px;
		border: 1px solid #cbd5e1;
		margin-bottom: 6px;
		display: block;
	}

	.ap-qr-grid {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 14px;
	}

	.ap-qr-sticker {
		border: 2px dashed #1e293b;
		border-radius: 12px;
		padding: 16px;
		text-align: center;
		page-break-inside: avoid;
	}
}
