/* CarSys - Mobile-first front application styles */

body {
	padding-bottom: 70px;
}

@media (min-width: 768px) {
	body {
		padding-bottom: 0;
	}
}

/* Login */
.login-container {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 70vh;
}

.login-card {
	max-width: 400px;
	width: 100%;
}

/* Cards */
.card {
	border-radius: 12px;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
	transform: translateY(-2px);
	box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12) !important;
}

/* Status badges */
.badge--draft { background-color: #6c757d; }
.badge--submitted { background-color: #0d6efd; }
.badge--synced { background-color: #198754; }
.badge--error { background-color: #dc3545; }

/* Photo grid */
.photo-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 0.5rem;
}

.photo-grid__item {
	position: relative;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 8px;
}

.photo-grid__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Signature canvas */
.signature-canvas {
	border: 2px dashed #dee2e6;
	border-radius: 8px;
	background: #fff;
	touch-action: none;
}

/* Form sections */
.form-section {
	background: #fff;
	border-radius: 12px;
	padding: 1.25rem;
	margin-bottom: 1rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.form-section__title {
	font-size: 1rem;
	font-weight: 600;
	color: #495057;
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid #e9ecef;
}

/* Brake pad visualization */
.brake-pad-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	max-width: 300px;
	margin: 0 auto;
}

.brake-pad-grid__item {
	text-align: center;
	padding: 0.75rem;
	border: 1px solid #dee2e6;
	border-radius: 8px;
}

/* Bottom nav active state */
.fixed-bottom .nav-link.active {
	color: #0d6efd;
}

/* Fluid level indicators */
.fluid-level {
	height: 8px;
	border-radius: 4px;
	background: #e9ecef;
	overflow: hidden;
}

.fluid-level__fill {
	height: 100%;
	border-radius: 4px;
	transition: width 0.3s ease;
}

/* Range slider styling */
input[type="range"].form-control {
	padding: 0.5rem 0.75rem;
	border: 1px solid #dee2e6;
	border-radius: 8px;
	background: #f8f9fa;
	box-shadow: none;
	height: auto;
}

input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 8px;
	background: #e9ecef;
	border-radius: 4px;
	outline: none;
	cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #0d6efd;
	cursor: pointer;
	border: 3px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #0d6efd;
	cursor: pointer;
	border: 3px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]:focus::-webkit-slider-thumb {
	box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.range-value {
	font-size: 1.1rem;
}

/* ======================================
   Camera Capture Overlay
   ====================================== */
.camera-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: #000;
	display: flex;
	flex-direction: column;
	color: #fff;
	user-select: none;
	-webkit-user-select: none;
}

.camera-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.5rem 1rem;
	background: rgba(0, 0, 0, 0.6);
	position: relative;
	z-index: 2;
	flex-shrink: 0;
}

.camera-title {
	font-size: 1rem;
	font-weight: 600;
}

.camera-close,
.camera-switch {
	background: none;
	border: none;
	color: #fff;
	font-size: 1.4rem;
	padding: 0.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border-radius: 50%;
	width: 44px;
	height: 44px;
}

.camera-close:active,
.camera-switch:active {
	background: rgba(255, 255, 255, 0.2);
}

.camera-viewfinder {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	position: relative;
	background: #111;
}

.camera-viewfinder video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.camera-status {
	position: absolute;
	text-align: center;
	font-size: 1rem;
	color: #aaa;
	padding: 2rem;
}

.camera-flash {
	position: absolute;
	inset: 0;
	background: #fff;
	animation: camera-flash-anim 0.3s ease-out forwards;
	pointer-events: none;
}

@keyframes camera-flash-anim {
	0% { opacity: 0.8; }
	100% { opacity: 0; }
}

.camera-preview-strip {
	display: flex;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	overflow-x: auto;
	flex-shrink: 0;
	background: rgba(0, 0, 0, 0.7);
	min-height: 0;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.camera-preview-strip::-webkit-scrollbar {
	display: none;
}

.camera-preview-strip:empty {
	display: none;
}

.camera-thumb {
	position: relative;
	width: 56px;
	height: 56px;
	flex-shrink: 0;
	border-radius: 8px;
	overflow: hidden;
	border: 2px solid rgba(255, 255, 255, 0.4);
}

.camera-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.camera-thumb__remove {
	position: absolute;
	top: -2px;
	right: -2px;
	background: rgba(220, 53, 69, 0.9);
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 22px;
	height: 22px;
	font-size: 0.7rem;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
}

.camera-controls {
	display: flex;
	align-items: center;
	justify-content: space-around;
	padding: 1rem 2rem;
	padding-bottom: max(1rem, env(safe-area-inset-bottom));
	background: rgba(0, 0, 0, 0.8);
	flex-shrink: 0;
}

.camera-btn-gallery {
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: #fff;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	font-size: 1.3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.camera-btn-gallery:active {
	background: rgba(255, 255, 255, 0.3);
}

.camera-btn-capture {
	background: none;
	border: 3px solid #fff;
	border-radius: 50%;
	width: 72px;
	height: 72px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 4px;
	transition: transform 0.1s;
}

.camera-btn-capture:active {
	transform: scale(0.9);
}

.camera-btn-capture__ring {
	display: block;
	width: 100%;
	height: 100%;
	background: #fff;
	border-radius: 50%;
	transition: background 0.1s;
}

.camera-btn-capture:active .camera-btn-capture__ring {
	background: #ccc;
}

.camera-btn-done {
	position: relative;
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: #fff;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	font-size: 1.3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0.5;
	transition: opacity 0.2s;
}

.camera-btn-done--active {
	opacity: 1;
	background: #198754;
}

.camera-btn-done:active {
	background: rgba(255, 255, 255, 0.3);
}

.camera-btn-done--active:active {
	background: #157347;
}

.camera-btn-done__count {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #0d6efd;
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
	min-width: 20px;
	height: 20px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 5px;
}

/* ======================================
   Auto-save status indicator (in top navbar)
   ====================================== */
.autosave-status {
	background: rgba(255, 255, 255, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 20px;
	padding: 0.2rem 0.6rem;
	font-size: 0.75rem;
	display: flex;
	align-items: center;
	gap: 0.3rem;
	color: rgba(255, 255, 255, 0.9);
	transition: background 0.3s, color 0.3s, border-color 0.3s;
	white-space: nowrap;
}

.autosave-status--saved {
	color: #75e6a5;
	border-color: rgba(117, 230, 165, 0.4);
}

.autosave-status--dirty {
	color: #ffc107;
	border-color: rgba(255, 193, 7, 0.4);
}

.autosave-status--saving {
	color: #8cc4ff;
	border-color: rgba(140, 196, 255, 0.4);
}

.autosave-status--saving i {
	animation: autosave-spin 1s linear infinite;
}

@keyframes autosave-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

.autosave-status--error {
	color: #ff8a8a;
	border-color: rgba(255, 138, 138, 0.4);
	background: rgba(220, 53, 69, 0.2);
}

.autosave-status--warning {
	color: #ffc107;
	border-color: rgba(255, 193, 7, 0.4);
	background: rgba(255, 193, 7, 0.15);
}

.autosave-status--info {
	color: #8cc4ff;
	border-color: rgba(140, 196, 255, 0.4);
}

/* Toggle switch */
.toggle-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	user-select: none;
}

.toggle-switch input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.toggle-switch__track {
	position: relative;
	width: 48px;
	height: 26px;
	background: #ccc;
	border-radius: 13px;
	transition: background 0.2s;
	flex-shrink: 0;
}

.toggle-switch__track::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-switch__track {
	background: #198754;
}

.toggle-switch input:checked + .toggle-switch__track::after {
	transform: translateX(22px);
}

.toggle-switch__label {
	font-size: 0.95rem;
}

/* Search & sort controls */
.list-filter {
	margin-bottom: 1rem;
}

.list-filter .form-control {
	border-radius: 20px;
	padding-left: 2.5rem;
}

.list-filter .search-icon {
	position: absolute;
	left: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	color: #6c757d;
	pointer-events: none;
}

.list-filter .search-clear {
	position: absolute;
	right: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: #6c757d;
	font-size: 1rem;
	padding: 0.25rem;
	cursor: pointer;
	line-height: 1;
	text-decoration: none;
}

.list-filter .search-clear:hover {
	color: #dc3545;
}

/* Maintenance checkbox grid */
.maintenance-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.25rem 1rem;
}

@media (min-width: 576px) {
	.maintenance-grid {
		grid-template-columns: 1fr 1fr 1fr;
	}
}

/* Brake pad axle visualization */
.axle-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}

