:root {
    --bg-dark: #0a0b10;
    --card-bg: rgba(20, 22, 37, 0.55);
    --border-color: rgba(255, 255, 255, 0.08);
    --accent-blue: #00d2ff;
    --accent-purple: #9d4edd;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --green-glow: #10b981;
    --red-glow: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 10% 20%, rgba(157, 78, 221, 0.1) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(0, 210, 255, 0.1) 0px, transparent 50%);
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    margin-bottom: 25px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.logo-area h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
}

.logo-area h1 span {
    color: var(--accent-blue);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.system-status {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 300;
    margin-left: 10px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
}

.pulse-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.pulse-indicator.green {
    background-color: var(--green-glow);
    box-shadow: 0 0 10px var(--green-glow);
    animation: pulse 1.8s infinite;
}

.pulse-indicator.red {
    background-color: var(--red-glow);
    box-shadow: 0 0 10px var(--red-glow);
    animation: pulse-red 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 25px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Glassmorphism Card Style */
.grid-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.card-header {
    margin-bottom: 15px;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

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

/* Map Card Details */
.map-card {
    height: 720px;
}

.canvas-container {
    flex-grow: 1;
    background: rgba(10, 10, 15, 0.7);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 0;
}

#map-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.config-panel {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.config-panel h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.coord-inputs {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.input-group label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.input-group input {
    background: rgba(10, 11, 16, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    text-align: center;
}

.input-group input:focus {
    border-color: var(--accent-blue);
}

/* Right Column Panels */
.right-column {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Camera Card */
.camera-card {
    overflow: hidden;
}

.camera-stream-container {
    background: #000;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    aspect-ratio: 4/3;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

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

/* Mode selectors and buttons */
.mode-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.btn {
    flex: 1;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-primary.active {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.4);
}

.btn-secondary {
    background: rgba(0, 210, 255, 0.1);
    color: var(--accent-blue);
    border: 1px solid rgba(0, 210, 255, 0.2);
    width: 100%;
}

.btn-secondary:hover {
    background: rgba(0, 210, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--red-glow);
    border: 1px solid rgba(239, 68, 68, 0.25);
    width: 100%;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-danger.active {
    background: #ef4444 !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6) !important;
}

.pose-panel {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.pose-panel h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.pose-value-display {
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.35);
    border-radius: 10px;
    padding: 12px;
    font-size: 16px;
    font-weight: 800;
    color: #38bdf8;
    text-align: center;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    letter-spacing: 0.5px;
}

/* Telemetry display */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.metric-box {
    background: rgba(10, 11, 16, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.metric-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.metric-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
}

#val-state {
    color: var(--accent-blue);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

/* RPM Panels */
.rpm-panel h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.rpm-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rpm-bar-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.wheel-name {
    width: 80px;
    font-size: 12px;
    color: var(--text-muted);
}

.bar-container {
    flex-grow: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 4px;
    transition: width 0.15s ease-out;
}

.rpm-val {
    width: 60px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
}

/* Environment mode badge */
.env-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    margin-right: 15px;
    transition: all 0.3s ease;
}

.env-badge.sim {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
    border-color: rgba(234, 179, 8, 0.25);
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.15);
}

.env-badge.real {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

/* Camera & ArUco Layout */
.camera-container-layout {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 20px;
    align-items: center;
}

@media (max-width: 768px) {
    .camera-container-layout {
        grid-template-columns: 1fr;
    }
}

/* ArUco Info Card Styles */
.aruco-info-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aruco-status-badge {
    padding: 6px 8px;
    border-radius: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.aruco-status-badge.disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red-glow);
    border-color: rgba(239, 68, 68, 0.2);
}

.aruco-status-badge.connected {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green-glow);
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.aruco-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.detail-row {
    background: rgba(10, 11, 16, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    font-size: 11px;
    color: var(--text-muted);
}

.detail-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

