/* GPS Tracking System - Main CSS */
/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196f3;
    --secondary-color: #4caf50;
    --accent-color: #ff9800;
    --danger-color: #f44336;
    --background-color: #f5f5f5;
    --surface-color: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --shadow-light: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-medium: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-heavy: 0 4px 12px rgba(0,0,0,0.2);
    --border-radius: 4px;
    --transition: all 0.3s ease;
    /* Panel animation */
    --panel-transition-duration: 320ms;
    --panel-ease: cubic-bezier(0.22, 1, 0.36, 1); /* easeOutCubic */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--surface-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-spinner {
    text-align: center;
    color: var(--primary-color);
}

.loading-spinner i {
    font-size: 48px;
    animation: spin 2s linear infinite;
    margin-bottom: 20px;
    display: block;
}

.loading-spinner p {
    font-size: 18px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Top Navigation Bar */
.top-nav {
    background: var(--surface-color);
    height: 50px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-shadow: var(--shadow-light);
    z-index: 1000;
    position: relative;
}

.nav-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-secondary);
    position: relative;
}

.nav-icon.notification-icon.muted,
.nav-icon.notification-icon.muted i {
    color: var(--text-muted);
}

.nav-icon.notification-icon.muted {
    background: var(--background-color);
}

.nav-icon:hover {
    background: var(--background-color);
    color: var(--primary-color);
}

.nav-icon i {
    font-size: 16px;
}

.nav-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 8px;
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.language-selector {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.language-selector:hover {
    background: var(--background-color);
}

.alert-count, .cart-count {
    background: var(--accent-color);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 5px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--text-secondary);
}

.user-menu:hover {
    background: var(--background-color);
    color: var(--primary-color);
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 50px);
    width: 100vw; /* span full viewport width */
}

/* Left Sidebar */

 .sidebar {
     width: 380px;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-medium);
    /* Collapse by width so the map reclaims space */
    flex: 0 0 auto;
    flex-basis: 380px;
    transition: flex-basis var(--panel-transition-duration) var(--panel-ease), width var(--panel-transition-duration) var(--panel-ease), box-shadow 200ms ease;
    will-change: width, flex-basis;
    overflow: hidden; /* avoid showing content during animation */
}

.sidebar.collapsed {
    width: 0;
    flex-basis: 0;
    border-right: none;
    box-shadow: none;
    pointer-events: none; /* prevent hidden sidebar from catching clicks */
}

/* Hide inner content when collapsed */
.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .panel-content {
    display: none;
}

/* Sidebar Header */
.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.tab-buttons {
    display: flex;
    background: var(--background-color);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.tab-button {
    flex: 1;
    padding: 10px 8px;
    background: none;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tab-button i {
    font-size: 14px;
}

.tab-button.active {
    background: var(--surface-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-light);
}

.tab-button:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

/* Panel Content */
.panel-content {
    display: none;
    flex-direction: column;
    height: calc(100% - 80px);
}

.panel-content.active {
    display: flex;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.filter-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: none;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
}

.filter-tab.active {
    background: var(--surface-color);
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.filter-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.7);
}

/* Search Container */
.search-container {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 12px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.search-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-color);
    color: var(--surface-color);
    border-color: var(--primary-color);
}

/* Add Object button */
.add-object-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.add-object-btn:hover {
    background: var(--secondary-color);
    color: var(--surface-color);
    border-color: var(--secondary-color);
}

/* Inputs in modal */
.text-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* List Header */
.list-header {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-checkbox {
    margin-right: 8px;
    width: 14px;
    height: 14px;
}

.header-text {
    flex: 1;
}

.header-icon {
    width: 30px;
    text-align: center;
    font-size: 12px;
}

/* Object List */
.object-list {
    flex: 1;
    overflow-y: auto;
    background: var(--surface-color);
}

.object-list.loading .object-item {
    display: none;
}

.object-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
}

.object-item:hover {
    background: #f8f9fa;
}

.object-item.selected {
    background: #e3f2fd;
    border-left: 3px solid var(--primary-color);
}

.object-checkbox {
    margin-right: 8px;
    width: 14px;
    height: 14px;
}

