/* Periphery page styles */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --dark-color: #212529;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

.card {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    border: none;
    transition: transform 0.3s ease;
    background: white;
}

.card:hover {
    transform: translateY(-5px);
}

.header-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header-card h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.navbar-custom {
    background: white;
    border-radius: 15px;
    padding: 15px 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.navbar-custom .nav-link {
    color: #495057;
    font-weight: 600;
    padding: 8px 15px;
    margin: 0 5px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.navbar-custom .nav-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.navbar-custom .nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-test {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-test:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 25px;
    padding: 8px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(240, 147, 251, 0.4);
}

.btn-outline-light {
    border-radius: 25px;
    font-weight: 600;
    border: 2px solid #667eea;
    color: #667eea;
    transition: all 0.3s ease;
}

.btn-outline-light:hover {
    transform: scale(1.05);
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 25px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.status-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    padding: 15px 20px;
    border: none;
}

.card-header h5 {
    margin: 0;
    font-size: 1.2rem;
}

.card-body {
    padding: 20px;
}

.thermal-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

#thermalVideoPlayer {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.thermal-controls-section {
    margin-top: 15px;
}

.thermal-controls {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
}

.telemetry-console {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.config-form label {
    font-weight: 600;
    color: #495057;
}

.config-form input[type="text"],
.config-form input[type="number"] {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease;
}

.config-form input[type="text"]:focus,
.config-form input[type="number"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.listen-group {
    border-radius: 10px;
    overflow: hidden;
}

.autostart-group {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
}

.alert {
    border-radius: 10px;
    border: none;
}

.alert-info {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #495057;
}

button.stop {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 8px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

button.stop:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

#zoomSlider {
    width: 100%;
    margin: 10px 0;
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

/* Telemetry styles */
.telemetry-section {
    margin-bottom: 20px;
}

.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.telemetry-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.telemetry-card h6 {
    color: #667eea;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.telemetry-card h6 i {
    margin-right: 8px;
}

/* Telemetry card drag handle */
.tcard-drag-handle {
    cursor: grab;
    opacity: 0.4;
    margin-right: 6px;
    transition: opacity 0.2s ease;
    font-size: 0.85rem;
}

.telemetry-card:hover .tcard-drag-handle {
    opacity: 0.8;
}

.tcard-drag-handle:active {
    cursor: grabbing;
}

/* Telemetry card sortable states */
.telemetry-card.tcard-sortable-ghost {
    opacity: 0.4;
    background: #e9ecef;
}

.telemetry-card.tcard-sortable-chosen {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transform: rotate(1deg);
    z-index: 100;
}

.telemetry-card.tcard-sortable-drag {
    opacity: 1;
}

.telemetry-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.9rem;
}

.telemetry-item .label {
    color: #6c757d;
}

.telemetry-item .value {
    font-weight: 600;
    color: #495057;
    font-family: 'Courier New', monospace;
}

.telemetry-item .value.good {
    color: #198754;
}

.telemetry-item .value.warning {
    color: #ffc107;
}

.telemetry-item .value.danger {
    color: #dc3545;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.connection-status.connected {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.1) 0%, rgba(25, 135, 84, 0.2) 100%);
    color: #198754;
}

.connection-status.disconnected {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.2) 100%);
    color: #dc3545;
}

.connection-status i {
    font-size: 1.2rem;
}

.attitude-display {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding: 10px 0;
}

.attitude-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.attitude-label {
    font-size: 0.8rem;
    color: #6c757d;
}

.battery-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.battery-bar .fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.battery-bar .fill.good {
    background: linear-gradient(90deg, #198754 0%, #20c997 100%);
}

.battery-bar .fill.warning {
    background: linear-gradient(90deg, #ffc107 0%, #fd7e14 100%);
}

.battery-bar .fill.danger {
    background: linear-gradient(90deg, #dc3545 0%, #c82333 100%);
}

.rc-channels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

/* 16-channel RC grid layout */
.rc-channels.rc-channels-16 {
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.rc-channel {
    text-align: center;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 8px;
}

.rc-channels-16 .rc-channel {
    padding: 4px;
}

.rc-channel .ch-num {
    font-size: 0.7rem;
    color: #6c757d;
}

.rc-channels-16 .rc-channel .ch-num {
    font-size: 0.65rem;
}

.rc-channel .ch-val {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
}

.rc-channels-16 .rc-channel .ch-val {
    font-size: 0.75rem;
}

/* RC channels card - wider to fit 16 channels */
.rc-channels-card {
    grid-column: span 2;
}

/* Clickable RC channel styling */
.rc-channel.rc-channel-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.rc-channel.rc-channel-clickable:hover {
    background: #e9ecef;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.rc-channel.rc-channel-clickable:active {
    transform: scale(0.98);
}

/* GPIO indicator icon on RC channel */
.gpio-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    display: none;
    opacity: 0.7;
    transition: all 0.2s ease;
}

/* Show icon when mapped */
.gpio-indicator.mapped {
    display: block;
    color: #6c757d;  /* Neutral gray when not triggered */
}

/* HIGH output type - green when triggered */
.gpio-indicator.mapped.output-high {
    color: #6c757d;  /* Gray when not triggered */
}

.gpio-indicator.mapped.output-high.triggered {
    color: #198754;  /* Green when triggered */
    opacity: 1;
    animation: gpio-pulse-high 1s ease-in-out infinite;
    text-shadow: 0 0 6px rgba(25, 135, 84, 0.8);
}

/* LOW output type - red when triggered */
.gpio-indicator.mapped.output-low {
    color: #6c757d;  /* Gray when not triggered */
}

.gpio-indicator.mapped.output-low.triggered {
    color: #dc3545;  /* Red when triggered */
    opacity: 1;
    animation: gpio-pulse-low 1s ease-in-out infinite;
    text-shadow: 0 0 6px rgba(220, 53, 69, 0.8);
}

@keyframes gpio-pulse-high {
    0%, 100% {
        opacity: 0.8;
        text-shadow: 0 0 4px rgba(25, 135, 84, 0.5);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(25, 135, 84, 1);
    }
}

@keyframes gpio-pulse-low {
    0%, 100% {
        opacity: 0.8;
        text-shadow: 0 0 4px rgba(220, 53, 69, 0.5);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(220, 53, 69, 1);
    }
}

/* RC channel with active GPIO mapping */
.rc-channel.has-gpio-mapping {
    border: 2px solid #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

/* Triggered state for HIGH output - green */
.rc-channel.gpio-triggered.gpio-output-high {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.15) 0%, rgba(32, 201, 151, 0.15) 100%);
    border-color: #198754;
}

/* Triggered state for LOW output - red */
.rc-channel.gpio-triggered.gpio-output-low {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, rgba(200, 35, 51, 0.15) 100%);
    border-color: #dc3545;
}

/* Default triggered state (fallback) */
.rc-channel.gpio-triggered {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.15) 0%, rgba(32, 201, 151, 0.15) 100%);
    border-color: #198754;
}

/* Responsive: 4 columns on medium screens, 2 on small */
@media (max-width: 1200px) {
    .rc-channels.rc-channels-16 {
        grid-template-columns: repeat(4, 1fr);
    }
    .rc-channels-card {
        grid-column: span 1;
    }
}

