/* ==========================================================================
   DAILY DRIVER ECU TABLE GENERATOR STYLES (v0.0.2.0 - PT-BR & Mobile Optimized)
   Painel de Projetos de Motorização & Tabelas de Calibração
   ========================================================================== */

:root {
	--bg-dark: #070a12;
	--bg-darker: #0b1120;
	--bg-card: #0f172a;
	--border-color: #1e293b;
	--border-cyan: rgba(6, 182, 212, 0.4);
	--primary-cyan: #06b6d4;
	--accent-emerald: #10b981;
	--accent-amber: #f59e0b;
	--accent-rose: #f43f5e;
	--text-main: #f8fafc;
	--text-muted: #94a3b8;
	--radius-sm: 6px;
	--radius-md: 10px;
	--radius-lg: 14px;
	--font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.generator-wrapper {
	width: 100%;
	margin-top: 1.5rem;
}

.dd-calculator-container,
.dd-display-container {
	width: 100%;
}

/* Card System */
.card {
	background: var(--bg-card, #0f172a);
	border: 1px solid var(--border-color, #1e293b);
	border-radius: var(--radius-md, 10px);
	color: var(--text-main, #f8fafc);
	position: relative;
	box-sizing: border-box;
}

.card.glass-card {
	background: rgba(15, 23, 42, 0.75);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

.card.bg-darker, .bg-darker {
	background-color: var(--bg-darker, #0b1120) !important;
}

.card.bg-black, .bg-black {
	background-color: #000000 !important;
}

.card.bg-dark, .bg-dark {
	background-color: #0f172a !important;
}

.border-cyan {
	border-color: var(--border-cyan, rgba(6, 182, 212, 0.4)) !important;
}

.border-secondary {
	border-color: #334155 !important;
}

.border-color {
	border-color: var(--border-color, #1e293b) !important;
}

/* Spacing Utilities - Padding (p-0 a p-6) */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1rem !important; }
.p-5 { padding: 1.5rem !important; }
.p-6 { padding: 2rem !important; }

.px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-2\.5 { padding-left: 0.625rem !important; padding-right: 0.625rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-5 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.px-6 { padding-left: 2rem !important; padding-right: 2rem !important; }

.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-1\.5 { padding-top: 0.375rem !important; padding-bottom: 0.375rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-5 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-6 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
.py-8 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
.py-10 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

/* Spacing Utilities - Margin (m-0 a mb-8) */
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-5 { margin-bottom: 1.25rem !important; }
.mb-6 { margin-bottom: 1.5rem !important; }
.mb-8 { margin-bottom: 2rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mt-6 { margin-top: 1.5rem !important; }

.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 0.75rem !important; }
.me-4 { margin-right: 1rem !important; }

.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 0.75rem !important; }
.ms-4 { margin-left: 1rem !important; }

.mx-auto { margin-left: auto !important; margin-right: auto !important; }

/* Text & Colors */
.text-cyan { color: var(--primary-cyan, #06b6d4) !important; }
.text-emerald { color: var(--accent-emerald, #10b981) !important; }
.text-amber { color: var(--accent-amber, #f59e0b) !important; }
.text-rose { color: var(--accent-rose, #f43f5e) !important; }
.text-light { color: #f8fafc !important; }
.text-muted { color: #94a3b8 !important; }
.text-main { color: var(--text-main, #f8fafc) !important; }
.text-white { color: #ffffff !important; }
.text-dark { color: #070a12 !important; }
.text-center { text-align: center !important; }

.bg-cyan { background-color: var(--primary-cyan, #06b6d4) !important; }
.bg-emerald { background-color: var(--accent-emerald, #10b981) !important; }
.bg-amber { background-color: var(--accent-amber, #f59e0b) !important; }
.bg-rose { background-color: var(--accent-rose, #f43f5e) !important; }
.bg-secondary { background-color: #334155 !important; }

/* Typography */
.fw-bold { font-weight: 700 !important; }
.font-bold { font-weight: 700 !important; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important; }
.fs-xs { font-size: 0.75rem !important; }
.fs-sm { font-size: 0.85rem !important; }

/* Layout / Flexbox */
.d-flex { display: flex !important; }
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }
.flex-wrap { flex-wrap: wrap !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }

.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.ratio {
	position: relative;
	width: 100%;
}
.ratio::before {
	display: block;
	padding-top: var(--bs-aspect-ratio, 100%);
	content: "";
}
.ratio-1x1 {
	--bs-aspect-ratio: 100%;
}
.ratio > * {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/* Lock Login Screen for Guests */
.d-none {
	display: none !important;
}

.dd-login-lock-box {
	background: radial-gradient(circle at 50% 30%, rgba(6, 182, 212, 0.1), var(--bg-card) 70%);
	border: 1px solid var(--border-cyan);
	border-radius: var(--radius-lg);
}

.dd-lock-icon {
	width: 70px;
	height: 70px;
	border-radius: 50%;
	background: rgba(6, 182, 212, 0.15);
	border: 1px solid var(--border-cyan);
	color: var(--primary-cyan);
	display: flex;
	align-items: center;
	justify-content: center;
}

.dd-lock-title {
	font-size: clamp(1.25rem, 3.5vw, 1.75rem);
	font-weight: 800;
}

.dd-lock-desc {
	font-size: clamp(0.9rem, 2.2vw, 1.05rem);
	line-height: 1.7;
}

/* 5 Project Slots Bar */
.dd-project-slots-bar {
	border-radius: var(--radius-md);
}

.dd-slots-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 0.75rem;
}

.dd-slot-card {
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 0.75rem;
	transition: all 0.2s ease;
	cursor: pointer;
}

.dd-slot-card:hover {
	border-color: var(--border-cyan);
}

.dd-slot-card.active {
	background: rgba(6, 182, 212, 0.15);
	border-color: var(--primary-cyan);
	box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.dd-slot-card.filled {
	border-left: 3px solid var(--accent-emerald);
}

.dd-slot-card.empty {
	opacity: 0.75;
}

.slot-num {
	font-size: 0.7rem;
	font-weight: 800;
	text-transform: uppercase;
	color: var(--primary-cyan);
	letter-spacing: 0.05em;
}

.slot-title {
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--text-main);
	margin-top: 0.2rem;
}

.btn-xs {
	padding: 0.35rem 0.6rem;
	font-size: 0.75rem;
	border-radius: 4px;
	min-height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.btn-cyan {
	background: var(--primary-cyan, #06b6d4);
	color: #070a12;
	font-weight: 700;
	border: none;
	transition: all 0.2s ease;
}

.btn-cyan:hover {
	background: #22d3ee;
	box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.btn-emerald {
	background: #10b981 !important;
	color: #ffffff !important;
	font-weight: 700;
	border: none;
	box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-outline-rose {
	background: transparent;
	border: 1px solid rgba(244, 63, 94, 0.4);
	color: var(--accent-rose);
}

.btn-outline-rose:hover {
	background: rgba(244, 63, 94, 0.2);
	color: #fff;
}

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

.spin-icon {
	animation: spin 1s linear infinite;
	display: inline-block;
}

/* Controls Form Grid */
.dd-form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 1.25rem;
}

.dd-form-card {
	background: rgba(19, 27, 46, 0.6);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.25rem;
}

.dd-card-heading {
	font-size: 1.05rem;
	margin-bottom: 1.25rem;
	color: var(--primary-cyan);
	display: flex;
	align-items: center;
}

.dd-control-group label {
	display: block;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text-muted);
	margin-bottom: 0.4rem;
}

.dd-label-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.dd-badge-val {
	font-family: var(--font-heading);
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--primary-cyan);
}

.dd-select, .dd-input {
	width: 100%;
	padding: 0.6rem 0.9rem;
	min-height: 44px;
	background: var(--bg-dark);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	color: var(--text-main);
	font-size: 0.9rem;
	-webkit-appearance: none;
}

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

.dd-input-locked {
	background-color: rgba(30, 41, 59, 0.7) !important;
	color: #94a3b8 !important;
	border-color: rgba(148, 163, 184, 0.2) !important;
	cursor: not-allowed !important;
}

.dd-slider {
	width: 100%;
	accent-color: var(--primary-cyan);
	height: 8px;
	border-radius: 4px;
	background: var(--bg-dark);
	cursor: pointer;
}

/* Live Summary Panel (Sticky Telemetry Dashboard) */
.dd-live-summary-panel {
	position: sticky;
	top: 15px;
	z-index: 100;
	background: rgba(15, 23, 42, 0.94);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid var(--border-cyan);
	border-radius: var(--radius-md);
	padding: 0.85rem;
	box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 20px rgba(6, 182, 212, 0.15);
	transition: all 0.3s ease;
}

/* Summary Grid */
.dd-summary-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 1rem;
}

.dd-summary-card {
	background: var(--bg-glass);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.15rem;
	display: flex;
	align-items: center;
	gap: 0.85rem;
}

.dd-summary-icon {
	width: 44px;
	height: 44px;
	min-width: 44px;
	border-radius: var(--radius-sm);
	display: flex;
	align-items: center;
	justify-content: center;
}

.dd-summary-val {
	display: block;
	font-family: var(--font-heading);
	font-size: clamp(1.1rem, 2.5vw, 1.4rem);
	font-weight: 800;
	color: var(--text-main);
	line-height: 1.1;
}

.dd-summary-lbl {
	font-size: 0.72rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* Tab Toolbar Responsive Scroll */
.dd-map-toolbar {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding: 0.75rem;
}

.dd-tab-group {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	overflow-x: auto;
	flex-wrap: nowrap;
	white-space: nowrap;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 0.25rem;
}

.dd-tab-btn {
	padding: 0.6rem 1rem;
	font-size: 0.85rem;
	font-weight: 600;
	border-radius: var(--radius-md);
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	cursor: pointer;
	flex-shrink: 0;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	transition: all 0.2s ease;
}

.dd-tab-btn.active {
	background: var(--bg-surface);
	border-color: var(--primary-cyan);
	color: var(--primary-cyan);
}

.dd-tab-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	display: inline-block;
}

.dot-cyan { background: var(--primary-cyan); box-shadow: 0 0 6px var(--primary-cyan); }
.dot-amber { background: var(--accent-amber); box-shadow: 0 0 6px var(--accent-amber); }
.dot-emerald { background: var(--accent-emerald); box-shadow: 0 0 6px var(--accent-emerald); }

/* Heatmap Table & Touch Scroll Container */
.dd-heatmap-wrapper {
	overflow: hidden;
}

.dd-heatmap-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
}

.dd-heatmap-title {
	font-size: clamp(1rem, 2.5vw, 1.2rem);
	color: var(--text-main);
}

.dd-axis-info {
	font-size: 0.78rem;
	color: var(--text-muted);
	letter-spacing: 0.04em;
}

.dd-grid-scroll-container {
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-x pan-y;
	padding-bottom: 0.5rem;
	border-radius: var(--radius-sm);
}

/* Custom Scrollbar for 16x16 Grid */
.dd-grid-scroll-container::-webkit-scrollbar {
	height: 8px;
}

.dd-grid-scroll-container::-webkit-scrollbar-track {
	background: var(--bg-dark);
	border-radius: 4px;
}

.dd-grid-scroll-container::-webkit-scrollbar-thumb {
	background: var(--primary-cyan);
	border-radius: 4px;
}

.dd-heatmap-table {
	width: 100%;
	min-width: 660px; /* Protects matrix from squishing on mobile */
	border-collapse: separate;
	border-spacing: 3px;
	font-family: var(--font-heading);
	font-size: 0.78rem;
}

.dd-heatmap-table th, .dd-heatmap-table td {
	text-align: center;
	padding: 0.5rem 0.2rem;
	border-radius: 4px;
	min-width: 38px;
}

.dd-heatmap-table th.map-header, .dd-heatmap-table th.rpm-header {
	background: var(--bg-surface);
	color: var(--text-muted);
	font-weight: 700;
	border: 1px solid var(--border-color);
}

.dd-heatmap-table td.cell-val,
.dd-heatmap-table td.dd-heatmap-cell {
	font-weight: 700;
	color: #ffffff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
	cursor: default;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dd-heatmap-table td.cell-val:hover,
.dd-heatmap-table td.dd-heatmap-cell:hover {
	transform: scale(1.12);
	z-index: 10;
	box-shadow: 0 0 12px rgba(255,255,255,0.85);
}

/* Canvas Wrapper Responsive */
.dd-canvas-wrapper {
	background: #070a12;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 0.75rem;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

#dd-surface-canvas, #dd-turbo-map-canvas, #dd-dyno-graph-canvas, #dd-3d-injection-canvas, #dd-3d-ignition-canvas {
	width: 100%;
	max-width: 100%;
	height: auto !important;
	display: block;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (Mobile & Tablet Breakpoints for Generator)
   ========================================================================== */

/* Grid System Fallbacks for Plugin Templates */
.dd-display-container .row, .dd-calculator-container .row {
	display: flex;
	flex-wrap: wrap;
	margin-left: -0.5rem;
	margin-right: -0.5rem;
}

.dd-display-container [class*="col-"], .dd-calculator-container [class*="col-"] {
	padding-left: 0.5rem;
	padding-right: 0.5rem;
	width: 100%;
}

@media (min-width: 768px) {
	.dd-display-container .col-md-3, .dd-calculator-container .col-md-3 { width: 25%; }
	.dd-display-container .col-md-4, .dd-calculator-container .col-md-4 { width: 33.333%; }
	.dd-display-container .col-md-5, .dd-calculator-container .col-md-5 { width: 41.666%; }
	.dd-display-container .col-md-6, .dd-calculator-container .col-md-6 { width: 50%; }
	.dd-display-container .col-md-7, .dd-calculator-container .col-md-7 { width: 58.333%; }
}

@media (max-width: 767px) {
	.dd-display-container .col-6, .dd-calculator-container .col-6 { width: 50%; }
}

@media (max-width: 991px) {
	.dd-slots-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 0.5rem;
	}

	.dd-heatmap-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.35rem;
	}
}

@media (max-width: 768px) {
	.dd-slots-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.dd-slot-save-bar {
		flex-direction: column;
		align-items: stretch !important;
	}

	.dd-slot-save-bar .btn {
		width: 100%;
		justify-content: center;
		min-height: 46px;
	}

	.dd-summary-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.dd-canvas-wrapper canvas {
		min-width: 580px; /* Enables scrollable chart view on smartphones */
	}
}

@media (max-width: 480px) {
	.dd-slots-grid {
		grid-template-columns: 1fr;
	}

	.dd-summary-grid {
		grid-template-columns: 1fr;
	}

	.dd-form-grid {
		grid-template-columns: 1fr;
	}

	.dd-lock-actions {
		display: flex;
		flex-direction: column;
		gap: 0.75rem;
	}

	.dd-lock-actions .btn {
		width: 100%;
		margin-right: 0 !important;
	}
}

/* ==========================================================================
   DAILY DRIVER ECU TABLE GENERATOR STYLES (v0.0.2.0 - PT-BR & Mobile Optimized)
   ========================================================================== */

.dd-wizard-header {
	border-radius: var(--radius-md);
	background: rgba(15, 23, 42, 0.7);
	border: 1px solid var(--border-color);
}

.dd-wizard-steps {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	width: 100%;
}

.dd-wizard-step {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	cursor: pointer;
	padding: 0.6rem 0.9rem;
	border-radius: var(--radius-sm);
	transition: all 0.25s ease;
	user-select: none;
	flex: 1;
	border: 1px solid transparent;
}

.dd-wizard-step:hover {
	background: rgba(6, 182, 212, 0.08);
	border-color: rgba(6, 182, 212, 0.3);
}

.dd-wizard-step.active {
	background: rgba(6, 182, 212, 0.15);
	border-color: var(--primary-cyan);
	box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.dd-wizard-step.completed .dd-step-circle {
	background: #10b981;
	color: #ffffff;
	border-color: #10b981;
}

.dd-step-circle {
	width: 32px;
	height: 32px;
	min-width: 32px;
	border-radius: 50%;
	background: var(--bg-dark);
	border: 2px solid var(--border-color);
	color: var(--text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 0.85rem;
	transition: all 0.25s ease;
}

.dd-wizard-step.active .dd-step-circle {
	background: var(--primary-cyan);
	color: #070a12;
	border-color: var(--primary-cyan);
	box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
}

.dd-step-info {
	display: flex;
	flex-direction: column;
}

.dd-step-name {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--text-main);
	line-height: 1.2;
}

.dd-wizard-step.active .dd-step-name {
	color: var(--primary-cyan);
}

.dd-step-desc {
	font-size: 0.72rem;
	color: var(--text-muted);
}

.dd-wizard-line {
	flex: 0 0 20px;
	height: 2px;
	background: var(--border-color);
	margin: 0 4px;
}

.dd-steps-container {
	width: 100%;
}

.dd-step-panel {
	animation: fadeInStep 0.25s ease forwards;
}

.dd-step-footer {
	gap: 1rem;
}

@keyframes fadeInStep {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 991px) {
	.dd-wizard-steps {
		flex-direction: column;
		align-items: stretch;
		gap: 0.5rem;
	}
	.dd-wizard-line {
		display: none;
	}
}

/* Indicador de cálculo assíncrono e transição suave */
#dd-table-display-app {
	transition: opacity 0.2s ease;
}

#dd-table-display-app.dd-calculating {
	opacity: 0.75;
}

.dd-calc-loader-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.25rem 0.65rem;
	border-radius: 9999px;
	background: rgba(6, 182, 212, 0.15);
	border: 1px solid var(--primary-cyan, #06b6d4);
	color: var(--primary-cyan, #06b6d4);
	font-size: 0.75rem;
	font-weight: 600;
	animation: ddPulseLoader 1.2s infinite ease-in-out;
}

@keyframes ddPulseLoader {
	0%, 100% {
		opacity: 0.6;
		transform: scale(0.98);
	}
	50% {
		opacity: 1;
		transform: scale(1.02);
	}
}