.object-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border-radius: 3px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.object-icon.truck { background: var(--secondary-color); }
.object-icon.car { background: var(--accent-color); }
.object-icon.van { background: var(--primary-color); }
.object-icon.motorbike { background: #9c27b0; }

.object-details {
    flex: 1;
    min-width: 0;
}

.object-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.object-time {
    color: var(--text-secondary);
    font-size: 11px;
}

.object-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.object-status.online { background: var(--secondary-color); }
.object-status.offline { background: var(--text-muted); }
.object-status.idle { background: var(--accent-color); }
.object-status.moving { background: var(--primary-color); }

.object-speed {
    margin-left: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 50px;
    text-align: right;
}

.object-actions {
    margin-left: 8px;
    opacity: 0;
    transition: var(--transition);
}

.object-item:hover .object-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: 4px;
    opacity: 0.6;
    transition: var(--transition);
    border-radius: var(--border-radius);
}

.action-btn:hover {
    opacity: 1;
    background: var(--background-color);
}

/* History Panel Styles */
.history-filters {
    padding: 15px;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: 50%;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    display: block;
    font-weight: 500;
}

.filter-select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 12px;
    background: var(--surface-color);
    transition: var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.date-time-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.date-input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 12px;
    transition: var(--transition);
}

.time-input {
    width: 80px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 12px;
    transition: var(--transition);
}

.date-input:focus,
.time-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.filter-buttons {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.filter-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface-color);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    background: var(--background-color);
}

.filter-btn.primary {
    background: var(--primary-color);
    color: var(--surface-color);
    border-color: var(--primary-color);
}

.filter-btn.primary:hover {
    background: #1976d2;
}

.info-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.info-content {
    background: #f8f9fa;
    padding: 10px;
    border-radius: var(--border-radius);
    font-size: 11px;
    color: var(--text-secondary);
}

.info-content div {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-content i {
    color: var(--primary-color);
    width: 12px;
}

/* History Content */
.history-content {
    flex: 1;
    overflow-y: auto;
    background: var(--surface-color);
}

/* History Playback (separate from list) */
.history-playback {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.playback-controls .playback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.playback-buttons {
    display: flex;
    gap: 6px;
}

.playback-btn {
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: var(--border-radius);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.playback-btn.active {
    background: #e3f2fd;
    border-color: #1976d2;
    color: #0d47a1;
}

.playback-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}

.progress-slider { flex: 1; }

.progress-info { font-size: 12px; color: var(--text-secondary); }

.history-load-more { padding: 10px 15px; background: #fff; }

.no-data {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.no-data i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    color: var(--text-muted);
}

.history-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    background: #f8f9fa;
}

.history-item.selected {
    background: #e3f2fd;
    border-left: 3px solid var(--primary-color);
}

.history-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.history-location {
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 500;
}

.history-details {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    gap: 15px;
}

.history-speed {
    color: var(--secondary-color);
}

.history-status {
    color: var(--accent-color);
}

/* Events and Places Panels */
.events-container,
.places-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.events-header,
.places-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.events-header h3,
.places-header h3 {
    font-size: 14px;
    color: var(--text-primary);
    margin: 0;
}

.refresh-btn,
.add-place-btn {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.refresh-btn:hover,
.add-place-btn:hover {
    background: var(--primary-color);
    color: var(--surface-color);
    border-color: var(--primary-color);
}

.events-list,
.places-list {
    flex: 1;
    overflow-y: auto;
    background: var(--surface-color);
}

/* Map Container */
.map-container {
    flex: 1 1 auto;
    position: relative;
    /* transparent to avoid visible gray when neighbors collapse */
    background: transparent;
    /* Allow subtle layout animation when siblings change size */
    transition: flex var(--panel-transition-duration) var(--panel-ease), width var(--panel-transition-duration) var(--panel-ease), margin var(--panel-transition-duration) var(--panel-ease), padding var(--panel-transition-duration) var(--panel-ease);
}

.map-content {
    width: 100%;
    height: 100%;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 0; /* allow flex parent to control height properly */
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.control-group {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.control-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.control-btn:hover {
    background: var(--primary-color);
    color: var(--surface-color);
}

/* Status Bar */
.status-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--border-color);
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    backdrop-filter: blur(5px);
    z-index: 1200; /* ensure on top of Leaflet panes and controls */
    pointer-events: auto;
}

.status-left {
    display: flex;
    gap: 15px;
}

.status-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--text-secondary);
}

.status-btn.active {
    background: var(--primary-color);
    color: var(--surface-color);
}

.status-btn:hover:not(.active) {
    background: var(--background-color);
}

.status-center {
    flex: 1;
    text-align: center;
}

.status-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--text-secondary);
}