@media (max-width: 576px) {
    .rc-channels.rc-channels-16 {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
    .rc-channels-16 .rc-channel {
        padding: 3px;
    }
    .rc-channels-16 .rc-channel .ch-num {
        font-size: 0.6rem;
    }
    .rc-channels-16 .rc-channel .ch-val {
        font-size: 0.7rem;
    }
}

.imu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.imu-axis {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.imu-axis .axis-label {
    font-size: 0.75rem;
    color: #6c757d;
}

.imu-axis .axis-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
}

/* Drag and Drop styles */
.drag-handle {
    cursor: grab;
    opacity: 0.6;
    margin-right: 8px;
    transition: opacity 0.2s ease;
}

.card-header:hover .drag-handle {
    opacity: 1;
}

.status-card.sortable-ghost {
    opacity: 0.4;
    background: #e9ecef;
}

.status-card.sortable-chosen {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    transform: rotate(2deg);
}

.status-card.sortable-drag {
    opacity: 1;
}

#sortable-cards-container {
    min-height: 100px;
}

/* ==================== Card Header Actions ==================== */

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

/* Close button on cards */
.btn-close-card {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    padding: 0;
    flex-shrink: 0;
}

.btn-close-card:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transform: scale(1.1);
}

.btn-close-card:active {
    transform: scale(0.95);
}

/* Hidden cards dropdown */
.hidden-cards-dropdown {
    background: white;
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden-cards-dropdown label {
    color: #6c757d;
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hidden-cards-dropdown label i {
    color: #667eea;
}

.hidden-cards-dropdown select {
    flex: 1;
    max-width: 300px;
    border-radius: 20px;
    border: 2px solid #e9ecef;
    padding: 6px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.hidden-cards-dropdown select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.hidden-cards-dropdown select:hover {
    border-color: #667eea;
}

/* Hidden card state */
.status-card.card-hidden {
    display: none !important;
}

.sortable-placeholder {
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
    border-radius: 15px;
    margin-bottom: 20px;
    min-height: 80px;
}

/* RC Sliders styles */
.rc-sliders-section {
    padding: 10px;
}

.rc-sliders-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
}

.rc-sliders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.rc-sliders-header h6 {
    margin: 0;
    color: #667eea;
    font-weight: 600;
}

.rc-sliders-status {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 15px;
    background: #e9ecef;
    color: #6c757d;
}

.rc-sliders-status.connected {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.2) 0%, rgba(25, 135, 84, 0.3) 100%);
    color: #198754;
}

.rc-sliders-status.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.2) 0%, rgba(220, 53, 69, 0.3) 100%);
    color: #dc3545;
}

.rc-status-message {
    font-size: 0.85rem;
    padding: 4px 12px;
    margin-left: 10px;
    border-radius: 15px;
    transition: opacity 0.3s ease;
}

.rc-status-message:empty {
    display: none;
}

.rc-status-message.text-success {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.2) 0%, rgba(25, 135, 84, 0.3) 100%);
    color: #198754;
}

.rc-status-message.text-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.2) 0%, rgba(220, 53, 69, 0.3) 100%);
    color: #dc3545;
}

.rc-sliders-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.rc-slider-item {
    background: white;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

.rc-slider-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.rc-slider-item.roll {
    border-left: 4px solid #667eea;
}

.rc-slider-item.pitch {
    border-left: 4px solid #764ba2;
}

.rc-slider-item.throttle {
    border-left: 4px solid #198754;
}

.rc-slider-item.yaw {
    border-left: 4px solid #fd7e14;
}

.rc-slider-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.rc-slider-item .ch-name {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.rc-slider-item .ch-value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #667eea;
    font-size: 1rem;
    min-width: 50px;
    text-align: right;
}

.rc-slider-item .btn-limits {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s ease;
}

.rc-slider-item .btn-limits:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-row .limit-label {
    font-size: 0.7rem;
    color: #6c757d;
    min-width: 35px;
    text-align: center;
}

.slider-row input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, #e9ecef 0%, #dee2e6 100%);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s ease;
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-row input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.slider-row input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

/* RC Slider Locking States */
.rc-slider-item.locked-by-other {
    opacity: 0.6;
    position: relative;
    pointer-events: none;
}

.rc-slider-item.locked-by-other::before {
    content: '\f023';  /* Font Awesome lock icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    color: #dc3545;
    font-size: 0.9rem;
    z-index: 10;
}

.rc-slider-item.locked-by-other::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(220, 53, 69, 0.05);
    border-radius: 10px;
    pointer-events: none;
}

.rc-slider-item.locked-by-me {
    box-shadow: 0 0 0 2px #198754, 0 4px 12px rgba(25, 135, 84, 0.3);
    position: relative;
}

.rc-slider-item.locked-by-me::before {
    content: '\f3c1';  /* Font Awesome broadcast icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    color: #198754;
    font-size: 0.9rem;
    z-index: 10;
    animation: pulse-broadcast 1s ease-in-out infinite;
}

@keyframes pulse-broadcast {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

.rc-slider-item.locked-by-other input[type="range"] {
    cursor: not-allowed;
}

.rc-slider-item.locked-by-other .ch-value {
    color: #6c757d;
}

/* RC Slider Joystick Lock State */
.rc-slider-item.locked-by-joystick {
    opacity: 0.85;
    position: relative;
    pointer-events: none;
    box-shadow: 0 0 0 2px #6f42c1, 0 4px 12px rgba(111, 66, 193, 0.3);
}

.rc-slider-item.locked-by-joystick::before {
    content: '\f11b';  /* Font Awesome gamepad icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    color: #6f42c1;
    font-size: 0.9rem;
    z-index: 10;
    animation: pulse-joystick 1.5s ease-in-out infinite;
}

.rc-slider-item.locked-by-joystick::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(111, 66, 193, 0.05);
    border-radius: 10px;
    pointer-events: none;
}

.rc-slider-item.locked-by-joystick input[type="range"] {
    cursor: not-allowed;
}

.rc-slider-item.locked-by-joystick .ch-value {
    color: #6f42c1;
    font-weight: 600;
}

@keyframes pulse-joystick {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.15); }
}

/* Active remote control indicator - пульсація значення коли locked-by-other канал активно змінюється */
.rc-slider-item.locked-by-other.rc-active-remote .ch-value {
    color: #dc3545;
    font-weight: 700;
    animation: pulse-remote-value 0.6s ease-in-out infinite;
}

@keyframes pulse-remote-value {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* RC Slider External Override State - зовнішнє джерело керування (MAVProxy CLI, QGC тощо) */
.rc-slider-item.locked-by-external {
    opacity: 0.7;
    position: relative;
    pointer-events: none;
    box-shadow: 0 0 0 2px #dc3545, 0 4px 12px rgba(220, 53, 69, 0.3);
}

.rc-slider-item.locked-by-external::before {
    content: '\f0e7';  /* Font Awesome bolt icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    color: #dc3545;
    font-size: 14px;
    z-index: 10;
    animation: pulse-external 1.5s ease-in-out infinite;
}

.rc-slider-item.locked-by-external::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(220, 53, 69, 0.05);
    border-radius: 10px;
    pointer-events: none;
}

.rc-slider-item.locked-by-external input[type="range"] {
    cursor: not-allowed;
}

.rc-slider-item.locked-by-external .ch-value {
    color: #dc3545;
    font-weight: 600;
}

@keyframes pulse-external {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.15); }
}

/* Responsive adjustments for RC sliders */
@media (max-width: 1200px) {
    .rc-sliders-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .rc-sliders-grid {
        grid-template-columns: 1fr;
    }

    .rc-sliders-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Limits Dialog */
.limits-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    backdrop-filter: blur(4px);
}

.limits-dialog {
    background: white;
    border-radius: 15px;
    padding: 25px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    animation: dialogSlideIn 0.2s ease-out;
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.limits-dialog h5 {
    margin: 0 0 20px 0;
    color: #667eea;
    font-weight: 600;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.limits-form {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.limit-input-group {
    flex: 1;
}

.limit-input-group label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.limit-input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-align: center;
    transition: border-color 0.2s ease;
}

.limit-input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.limits-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
}

.limits-presets .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.limits-presets .btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
    transform: translateY(-1px);
}

.limits-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.limits-actions .btn {
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: 600;
}

.limits-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.limits-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.limits-actions .btn-secondary {
    background: #6c757d;
    border: none;
}

.limits-actions .btn-secondary:hover {
    background: #5a6268;
}

/* ==================== GPIO Pinout CSS Grid ==================== */

.gpio-pinout-css {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
}

.gpio-header {
    font-weight: 700;
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 12px;
}

.gpio-grid {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    grid-template-rows: auto auto;
    gap: 3px;
    row-gap: 28px;  /* More space between rows for pin numbers */
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 0;
}

/* Base pin styling */
.gpio-pin {
    position: relative;
    border-radius: 4px;
    padding: 4px 2px;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
    cursor: default;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gpio-pin:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gpio-pin .pin-label {
    text-align: center;
    line-height: 1.1;
    font-size: 0.55rem;
}

.gpio-pin .pin-num {
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    font-weight: 700;
    color: #666;
    background: white;
    padding: 3px 6px;
    border-radius: 3px;
}

/* Pin type colors */
.gpio-pin.pin-3v3 { background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%); }
.gpio-pin.pin-5v { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }
.gpio-pin.pin-gnd { background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%); }
.gpio-pin.pin-gpio { background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); }
.gpio-pin.pin-i2c { background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%); }
.gpio-pin.pin-spi { background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); }
.gpio-pin.pin-uart { background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%); }
.gpio-pin.pin-pwm { background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%); }
.gpio-pin.pin-id { background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%); }