.axle-row__label {
	min-width: 70px;
	font-weight: 600;
	font-size: 0.85rem;
	text-align: center;
	color: #495057;
}

.axle-row__side {
	flex: 1;
	text-align: center;
}

.axle-row__side small {
	display: block;
	font-size: 0.75rem;
	color: #6c757d;
	margin-bottom: 0.25rem;
}

/* Brake pad thermometer */
.brake-thermo {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
}

.brake-thermo__bar {
	width: 28px;
	height: 80px;
	border-radius: 14px;
	background: #e9ecef;
	position: relative;
	overflow: hidden;
	border: 2px solid #dee2e6;
}

.brake-thermo__fill {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	border-radius: 0 0 12px 12px;
	transition: height 0.3s ease;
}

.brake-thermo__fill--good { background: #198754; }
.brake-thermo__fill--warn { background: #ffc107; }
.brake-thermo__fill--danger { background: #dc3545; }

.brake-thermo__pct {
	font-weight: 600;
	font-size: 0.85rem;
}

/* Speech-to-text button */
.speech-btn {
	position: absolute;
	bottom: 0.4rem;
	right: 0.4rem;
	z-index: 5;
	border-radius: 50%;
	width: 32px;
	height: 32px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.7;
	transition: opacity 0.2s;
}

.speech-btn:hover,
.speech-btn.btn-danger {
	opacity: 1;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 1050;
	background: #fff;
	border: 1px solid #dee2e6;
	border-top: 0;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	max-height: 250px;
	overflow-y: auto;
	display: none;
}

.autocomplete-dropdown.show {
	display: block;
}

.autocomplete-dropdown__item {
	padding: 0.5rem 0.75rem;
	cursor: pointer;
	border-bottom: 1px solid #f0f0f0;
}

.autocomplete-dropdown__item:last-child {
	border-bottom: 0;
}

.autocomplete-dropdown__item:hover,
.autocomplete-dropdown__item.active {
	background: #e9ecef;
}

.autocomplete-dropdown__item strong {
	display: block;
}

.autocomplete-dropdown__item small {
	color: #6c757d;
}

/* ── Reception: License plate guide frame ── */
.lp-guide-frame {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 60%;
	height: 15%;
	border: 3px solid rgba(255, 255, 0, 0.8);
	border-radius: 8px;
	pointer-events: none;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

.lp-guide-frame::after {
	content: 'Zarovnejte SPZ do rámečku';
	position: absolute;
	bottom: -30px;
	left: 50%;
	transform: translateX(-50%);
	color: #fff;
	font-size: 14px;
	white-space: nowrap;
	text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* ── Reception: Photo wizard ── */
.wizard-dot {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-size: 1.2rem;
	color: #adb5bd;
	cursor: pointer;
	transition: all 0.2s;
}

.wizard-dot.done {
	color: #198754;
}

.wizard-dot.active {
	background: #e7f1ff;
	color: #0d6efd;
	box-shadow: 0 0 0 2px #0d6efd;
}

.wizard-step .card {
	transition: transform 0.15s;
}

.wizard-step .btn-capture {
	min-width: 200px;
}

.step-photo-preview img {
	border: 3px solid #198754;
}

.wizard-summary-thumb {
	cursor: pointer;
}

.wizard-summary-thumb:hover img {
	opacity: 0.8;
}

/* ── Reception: Video recorder ── */
.video-rec-indicator {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	gap: 6px;
	color: #ff4444;
	font-weight: bold;
	font-size: 14px;
	text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.rec-dot {
	width: 12px;
	height: 12px;
	background: #ff4444;
	border-radius: 50%;
	animation: rec-blink 1s infinite;
}

@keyframes rec-blink {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.3; }
}

.video-btn-rec {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	border: 4px solid #fff;
	background: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	cursor: pointer;
}

.video-btn-rec__ring {
	width: 56px;
	height: 56px;
	background: #ff4444;
	border-radius: 50%;
	transition: border-radius 0.2s, width 0.2s, height 0.2s;
}

.video-btn-rec.recording .video-btn-rec__ring {
	width: 28px;
	height: 28px;
	border-radius: 4px;
}

.video-timer {
	font-size: 16px;
}

/* ── Damage cards ── */
.damage-card {
	border-left: 4px solid #dc3545;
}