.status-close:hover {
    background: var(--danger-color);
    color: var(--surface-color);
}

/* Right Event Panel */
.event-panel {
    width: 300px;
    background: var(--surface-color);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-medium);
    position: relative; /* anchor for toggle handle */
    z-index: 900; /* keep above map content */
    flex: 0 0 auto;
    flex-basis: 300px; /* occupy 300px in flex layout */
    transition: flex-basis var(--panel-transition-duration) var(--panel-ease), width var(--panel-transition-duration) var(--panel-ease), box-shadow 200ms ease;
    will-change: width, flex-basis;
}

.event-panel.collapsed {
    /* Release space so map expands, keep a 28px handle */
    width: 28px;
    flex-basis: 28px;
    background: transparent;
    border-left: none;
    box-shadow: none;
}

.event-panel-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-panel-header h3 {
    font-size: 14px;
    color: var(--text-primary);
    margin: 0;
}

.panel-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--text-secondary);
}

.panel-toggle:hover {
    background: var(--background-color);
    color: var(--primary-color);
}

/* Keep a visible handle when collapsed */
.event-panel.collapsed .event-panel-header h3 {
    display: none;
}

.event-panel.collapsed .panel-toggle {
    position: absolute;
    left: 0;
    top: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 4px 0 0 4px;
    box-shadow: var(--shadow-medium);
}

.event-panel.collapsed .event-panel-header {
    background: transparent;
    border-bottom: none;
}

.event-panel.collapsed .event-panel-content {
    display: none;
}

.event-panel-content {
    flex: 1;
    overflow-y: auto;
}

.event-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    background: var(--surface-color);
    margin-bottom: 2px;
    transition: var(--transition);
}

.event-item:hover {
    background: #f8f9fa;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.event-title {
    background: var(--danger-color);
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.event-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.event-close:hover {
    background: var(--danger-color);
    color: var(--surface-color);
}

.event-object {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 13px;
}

.event-type,
.event-location,
.event-time {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 4px;
}

.show-event-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    margin-top: 8px;
    padding: 2px 0;
    transition: var(--transition);
}

.show-event-btn:hover {
    color: #1976d2;
}

/* Context Menu */
.context-menu {
    position: absolute;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    padding: 8px 0;
    font-size: 12px;
    z-index: 2000;
    display: none;
    min-width: 180px;
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.context-menu-item:hover {
    background: var(--background-color);
    color: var(--primary-color);
}

.context-menu-item i {
    width: 14px;
    text-align: center;
}

.context-menu-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

/* prevent selecting page text while dragging modals */
.no-select-drag {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--text-secondary);
}

.modal-close:hover {
    background: var(--danger-color);
    color: var(--surface-color);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Toast Notifications */

/* Centralized calibration panel inside IO Mapping modal */
.cal-modal-panel .cal-panel-body,
.io-cal-panel .cal-panel-body {
    width: 100%;
    max-height: 60vh;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
}

.cal-list .inline-cal-item,
.io-cal-panel .cal-list .inline-cal-item,
#modal-cal-list .inline-cal-item {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inline-row input.row-x,
.inline-row input.row-y {
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
}

.filter-btn.small {
    padding: 6px 8px;
    font-size: 12px;
}
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    padding: 12px 16px;
    min-width: 250px;
    max-width: 350px;
    transform: translateX(100%);
    animation: slideIn 0.3s ease forwards;
    position: relative;
}