/* Non-mappable pins - smaller and less prominent */
.gpio-pin:not(.mappable) {
    transform: scale(0.85);
    opacity: 0.7;
}

.gpio-pin:not(.mappable):hover {
    transform: scale(0.9);
    opacity: 0.85;
}

/* Mappable pins indicator - full size and prominent */
.gpio-pin.mappable {
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Highlight overlay - hidden by default */
.gpio-pin .highlight-overlay {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* UART pins active state */
.gpio-pin.pin-uart.active {
    transform: scale(1.1);
    z-index: 6;
}

.gpio-pin.pin-uart.active .highlight-overlay {
    opacity: 1;
    border: 3px solid #1abc9c;
    box-shadow: 0 0 12px rgba(26, 188, 156, 0.8);
    animation: pin-pulse 1.5s ease-in-out infinite;
}

@keyframes pin-pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(26, 188, 156, 0.5); }
    50% { box-shadow: 0 0 15px rgba(26, 188, 156, 0.9); }
}

/* GPIO Mapped states - full size and prominent */
.gpio-pin.mapped-active {
    transform: scale(1.05);
    z-index: 5;
}

.gpio-pin.mapped-active .highlight-overlay {
    opacity: 1;
    border: 3px solid #667eea;
    background: rgba(102, 126, 234, 0.2);
    animation: gpio-neutral-pulse 2s ease-in-out infinite;
}

@keyframes gpio-neutral-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 0 12px rgba(102, 126, 234, 0.8); }
}

.gpio-pin.triggered-high {
    transform: scale(1.1);
    z-index: 6;
}

.gpio-pin.triggered-high .highlight-overlay {
    opacity: 1;
    border: 3px solid #198754;
    background: rgba(25, 135, 84, 0.25);
    animation: gpio-high-pulse 1s ease-in-out infinite;
}

@keyframes gpio-high-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(25, 135, 84, 0.5); }
    50% { box-shadow: 0 0 18px rgba(25, 135, 84, 1); }
}

.gpio-pin.triggered-low {
    transform: scale(1.1);
    z-index: 6;
}

.gpio-pin.triggered-low .highlight-overlay {
    opacity: 1;
    border: 3px solid #dc3545;
    background: rgba(220, 53, 69, 0.25);
    animation: gpio-low-pulse 1s ease-in-out infinite;
}

@keyframes gpio-low-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(220, 53, 69, 0.5); }
    50% { box-shadow: 0 0 18px rgba(220, 53, 69, 1); }
}

/* GPIO State Badge */
.gpio-state {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 3px;
    background: #6c757d;
    color: white;
    z-index: 10;
    white-space: nowrap;
    text-transform: uppercase;
    min-width: 20px;
    text-align: center;
}

.gpio-state.state-high {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    box-shadow: 0 0 4px rgba(25, 135, 84, 0.6);
}

.gpio-state.state-low {
    background: linear-gradient(135deg, #dc3545 0%, #bb2d3b 100%);
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.6);
}

.gpio-state.state-unknown {
    background: #6c757d;
}

/* Legend */
.gpio-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #495057;
}

.legend-color {
    width: 14px;
    height: 10px;
    border-radius: 2px;
}

/* UART note */
.gpio-uart-note {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #1abc9c;
    font-weight: 600;
}

/* Active pins status badges */
.active-pins-status {
    text-align: center;
}

.active-pins-status .badge {
    font-size: 0.8rem;
    padding: 6px 12px;
}

.active-pins-status .badge.bg-uart-active {
    background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%) !important;
    animation: badge-glow 2s ease-in-out infinite;
}

@keyframes badge-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(26, 188, 156, 0.3); }
    50% { box-shadow: 0 0 15px rgba(26, 188, 156, 0.6); }
}

/* Board info styling */
#board-model-title {
    font-weight: 600;
}

[data-card-id="board-gpio"] .card-body p {
    font-size: 0.9rem;
    color: #495057;
}

[data-card-id="board-gpio"] .card-body p strong {
    color: #2c3e50;
}

/* Responsive adjustments for GPIO card */
@media (max-width: 768px) {
    .gpio-pinout-css {
        padding: 10px;
        overflow-x: auto;
    }

    .gpio-grid {
        min-width: 600px;
    }

    .gpio-pin {
        min-height: 40px;
        font-size: 0.5rem;
    }

    .gpio-pin .pin-label {
        font-size: 0.45rem;
    }

    [data-card-id="board-gpio"] .row .col-md-4 {
        margin-bottom: 5px;
    }
}

/* ==================== GPIO Mapping Dialog ==================== */

.gpio-mapping-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1060;
    backdrop-filter: blur(4px);
}

.gpio-mapping-dialog {
    background: white;
    border-radius: 16px;
    min-width: 380px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: dialogSlideIn 0.25s ease-out;
    overflow: hidden;
}

.gpio-mapping-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gpio-mapping-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.gpio-mapping-header h5 i {
    margin-right: 10px;
}

.btn-close-dialog {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.btn-close-dialog:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.gpio-mapping-body {
    padding: 20px;
}

.gpio-current-value {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gpio-current-value .label {
    color: #6c757d;
    font-size: 0.9rem;
}

.gpio-current-value .value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.3rem;
    color: #667eea;
}

.gpio-form-group {
    margin-bottom: 18px;
}

.gpio-form-group > label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.gpio-form-group > label i {
    margin-right: 6px;
    color: #667eea;
}

.gpio-form-group .form-control {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 10px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gpio-form-group .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    outline: none;
}

/* Custom GPIO Pin Select with Colors */
.gpio-custom-select {
    position: relative;
    width: 100%;
}

.gpio-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gpio-select-trigger:hover {
    border-color: #667eea;
}

.gpio-custom-select.open .gpio-select-trigger {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.gpio-select-trigger i {
    color: #6c757d;
    transition: transform 0.2s ease;
}

.gpio-custom-select.open .gpio-select-trigger i {
    transform: rotate(180deg);
}

.gpio-select-value {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #495057;
}

.gpio-select-value .option-color {
    flex-shrink: 0;
}

.gpio-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gpio-custom-select.open .gpio-select-options {
    display: block;
}

.gpio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.gpio-option:hover {
    background-color: #f8f9fa;
}

.gpio-option.selected {
    background-color: rgba(102, 126, 234, 0.1);
}

.gpio-option:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Color indicators for options */
.option-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.option-color.pin-gpio {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.option-color.pin-pwm {
    background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%);
}

.option-color.pin-i2c {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.option-color.pin-spi {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.option-color.pin-uart {
    background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
}

.option-text {
    color: #495057;
    font-size: 0.95rem;
}

.gpio-threshold-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gpio-threshold-row .threshold-label {
    font-size: 0.9rem;
    color: #6c757d;
    min-width: 50px;
}

.gpio-threshold-row .gpio-operator {
    width: auto;
    min-width: 140px;
}

.gpio-threshold-row .gpio-threshold {
    width: 100px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.gpio-output-row {
    display: flex;
    gap: 12px;
}

.gpio-output-option {
    flex: 1;
}

.gpio-output-option input[type="radio"] {
    display: none;
}

.gpio-output-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.gpio-output-label i {
    font-size: 1.1rem;
}

.gpio-output-label.high {
    color: #198754;
}

.gpio-output-label.low {
    color: #dc3545;
}

.gpio-output-option input[type="radio"]:checked + .gpio-output-label.high {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.1) 0%, rgba(32, 201, 151, 0.1) 100%);
    border-color: #198754;
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.15);
}

.gpio-output-option input[type="radio"]:checked + .gpio-output-label.low {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(200, 35, 51, 0.1) 100%);
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.gpio-output-label:hover {
    border-color: #667eea;
}

.gpio-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 15px;
}

.gpio-presets .presets-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-right: 4px;
}

.gpio-presets .btn {
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 15px;
}

.gpio-presets .btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* Condition group styling */
.gpio-condition-group {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
}

.gpio-condition-group > label {
    margin-bottom: 12px;
}

.gpio-condition-group > label i.fa-arrow-up {
    color: #198754;
}

.gpio-condition-group > label i.fa-arrow-down {
    color: #dc3545;
}

.gpio-condition-group .gpio-presets {
    margin-bottom: 0;
}

.gpio-condition-group .preset-high {
    border-color: #198754;
    color: #198754;
}

.gpio-condition-group .preset-high:hover {
    background: #198754;
    border-color: #198754;
    color: white;
}

.gpio-condition-group .preset-low {
    border-color: #dc3545;
    color: #dc3545;
}

.gpio-condition-group .preset-low:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

/* Condition info box */
.gpio-condition-info {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.gpio-condition-info i {
    color: #667eea;
    font-size: 1rem;
}

.gpio-mapping-status {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gpio-mapping-status i {
    color: #667eea;
}

.gpio-mapping-status.success {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.1) 0%, rgba(32, 201, 151, 0.1) 100%);
    color: #198754;
}

.gpio-mapping-status.success i {
    color: #198754;
}

.gpio-mapping-status.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(200, 35, 51, 0.1) 100%);
    color: #dc3545;
}

.gpio-mapping-status.error i {
    color: #dc3545;
}

.gpio-mapping-actions {
    background: #f8f9fa;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e9ecef;
}

.gpio-actions-right {
    display: flex;
    gap: 10px;
}

.gpio-mapping-actions .btn {
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
}

.gpio-mapping-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.gpio-mapping-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.gpio-mapping-actions .btn-outline-danger {
    border-width: 2px;
}

.gpio-mapping-actions .btn-outline-danger:hover {
    background: #dc3545;
    color: white;
}

/* Responsive adjustments for GPIO mapping dialog */
@media (max-width: 480px) {
    .gpio-mapping-dialog {
        min-width: unset;
        margin: 10px;
    }

    .gpio-threshold-row {
        flex-wrap: wrap;
    }

    .gpio-threshold-row .threshold-label {
        width: 100%;
        margin-bottom: 5px;
    }

    .gpio-output-row {
        flex-direction: column;
    }
}

/* UDP List Items */
.udp-item {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.udp-item .form-control {
    flex: 1;
}

.udp-item .btn {
    flex-shrink: 0;
}

/* ==================== Board Info Enhanced ==================== */

.board-info-enhanced {
    padding: 5px 0 10px 0;
}

/* Board Photo Container */
.board-photo-container {
    text-align: center;
    padding: 10px;
}

.board-photo {
    max-width: 100%;
    width: 180px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #f8f9fa;
}

.board-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.board-photo-label {
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #667eea;
}

/* Board Specs Grid */
.board-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.spec-item:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-1px);
}

.spec-item-full {
    grid-column: span 2;
}

.spec-label {
    font-size: 0.8rem;
    color: #6c757d;
    white-space: nowrap;
    min-width: fit-content;
}

.spec-label i {
    margin-right: 5px;
    color: #667eea;
    width: 16px;
    text-align: center;
}

.spec-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
    word-break: break-word;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .board-info-enhanced .row {
        flex-direction: column;
    }

    .board-photo-container {
        margin-bottom: 15px;
    }

    .board-specs-grid {
        grid-template-columns: 1fr;
    }

    .spec-item-full {
        grid-column: span 1;
    }

    .spec-item {
        padding: 6px 10px;
    }
}

/* ==================== Pin Description Tooltip ==================== */

.gpio-pin-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 10px;
    padding: 12px 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    min-width: 180px;
    max-width: 260px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    text-align: left;
}

.gpio-pin-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: white;
}