.toast.success {
    border-left: 4px solid var(--secondary-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--accent-color);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

.toast-close {
    position: absolute;
    top: 5px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Scrollbar Styling */
.object-list::-webkit-scrollbar,
.history-content::-webkit-scrollbar,
.event-panel-content::-webkit-scrollbar,
.events-list::-webkit-scrollbar,
.places-list::-webkit-scrollbar {
    width: 6px;
}

.object-list::-webkit-scrollbar-track,
.history-content::-webkit-scrollbar-track,
.event-panel-content::-webkit-scrollbar-track,
.events-list::-webkit-scrollbar-track,
.places-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.object-list::-webkit-scrollbar-thumb,
.history-content::-webkit-scrollbar-thumb,
.event-panel-content::-webkit-scrollbar-thumb,
.events-list::-webkit-scrollbar-thumb,
.places-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.object-list::-webkit-scrollbar-thumb:hover,
.history-content::-webkit-scrollbar-thumb:hover,
.event-panel-content::-webkit-scrollbar-thumb:hover,
.events-list::-webkit-scrollbar-thumb:hover,
.places-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Vehicle Status Indicators */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: pulse 2s infinite;
}

.status-indicator.online {
    background: var(--secondary-color); /* green */
}

.status-indicator.offline {
    background: #bbb; /* gray */
    animation: none;
}

.status-indicator.idle {
    background: var(--accent-color); /* orange */
    animation: none;
}

.status-indicator.moving {
    background: var(--primary-color); /* blue */
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Map Marker Styles */
.custom-marker {
    width: 12px;
    height: 12px;
    background: var(--secondary-color);
    border: 2px solid var(--surface-color);
    border-radius: 50%;
    box-shadow: var(--shadow-medium);
    cursor: pointer;
    transition: var(--transition);
}

.custom-marker:hover {
    transform: scale(1.2);
}

.custom-marker.selected {
    background: var(--danger-color);
    transform: scale(1.3);
}

/* Stop Marker Styles */
.stop-marker {
    background: transparent;
    border: none;
}

.stop-icon {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 24px;
    color: #e74c3c;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    cursor: pointer;
    transition: all 0.3s ease;
}

.stop-icon:hover {
    transform: scale(1.1);
    color: #c0392b;
}

.stop-duration {
    position: absolute;
    top: 26px;
    background: #fff;
    color: #333;
    font-size: 10px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.stop-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.stop-popup h4 {
    margin: 0 0 10px 0;
    color: #e74c3c;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stop-popup p {
    margin: 5px 0;
    font-size: 12px;
    line-height: 1.4;
}

.stop-popup strong {
    color: #333;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.loading {
    pointer-events: none;
    opacity: 0.6;
}

.text-center {
    text-align: center;
}

.text-primary {
    color: var(--primary-color);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-success {
    color: var(--secondary-color);
}

.text-warning {
    color: var(--accent-color);
}

.text-danger {
    color: var(--danger-color);
}

.bg-primary {
    background-color: var(--primary-color);
}

.bg-secondary {
    background-color: var(--secondary-color);
}

.bg-warning {
    background-color: var(--accent-color);
}

.bg-danger {
    background-color: var(--danger-color);
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Status Drawer */
.status-drawer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 44px; /* sits just above the status bar */
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -6px 18px rgba(0,0,0,0.12);
    max-height: 60vh;
    transform: translateY(100%);
    transition: transform var(--panel-transition-duration) var(--panel-ease);
    z-index: 1199; /* just under status bar which is 1200 */
    display: flex;
    flex-direction: column;
}

.status-drawer.open {
    transform: translateY(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.drawer-title { font-weight: 600; color: var(--text-primary); }

.drawer-actions .drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
}

.drawer-actions .drawer-close:hover {
    background: var(--background-color);
}

.drawer-body {
    position: relative;
    display: flex;
    flex: 1;
}

.drawer-view { 
    display: none; 
    width: 100%; 
    height: 100%; 
    overflow: auto;
    padding: 8px;
}
.drawer-view.active { display: flex; flex-direction: column; }

/* Detailed Data View Styles */
.detailed-data-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    box-shadow: var(--shadow-light);
    border-left: 4px solid var(--primary-color);
}

.detailed-data-info h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.detailed-data-info h4 i {
    color: var(--primary-color);
}

.detailed-data-info p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.detailed-data-actions {
    display: flex;
    gap: 8px;
}

.detailed-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.detailed-btn:hover {
    background: #1976d2;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.detailed-btn i {
    font-size: 12px;
}

.detailed-data-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.signal-group {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

.signal-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid var(--border-color);
}

.signal-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.signal-group-badge {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.signal-list {
    padding: 0;
    margin: 0;
}

.signal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.signal-item:last-child {
    border-bottom: none;
}

.signal-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.signal-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.signal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.signal-type {
    background: #e3f2fd;
    color: #1976d2;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
}

.signal-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.signal-current {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.signal-unit {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.signal-timestamp {
    font-size: 10px;
    color: var(--text-muted);
}

/* Status indicators for signal values */
.signal-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 8px;
}

.signal-status.online {
    background: var(--secondary-color);
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.4);
}

.signal-status.warning {
    background: var(--accent-color);
    box-shadow: 0 0 4px rgba(255, 152, 0, 0.4);
}

.signal-status.error {
    background: var(--danger-color);
    box-shadow: 0 0 4px rgba(244, 67, 54, 0.4);
}

/* Data Table Styles */
.data-table-container {
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.data-table-header {
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.data-table-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.data-table-header h4 i {
    color: var(--primary-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover:not(.data-separator) {
    background-color: #f8f9fa;
}

.data-row td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.data-row:last-child td {
    border-bottom: none;
}

.data-key {
    font-weight: 500;
    color: var(--text-primary);
    background-color: #fafafa;
    width: 40%;
    min-width: 120px;
    font-size: 14px;
}

.data-value {
    color: var(--text-secondary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    word-break: break-all;
}

/* Vehicle info rows */
.vehicle-info .data-key {
    background-color: #e3f2fd;
    color: var(--primary-color);
    font-weight: 600;
}

.vehicle-info .data-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* IO data rows */
.io-data .data-key {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.io-data .data-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* Separator row */
.data-separator td {
    padding: 16px;
    text-align: center;
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
}

.data-separator .separator-line {
    display: inline-block;
    width: 40px;
    height: 1px;
    background-color: var(--border-color);
    vertical-align: middle;
}

.separator-text {
    margin: 0 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* No IO data row */
.no-io-data .no-data-cell {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-style: italic;
}

.no-data-cell i {
    margin-right: 8px;
    color: var(--accent-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .data-table-container {
        padding: 12px;
    }
    
    .data-key,
    .data-value {
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .data-key {
        width: 45%;
        min-width: 100px;
    }
}

/* Graph */
.graph-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.graph-metrics {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.graph-metrics label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--surface-color);
}

.graph-select {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface-color);
    font-size: 12px;
}

.graph-container {
    width: 100%;
    height: calc(60vh - 120px); /* drawer height minus headers and padding */
    min-height: 250px;
}

.graph-legend { font-size: 12px; color: var(--text-secondary); }

/* Compare tool */
.graph-actions { display:flex; gap:8px; align-items:center; }
.graph-btn {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.graph-btn.active { background: #eef6ff; border-color: #6aa9ff; }
.graph-compare-popup {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    padding: 10px 12px;
    font-size: 12px;
    max-width: 320px;
    z-index: 3;
}

/* IO Configuration Styles */
.vehicle-info {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--background-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.vehicle-info h4 {
    margin: 0 0 5px 0;
    color: var(--text-primary);
    font-size: 16px;
}

.vehicle-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.io-configuration {
    margin-top: 20px;
}

.io-configuration h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 16px;
}

.io-description {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.available-ios, .configured-ios {
    margin-bottom: 20px;
}

.available-ios h5, .configured-ios h5 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.io-list, .io-mappings {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface-color);
}

/* Keep inline calibration panel visually stable when rows are hidden */
.io-cal-panel .cal-panel-body {
    /* Fixed width, flexible height */
    width: 498px;
    min-width: 498px;
    max-width: 498px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* allow vertical growth but constrain to viewport */
    max-height: 70vh;
    overflow: hidden; /* inner areas will scroll instead */
}
.io-cal-panel .cal-list {
    max-height: 90px;
    overflow-y: auto;
}
.io-cal-panel .cal-add-row {
    min-height: 48px; /* reserve space for Add row + controls */
}

/* When rows area contains many rows allow its own scrolling */
.io-cal-panel [id^="inline-cal-rows-"] {
    overflow-y: auto;
    max-height: 160px;
}

.io-cal-panel .cal-add-row > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.io-cal-panel .cal-add-row .filter-btn {
    min-width: 120px;
}

.io-cal-panel .cal-add-controls {
    margin-top: 6px;
    display: flex;
    gap: 8px;
}
.io-cal-panel .cal-add-controls .filter-btn {
    min-width: 120px;
}

.io-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
}

.io-item:last-child {
    border-bottom: none;
}

.io-item:hover {
    background: var(--background-color);
}

/* Inline calibration rows and items (small UX polish) */
.inline-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}
.inline-row .row-x,
.inline-row .row-y {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    width: 120px;
}
.filter-btn.small {
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 4px;
}
.filter-btn.small.danger {
    background: var(--danger-color);
    color: white;
}

.inline-cal-item {
    padding: 6px 8px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
    margin-bottom: 4px;
    color: var(--text-secondary);
}
.inline-cal-item:hover {
    background: rgba(33,150,243,0.04);
    color: var(--text-primary);
}
.inline-cal-item.selected {
    font-weight: 700;
    background: #e8f4ff;
    border-left: 3px solid var(--primary-color);
    color: var(--text-primary);
}

.inline-cal-item { display: flex; align-items: center; justify-content: space-between; }
.inline-cal-label { flex: 1; }
.inline-cal-delete {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.inline-cal-delete:hover { opacity: 0.9; }

.inline-cal-edit{
background:var(--primary-color);
color:#fff;
border:none;
padding:6px 8px;
border-radius:4px;
cursor:pointer;
font-size:12px
}
.inline-cal-edit:hover{
opacity:.9
}

.io-info {
    flex: 1;
}

.io-key {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 13px;
}

.io-value {
    color: var(--text-secondary);
    margin-top: 2px;
    font-size: 11px;
}

.io-actions {
    display: flex;
    gap: 5px;
}

.io-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.io-btn.config {
    background: var(--primary-color);
    color: white;
}

.io-btn.config:hover {
    background: #1976d2;
}

.io-btn.delete {
    background: var(--danger-color);
    color: white;
}

.io-btn.delete:hover {
    background: #c62828;
}

.io-mapping {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.io-mapping:last-child {
    border-bottom: none;
}

.io-mapping:hover {
    background: var(--background-color);
}

.mapping-info {
    flex: 1;
}

.mapping-name {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 13px;
}

.mapping-details {
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 2px;
    line-height: 1.3;
}

.mapping-type {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    margin-right: 5px;
    letter-spacing: 0.5px;
}

.mapping-type.fuel { background: #e3f2fd; color: #1976d2; }
.mapping-type.ignition { background: #fff3e0; color: #f57c00; }
.mapping-type.temperature { background: #ffebee; color: #d32f2f; }
.mapping-type.voltage { background: #e8f5e8; color: #388e3c; }
.mapping-type.door { background: #f3e5f5; color: #7b1fa2; }
.mapping-type.odometer { background: #fff8e1; color: #f57f17; }
.mapping-type.custom { background: #f5f5f5; color: #666; }

.loading-message {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

.no-io-data {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

.no-io-data i {
    font-size: 24px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Formula field styling */
#modal-inline-cal-formula {
    padding: 6px 8px;
    border: 2px solid var(--accent);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    font-weight: 500;
}

#modal-inline-cal-formula:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.7;
}

#modal-inline-cal-formula:focus {
    outline: none;
    border-color: var(--success);
    box-shadow: 0 0 4px rgba(46, 204, 113, 0.3);
}

#modal-inline-cal-method:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.7;
}

#modal-inline-cal-formula::placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

/* Calibration item styling */
.inline-cal-item {
    padding: 8px 12px;
    margin: 4px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
}

.inline-cal-item:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.inline-cal-item.selected {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
    box-shadow: 0 2px 6px rgba(0,123,255,0.3);
}

.inline-cal-label {
    font-weight: 500;
    flex: 1;
    color: inherit;
}

.inline-cal-delete,
.inline-cal-edit {
    padding: 4px 8px;
    margin-left: 6px;
    font-size: 12px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    color: #333;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 50px;
    font-weight: 500;
}

.inline-cal-delete:hover {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.inline-cal-edit:hover {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.inline-cal-item.selected .inline-cal-delete,
.inline-cal-item.selected .inline-cal-edit {
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    border-color: rgba(255, 255, 255, 0.5);
}

.inline-cal-item.selected .inline-cal-delete:hover {
    background-color: #dc3545;
    color: white;
}

.inline-cal-item.selected .inline-cal-edit:hover {
    background-color: #007bff;
    color: white;
}

/* IO Table Wrapper - Fixed rows, horizontal scroll */
.io-table-wrapper {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #eee;
    border-radius: 4px;
    max-height: none;
}

.io-table {
    width: auto;
    min-width: 100%;
    font-size: 12px;
    border-collapse: collapse;
    table-layout: fixed;
}

.io-table thead th {
    position: sticky;
    top: 0;
    background: #fafafa;
    z-index: 2;
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
}

.io-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 120px;
    border-right: 1px solid #ddd;
}

.io-table tbody td {
    padding: 4px 8px;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

.io-table tbody td:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
    border-right: 1px solid #ddd;
    font-weight: 500;
}

.io-table tbody tr:hover {
    background-color: #f8f9fa;
}

.io-table tbody tr:hover td:first-child {
    background-color: #f8f9fa;
}

/* Scrollbar styling for IO table */
.io-table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.io-table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.io-table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.io-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Data List Items - ITL GPS Style */
.datalist-item-list {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px;
    background: #fff;
    border-radius: 4px;
}

.datalist-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    min-height: 40px;
}

.datalist-item:last-child {
    border-bottom: none;
}

.datalist-item.even {
    background-color: #fafafa;
}

.datalist-item.odd {
    background-color: #ffffff;
}

.datalist-item:hover {
    background-color: #f0f8ff;
}

.datalist-item-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
}

.datalist-item-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    margin-right: 12px;
    min-width: 0;
    word-wrap: break-word;
}

.datalist-item-value {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    text-align: right;
    flex-shrink: 0;
    max-width: 150px;
    word-wrap: break-word;
}

/* Icon classes for different IO types */
.icon-default-sensor::before { content: "⚡"; }
.icon-warning::before { content: "⚠️"; }
.icon-fuel::before { content: "⛽"; }
.icon-temperature::before { content: "🌡️"; }
.icon-voltage::before { content: "🔋"; }
.icon-engine::before { content: "🔧"; }
.icon-gps::before { content: "📍"; }
.icon-gsm::before { content: "📶"; }

/* Scrollbar for datalist */
.datalist-item-list::-webkit-scrollbar {
    width: 8px;
}

.datalist-item-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.datalist-item-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.datalist-item-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Fuel Sensor Settings Modal Styles */
.settings-section {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: #fafafa;
}

.settings-section h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-readonly {
    padding: 8px 12px;
    background: #f5f5f5;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 14px;
}

/* Toggle Switch Styles */
.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    gap: 10px;
    position: relative;
}

.toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 24px;
    transition: var(--transition);
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-label input:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle-label input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label:hover .toggle-slider {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Settings button for fuel sensors */
.sensor-settings-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    margin-left: 8px;
}

.sensor-settings-btn:hover {
    background: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sensor-settings-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Error message styling */
.error-message {
    background: #ffebee;
    border: 1px solid #f44336;
    border-radius: var(--border-radius);
    padding: 10px;
    margin: 10px 0;
    color: #c62828;
    font-size: 14px;
}

/* Sensor badge for showing current settings */
.sensor-badge {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    margin-left: 5px;
    font-weight: 500;
}

.sensor-badge.enabled {
    background: var(--secondary-color);
}

.sensor-badge.disabled {
    background: #999;
}