.gpio-pin:hover .gpio-pin-tooltip {
    opacity: 1;
    visibility: visible;
}

.tooltip-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 2px solid #f0f0f0;
}

.tooltip-function {
    font-size: 0.8rem;
    color: #495057;
    margin-bottom: 4px;
}

.tooltip-voltage {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 6px;
}

.tooltip-more {
    font-size: 0.7rem;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tooltip-more i {
    font-size: 0.65rem;
}

/* Tooltip position adjustments for edge pins */
.gpio-pin[data-pin="1"] .gpio-pin-tooltip,
.gpio-pin[data-pin="2"] .gpio-pin-tooltip {
    left: 0;
    transform: translateX(0);
}

.gpio-pin[data-pin="1"] .gpio-pin-tooltip::after,
.gpio-pin[data-pin="2"] .gpio-pin-tooltip::after {
    left: 20px;
    transform: translateX(0);
}

.gpio-pin[data-pin="39"] .gpio-pin-tooltip,
.gpio-pin[data-pin="40"] .gpio-pin-tooltip {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.gpio-pin[data-pin="39"] .gpio-pin-tooltip::after,
.gpio-pin[data-pin="40"] .gpio-pin-tooltip::after {
    left: auto;
    right: 20px;
    transform: translateX(0);
}

/* ==================== Pin Details Modal ==================== */

.pin-details-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1070;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pin-details-dialog {
    background: white;
    border-radius: 16px;
    min-width: 380px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: dialogSlideIn 0.25s ease-out;
}

.pin-details-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.pin-details-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-dialog {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-dialog:hover {
    background: rgba(255, 255, 255, 0.3);
}

.pin-details-body {
    padding: 20px;
}

.pin-detail-section {
    margin-bottom: 18px;
}

.pin-detail-section:last-child {
    margin-bottom: 0;
}

.pin-detail-section h6 {
    color: #667eea;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pin-detail-section h6 i {
    width: 16px;
    text-align: center;
}

.pin-detail-content {
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.5;
}

.pin-detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pin-detail-list li {
    padding: 4px 0;
    padding-left: 18px;
    position: relative;
    font-size: 0.85rem;
    color: #495057;
}

.pin-detail-list li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.pin-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(253, 126, 20, 0.1) 100%);
    border-left: 3px solid #ffc107;
    padding: 12px 15px;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    color: #856404;
    margin-top: 15px;
}

.pin-warning i {
    margin-right: 6px;
    color: #e0a800;
}

/* Pin type badge in modal */
.pin-type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pin-type-badge.power { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); color: white; }
.pin-type-badge.ground { background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%); color: white; }
.pin-type-badge.gpio { background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); color: white; }
.pin-type-badge.i2c { background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%); color: white; }
.pin-type-badge.spi { background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); color: white; }
.pin-type-badge.uart { background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%); color: white; }
.pin-type-badge.pwm { background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%); color: white; }
.pin-type-badge.id { background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%); color: white; }

/* Make GPIO pins clickable for details */
.gpio-pin[data-pin] {
    cursor: pointer;
}

/* Mobile responsive for modal */
@media (max-width: 480px) {
    .pin-details-dialog {
        min-width: 95%;
        max-width: 95%;
        margin: 10px;
    }

    .pin-details-header {
        padding: 14px 16px;
    }

    .pin-details-body {
        padding: 15px;
    }

    .pin-detail-section h6 {
        font-size: 0.85rem;
    }

    .pin-detail-content {
        font-size: 0.85rem;
    }
}

/* ==================== Compass Header & Calibration Button ==================== */

.compass-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.compass-header-title {
    white-space: nowrap;
}

.btn-compass-cal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-compass-cal:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
    color: white;
}

/* ==================== Compass Enable/Disable Switches ==================== */

.compass-use-switches {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.compass-use-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #495057;
    user-select: none;
    margin: 0;
}

.compass-use-checkbox {
    display: none;
}

.compass-use-slider {
    width: 32px;
    height: 18px;
    background: #ccc;
    border-radius: 9px;
    position: relative;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.compass-use-slider::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.compass-use-checkbox:checked + .compass-use-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.compass-use-checkbox:checked + .compass-use-slider::after {
    transform: translateX(14px);
}

.compass-use-checkbox:disabled + .compass-use-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.compass-use-label:has(.compass-use-checkbox:disabled) {
    cursor: not-allowed;
    opacity: 0.6;
}

.compass-use-text {
    font-weight: 500;
}

.compass-tilt-label {
    margin-left: 8px;
    font-size: 0.75rem;
}

/* ==================== Compass Calibration Wizard ==================== */

.compass-cal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1080;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.compass-cal-wizard {
    background: white;
    border-radius: 16px;
    min-width: 380px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: dialogSlideIn 0.25s ease-out;
    overflow: hidden;
}

.compass-cal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compass-cal-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.compass-cal-header h5 i {
    margin-right: 10px;
}

.compass-cal-body {
    padding: 20px;
}

.compass-cal-info {
    display: flex;
    gap: 15px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.compass-cal-info > i {
    color: #667eea;
    font-size: 1.3rem;
    margin-top: 3px;
    flex-shrink: 0;
}

.compass-cal-info p {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: #495057;
}

.compass-cal-info ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.85rem;
    color: #6c757d;
}

.compass-cal-info ul li {
    margin-bottom: 4px;
}

.compass-cal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.compass-cal-actions .btn {
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
}

.compass-cal-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.compass-cal-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Progress section */
.compass-cal-progress-section {
    padding: 20px 0;
}

.compass-cal-progress-label {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

.compass-cal-progress-bar {
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
}

.compass-cal-progress-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.compass-cal-direction {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    color: #6c757d;
    font-size: 0.9rem;
}

.compass-cal-direction i {
    color: #667eea;
    margin-right: 8px;
}

/* Result section */
.compass-cal-result {
    text-align: center;
    padding: 25px 15px;
}

.compass-cal-result i {
    font-size: 3rem;
    margin-bottom: 15px;
}

.compass-cal-result h6 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.compass-cal-result p {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 5px;
}

.compass-cal-result.success i {
    color: #198754;
}

.compass-cal-result.success h6 {
    color: #198754;
}

.compass-cal-result.failure i {
    color: #dc3545;
}

.compass-cal-result.failure h6 {
    color: #dc3545;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .compass-cal-wizard {
        min-width: 95%;
        max-width: 95%;
        margin: 10px;
    }

    .compass-cal-actions {
        flex-direction: column;
    }

    .compass-cal-actions .btn {
        width: 100%;
    }

    .compass-header {
        flex-wrap: wrap;
    }

    .compass-use-switches {
        flex-direction: column;
        gap: 6px;
    }
}

/* ==================== UART Management Panel ==================== */

.uart-management-panel {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
    border: 1px solid #dee2e6;
}

.uart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1abc9c;
}

.uart-header h6 {
    margin: 0;
    color: #1abc9c;
    font-weight: 600;
    font-size: 1rem;
}

.uart-header h6 i {
    margin-right: 8px;
}

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

.uart-loading {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

.uart-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.uart-item {
    background: white;
    border-radius: 10px;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 15px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.uart-item.enabled {
    border-color: #1abc9c;
    background: linear-gradient(135deg, rgba(26, 188, 156, 0.05) 0%, white 100%);
}

.uart-item.in-use {
    border-color: #f39c12;
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.05) 0%, white 100%);
}

.uart-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.uart-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.uart-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.uart-device {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    color: #1abc9c;
    font-weight: 500;
}

.uart-pins {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.uart-pin-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-family: monospace;
    min-height: 24px;
}

.uart-pin-badge.tx {
    background: rgba(52, 152, 219, 0.15);
    color: #2980b9;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.uart-pin-badge.rx {
    background: rgba(155, 89, 182, 0.15);
    color: #8e44ad;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.uart-physical-pins {
    font-size: 0.7rem;
    color: #888;
}

.uart-description {
    font-size: 0.75rem;
    color: #6c757d;
    font-style: italic;
}

.uart-status .badge {
    font-size: 0.75rem;
    padding: 5px 10px;
}

.uart-status .badge i {
    margin-right: 4px;
}

.uart-actions button {
    min-width: 36px;
}

.uart-actions .text-muted {
    font-size: 1.1rem;
}

.uart-note {
    margin-top: 15px;
    padding: 10px 14px;
    background: rgba(255, 193, 7, 0.12);
    border-radius: 8px;
    font-size: 0.8rem;
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.25);
}

.uart-note i {
    margin-right: 6px;
    color: #d39e00;
}

/* ==================== GPIO Pin UART Highlighting ==================== */

/* Potential UART pins (disabled) - dashed blue border */
.gpio-pin.uart-potential {
    position: relative;
}

.gpio-pin.uart-potential::before {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    bottom: -3px;
    left: -3px;
    border: 2px dashed #3498db;
    border-radius: inherit;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

/* Enabled UART pins - solid green border with glow */
.gpio-pin.uart-enabled {
    position: relative;
}

.gpio-pin.uart-enabled::before {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    bottom: -3px;
    left: -3px;
    border: 3px solid #1abc9c;
    border-radius: inherit;
    box-shadow: 0 0 10px rgba(26, 188, 156, 0.5);
    animation: uart-glow 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

/* In-use UART pins - orange border with pulse */
.gpio-pin.uart-in-use {
    position: relative;
}

.gpio-pin.uart-in-use::before {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    bottom: -3px;
    left: -3px;
    border: 3px solid #f39c12;
    border-radius: inherit;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
    animation: uart-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes uart-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(26, 188, 156, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(26, 188, 156, 0.7);
    }
}

@keyframes uart-pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(243, 156, 18, 0.3);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 12px rgba(243, 156, 18, 0.6);
        opacity: 0.8;
    }
}

/* ==================== UART Responsive Styles ==================== */

@media (max-width: 768px) {
    .uart-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .uart-status,
    .uart-actions {
        justify-self: start;
    }

    .uart-pins {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .uart-management-panel {
        padding: 12px;
    }

    .uart-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .uart-name {
        font-size: 0.95rem;
    }

    .uart-device {
        font-size: 0.8rem;
    }
}

/* ==================== MAVProxy Config Dialog ==================== */

.mavproxy-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    animation: mavproxyOverlayIn 0.15s ease-out;
}

@keyframes mavproxyOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mavproxy-dialog {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: mavproxySlideIn 0.2s ease-out;
    overflow: hidden;
}

@keyframes mavproxySlideIn {
    from {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.mavproxy-dialog-header {
    padding: 18px 20px 12px;
    border-bottom: 2px solid #f39c12;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mavproxy-dialog-header h6 {
    margin: 0;
    color: #f39c12;
    font-weight: 600;
    font-size: 1.05rem;
}

.mavproxy-dialog-header h6 i {
    margin-right: 8px;
}

.mavproxy-dialog-device {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #6c757d;
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
}

.mavproxy-dialog-body {
    padding: 18px 20px;
}

.mavproxy-form-group {
    margin-bottom: 14px;
}

.mavproxy-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.mavproxy-form-row {
    display: flex;
    gap: 12px;
}

.mavproxy-udp-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    align-items: center;
}

.mavproxy-udp-row .form-control {
    flex: 1;
}

.mavproxy-udp-row .btn {
    flex-shrink: 0;
    padding: 2px 8px;
}

.mavproxy-dialog-footer {
    padding: 12px 20px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #e9ecef;
}

/* MAVProxy button styles in UART list */
.uart-mavproxy-start-btn {
    border-color: #f39c12 !important;
    color: #f39c12 !important;
}

.uart-mavproxy-start-btn:hover {
    background: #f39c12 !important;
    color: white !important;
}

.uart-mavproxy-stop-btn {
    border-color: #e74c3c !important;
    color: #e74c3c !important;
}

.uart-mavproxy-stop-btn:hover {
    background: #e74c3c !important;
    color: white !important;
}

@media (max-width: 576px) {
    .mavproxy-dialog {
        width: 95%;
        max-width: none;
    }

    .mavproxy-form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ==================== UART Console Panel ==================== */

.uart-item.console-open {
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}

.uart-console-panel {
    background: #1a1a2e;
    border-radius: 0 0 10px 10px;
    margin-bottom: 8px;
    border: 2px solid #16213e;
    border-top: 1px solid #0f3460;
    overflow: hidden;
    animation: consoleSlideDown 0.2s ease-out;
}

@keyframes consoleSlideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 350px; }
}

.uart-console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #16213e;
    color: #a8b2d1;
    font-size: 0.78rem;
    font-family: 'Courier New', monospace;
}

.uart-console-header .btn {
    padding: 2px 6px;
    font-size: 0.7rem;
    color: #a8b2d1;
    border-color: #a8b2d1;
}

.uart-console-header .btn:hover {
    color: #ff6b6b;
    border-color: #ff6b6b;
}

.uart-console-output {
    background: #0f0f23;
    color: #cccccc;
    padding: 10px 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    max-height: 250px;
    min-height: 60px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.4;
}

.uart-console-output .console-error {
    color: #ff6b6b;
}

.uart-console-output .console-warning {
    color: #ffd93d;
}

.uart-console-output .console-heartbeat {
    color: #6bcb77;
}

.uart-console-output .console-arm {
    color: #4d96ff;
    font-weight: bold;
}

.uart-console-output .console-waiting {
    color: #666;
    font-style: italic;
}

/* Console toggle button active state */
.uart-console-toggle-btn.active {
    background-color: #0dcaf0 !important;
    color: white !important;
    border-color: #0dcaf0 !important;
}

/* Scrollbar for console */
.uart-console-output::-webkit-scrollbar {
    width: 6px;
}

.uart-console-output::-webkit-scrollbar-track {
    background: #0f0f23;
}

.uart-console-output::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.uart-console-output::-webkit-scrollbar-thumb:hover {
    background: #555;
}

@media (max-width: 768px) {
    .uart-console-output {
        max-height: 200px;
        font-size: 0.72rem;
    }
}

/* ==================== TCM Radar Widget ==================== */

.radar-summary {
    background: rgba(102, 126, 234, 0.06);
    border-radius: 8px;
    padding: 10px 15px;
    border-left: 3px solid #667eea;
}

.radar-section h6 {
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.radar-section h6 i {
    margin-right: 4px;
}

.radar-table-scroll {
    max-height: 300px;
    overflow-y: auto;
}

.radar-table-scroll table th,
.radar-table-scroll table td {
    font-size: 0.8rem;
    white-space: nowrap;
    padding: 4px 8px;
}

#radar-lanes-container .lane-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    margin: 2px;
    font-size: 0.8rem;
    font-weight: 500;
}

.lane-badge.smooth {
    background: #d4edda;
    color: #155724;
}

.lane-badge.congested {
    background: #f8d7da;
    color: #721c24;
}

/* --- Point Cloud Analysis --- */
.cloud-analysis-layout {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

#radar-cloud-canvas {
    border-radius: 6px;
    border: 1px solid #2a2a3e;
    flex-shrink: 0;
}

.cloud-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

#radar-cloud-objects {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 250px;
    overflow-y: auto;
}

.cloud-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-top: 1px solid #dee2e6;
    margin-top: 4px;
}

.cloud-log {
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    background: #0d1117;
    color: #e6edf3;
    border-radius: 6px;
    padding: 6px 8px;
}

.cloud-log-filters {
    display: flex;
    gap: 4px;
    padding: 4px 0 6px;
    flex-wrap: wrap;
}
.cloud-log-filter-btn {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #30363d;
    background: #161b22;
    color: #8b949e;
    cursor: pointer;
    transition: all 0.15s;
}
.cloud-log-filter-btn:hover {
    border-color: #58a6ff;
    color: #c9d1d9;
}
.cloud-log-filter-btn.active {
    background: #21262d;
    border-color: #58a6ff;
    color: #f0f6fc;
    font-weight: 600;
}
.cloud-log-filter-btn.filter-drone.active {
    background: rgba(231, 76, 60, 0.2);
    border-color: #e74c3c;
    color: #e74c3c;
}
.cloud-log-filter-btn.filter-person.active {
    background: rgba(46, 204, 113, 0.2);
    border-color: #2ecc71;
    color: #2ecc71;
}
.cloud-log-filter-btn.filter-vehicle.active {
    background: rgba(52, 152, 219, 0.2);
    border-color: #3498db;
    color: #3498db;
}
.cloud-log-filter-btn.filter-noise.active {
    background: rgba(139, 149, 158, 0.15);
    border-color: #6e7681;
    color: #8b949e;
}
.cloud-log-filter-btn.filter-unknown.active {
    background: rgba(243, 156, 18, 0.2);
    border-color: #f39c12;
    color: #f39c12;
}

.cloud-log-entry {
    padding: 5px 8px;
    margin-bottom: 3px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
    line-height: 1.5;
}

.cloud-log-entry .cloud-log-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.cloud-log-entry .cloud-log-pts {
    font-size: 0.75rem;
    color: #c9d1d9;
    margin-left: auto;
}

.cloud-log-entry .classify-badge {
    font-size: 0.72rem;
    padding: 2px 6px;
    vertical-align: middle;
}

.cloud-log-entry .cloud-object-table {
    font-size: 0.75rem;
}

.cloud-log-entry .cloud-object-table td {
    color: #e6edf3;
    padding: 2px 6px;
}

.cloud-log-entry .cloud-object-table td:first-child {
    color: #79c0ff;
    font-weight: 700;
}

.cloud-log-entry .cloud-object-table td:nth-child(2) {
    color: #f0f6fc;
    font-weight: 600;
}

.cloud-log-entry .cloud-object-table td:nth-child(3) {
    color: #8b949e;
}

.cloud-log-entry .cloud-object-diag {
    border-top-color: rgba(255,255,255,0.15);
    color: #c9d1d9;
}

.cloud-log-time {
    color: #58a6ff;
    font-weight: 700;
    font-size: 0.78rem;
    margin-right: 6px;
}

.cloud-log-detail {
    color: #c9d1d9;
}

.cloud-range-slider {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cloud-range-slider .form-range {
    flex: 1;
    max-width: 300px;
}

.cloud-range-slider label {
    white-space: nowrap;
}

.cloud-object-card {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 8px 10px;
    border-left: 4px solid #667eea;
    font-size: 0.82rem;
}

.cloud-object-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.cloud-object-id {
    font-size: 0.75rem;
    color: #888;
    font-weight: 500;
}

.cloud-object-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cloud-object-stats span {
    font-size: 0.78rem;
    color: #444;
    white-space: nowrap;
}

.cloud-object-stats i {
    color: #667eea;
    margin-right: 2px;
    font-size: 0.7rem;
}

.cloud-object-table {
    width: 100%;
    font-size: 0.73rem;
    border-collapse: collapse;
    line-height: 1.3;
}

.cloud-object-table td {
    padding: 1px 4px;
    white-space: nowrap;
}

.cloud-object-table td:first-child {
    color: #667eea;
    font-weight: 600;
    width: 55px;
}

.cloud-object-table td:nth-child(2) {
    color: #333;
    font-weight: 500;
}

.cloud-object-table td:nth-child(3) {
    color: #999;
    font-size: 0.68rem;
}

.cloud-object-muted {
    opacity: 0.55;
    border-left-color: #aaa !important;
}

.cloud-object-diag {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 3px;
    padding-top: 3px;
    border-top: 1px dashed #ddd;
    font-size: 0.7rem;
    color: #999;
}

.cloud-object-diag .fa-xmark {
    color: #d63031;
    margin-right: 2px;
}

.cloud-object-diag .fa-check {
    color: #00b894;
    margin-right: 2px;
}

.diag-fail-drone i.fa-plane {
    color: #ffeaa7;
    margin-right: 4px;
}

.diag-fail-person i.fa-person {
    color: #636e72;
    margin-right: 4px;
}

/* Classification badges */
.classify-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.classify-badge i {
    margin-right: 3px;
}

.classify-badge.drone {
    background: #ffeaa7;
    color: #856404;
}

.classify-badge.person {
    background: #dfe6e9;
    color: #2d3436;
}

.classify-badge.vehicle {
    background: #dfe6fd;
    color: #2c3e7a;
}

.classify-badge.noise {
    background: #636e72;
    color: #dfe6e9;
}

.classify-badge.unknown {
    background: #e9ecef;
    color: #6c757d;
}

.cloud-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Detection tuning panels */
.detect-tuning {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 6px 10px;
    border: 1px solid #dee2e6;
}

.detect-tuning summary {
    cursor: pointer;
    color: #555;
    user-select: none;
}

.detect-tuning-panels {
    display: flex;
    gap: 16px;
}

.detect-panel {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.detect-panel-drone {
    border-left: 3px solid #ffeaa7;
}

.detect-panel-person {
    border-left: 3px solid #636e72;
}

.detect-panel-global {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    border-left: 3px solid #74b9ff;
}

.detect-panel-title {
    margin-bottom: 6px;
}

.detect-tuning-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.detect-tuning-row label {
    display: block;
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 1px;
    white-space: nowrap;
}

.detect-tuning-row label strong {
    color: #667eea;
}

.detect-tuning-row .form-range {
    height: 18px;
}

.detect-hint {
    display: block;
    font-size: 0.68rem;
    color: #888;
    line-height: 1.25;
    margin: 1px 0 2px 0;
    white-space: normal;
}

@media (max-width: 768px) {
    .radar-summary {
        padding: 8px 10px;
    }

    .radar-table-scroll {
        max-height: 200px;
    }

    .radar-table-scroll table th,
    .radar-table-scroll table td {
        font-size: 0.72rem;
        padding: 3px 5px;
    }

    .cloud-analysis-layout {
        flex-direction: column;
    }

    #radar-cloud-canvas {
        width: 100%;
        height: 300px;
    }

    .cloud-object-card {
        padding: 6px 8px;
    }

    .cloud-object-stats span {
        font-size: 0.72rem;
    }

    .detect-tuning-panels {
        flex-direction: column;
    }
}

/* ── Radar Settings Panel ── */
.radar-settings-group {
    padding: 0;
}

.radar-profile-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 10px;
    background: #fafafa;
}
.radar-profile-card.drone {
    border-left: 3px solid #e74c3c;
}
.radar-profile-card.person {
    border-left: 3px solid #3498db;
}
.radar-profile-header {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}
.radar-profile-card.drone .radar-profile-header {
    color: #e74c3c;
}
.radar-profile-card.person .radar-profile-header {
    color: #3498db;
}
.radar-profile-section {
    margin-bottom: 4px;
}
.radar-section-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    margin-bottom: 2px;
    border-bottom: 1px solid #eee;
    padding-bottom: 1px;
}
.radar-slider-row {
    margin-bottom: 1px;
}
.radar-slider-row label {
    display: block;
    font-size: 0.72rem;
    color: #555;
    margin-bottom: 0;
    line-height: 1.3;
}
.radar-slider-val {
    font-weight: 600;
    color: #333;
}
.radar-slider-label {
    display: block;
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 0;
}
.form-range-sm {
    height: 16px;
}
@media (max-width: 768px) {
    .radar-profile-card {
        margin-bottom: 6px;
    }
}

/* USB Device List */
.usb-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.usb-device-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}
.usb-device-item:last-child {
    border-bottom: none;
}
.usb-bus {
    color: #666;
    font-size: 0.8rem;
}
.usb-id {
    font-family: monospace;
    font-size: 0.8rem;
    color: #888;
}
.usb-devpath {
    font-size: 0.78rem;
    background: #f5f5f5;
    padding: 1px 5px;
    border-radius: 4px;
    color: #333;
}
.usb-input-name {
    font-size: 0.8rem;
    color: #555;
    font-style: italic;
}
.usb-type-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
}
.usb-badge-joystick { background: #cff4fc; color: #055160; }
.usb-badge-camera   { background: #cfe2ff; color: #084298; }
.usb-badge-audio    { background: #e8d5f5; color: #4a0e8f; }
.usb-badge-storage  { background: #fff3cd; color: #664d03; }
.usb-badge-serial   { background: #d1e7dd; color: #0a3622; }
.usb-badge-hid      { background: #fde8d8; color: #7d3012; }
.usb-badge-hub      { background: #e2e3e5; color: #383d41; }
.usb-badge-wireless { background: #d3f9d8; color: #1a4731; }

/* Clickable input device items */
.usb-device-clickable { cursor: pointer; transition: background .15s; }
.usb-device-clickable:hover { background: #f0f4ff; border-radius: 6px; }
.usb-config-hint { font-size: .75rem; color: #0d6efd; }
.usb-badge-keyboard { background: #fde8d8; color: #7d3012; }
.usb-badge-mouse    { background: #d4edda; color: #155724; }

/* Server mode: station rows */
.station-row { cursor: pointer; transition: background .15s; }
.station-row:hover { background: #f0f4ff !important; }

/* ========================================
   IRIS 3D Radar TTX Badge
   ======================================== */
.iris-ttx-card {
    border: 1px solid #2a2a3e;
    overflow: hidden;
}

.iris-ttx-header {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: #e0e0e0;
    padding: 12px 16px;
    border-bottom: 2px solid #00e676;
}

.iris-ttx-header h5 {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.iris-ttx-body {
    background: #1a1a2e;
    color: #c9d1d9;
    padding: 16px;
}

/* Capability badges row */
.iris-ttx-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.iris-ttx-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.iris-ttx-badge.badge-3d {
    background: rgba(0, 230, 118, 0.2);
    color: #00e676;
    border: 1px solid #00e676;
}

.iris-ttx-badge.badge-azimuth {
    background: rgba(41, 182, 246, 0.2);
    color: #29b6f6;
    border: 1px solid #29b6f6;
}

.iris-ttx-badge.badge-fmcw {
    background: rgba(171, 71, 188, 0.2);
    color: #ce93d8;
    border: 1px solid #ab47bc;
}

.iris-ttx-badge.badge-ip {
    background: rgba(255, 167, 38, 0.2);
    color: #ffa726;
    border: 1px solid #ffa726;
}

.iris-ttx-badge.badge-mil {
    background: rgba(239, 83, 80, 0.2);
    color: #ef5350;
    border: 1px solid #ef5350;
}

.iris-ttx-badge.badge-stanag {
    background: rgba(239, 83, 80, 0.15);
    color: #e57373;
    border: 1px solid #e57373;
}

.iris-ttx-badge.badge-iface {
    background: rgba(100, 181, 246, 0.15);
    color: #64b5f6;
    border: 1px solid #42a5f5;
}

/* Section */
.iris-ttx-section {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.iris-ttx-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.iris-ttx-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64b5f6;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}

.iris-ttx-section-title i {
    margin-right: 5px;
    opacity: 0.7;
}

/* Specs grid */
.iris-ttx-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 16px;
}

.iris-ttx-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
}

.iris-ttx-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.iris-ttx-label {
    font-size: 0.78rem;
    color: #8b949e;
    white-space: nowrap;
    margin-right: 8px;
}

.iris-ttx-value {
    font-size: 0.78rem;
    color: #e6edf3;
    font-weight: 600;
    text-align: right;
    font-family: 'Courier New', monospace;
}

.iris-ttx-value.iris-ttx-highlight {
    color: #00e676;
}

.iris-ttx-value.iris-ttx-warn {
    color: #ef5350;
}

/* Detection/Classification range table */
.iris-ttx-range-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.iris-ttx-range-table th {
    color: #8b949e;
    font-weight: 600;
    text-align: center;
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iris-ttx-range-table th:first-child {
    text-align: left;
}

.iris-ttx-range-table td {
    padding: 6px 8px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.iris-ttx-range-table td:first-child {
    text-align: left;
    color: #c9d1d9;
}

.iris-ttx-range-table td:first-child i {
    margin-right: 4px;
    opacity: 0.6;
}

td.iris-range-detect {
    color: #ffa726;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

td.iris-range-class {
    color: #00e676;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* Responsive */
@media (max-width: 576px) {
    .iris-ttx-grid {
        grid-template-columns: 1fr;
    }
    .iris-ttx-badges {
        gap: 4px;
    }
    .iris-ttx-badge {
        font-size: 0.65rem;
        padding: 2px 7px;
    }
}
