* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #333;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 2.2em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.controls select, .controls button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.controls button {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    font-weight: 600;
}

.controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.live-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%) !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.map-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.map-header {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
}

.map-header h2 {
    margin: 0;
    color: #495057;
    font-size: 1.4em;
}

.map-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
}

.checkbox-label input[type="checkbox"] {
    transform: scale(1.2);
}

.map-container {
    position: relative;
    height: 600px;
}

#map {
    height: 100%;
    width: 100%;
}

.map-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.speed-indicator {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    min-width: 120px;
}

.speed-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1;
}

.speed-unit {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 5px;
}

.trail-info {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    min-width: 200px;
}

.trail-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trail-stats .stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.trail-stats .label {
    color: #7f8c8d;
    font-weight: 500;
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}

.current-info {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.info-card {
    padding: 25px;
}

.info-card h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.location-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.coordinates {
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: bold;
}

.address {
    color: #6c757d;
    font-style: italic;
}

.timestamp {
    color: #28a745;
    font-weight: 500;
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.stat-icon {
    font-size: 2.5em;
    opacity: 0.8;
}

.stat-content h3 {
    color: #666;
    margin-bottom: 8px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-content p {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-content small {
    color: #28a745;
    font-size: 0.8em;
}

.timeline-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.timeline-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4em;
}

.timeline-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.timeline-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.timeline-btn.active, .timeline-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.timeline-chart {
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.data-table {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-header h2 {
    color: #333;
    font-size: 1.4em;
}

.table-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

#searchInput {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

#exportBtn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    cursor: pointer;
    font-weight: 500;
}

.table-container {
    overflow-x: auto;
    border-radius: 10px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
}

table tr:hover {
    background-color: #f8f9fa;
}

.table-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.table-pagination button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    cursor: pointer;
}

.table-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 15px;
    width: 80%;
    max-width: 500px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 15px;
}

.close:hover {
    color: black;
}

/* Speed indicator colors */
.speed-indicator.slow { border-left: 4px solid #28a745; }
.speed-indicator.medium { border-left: 4px solid #ffc107; }
.speed-indicator.fast { border-left: 4px solid #dc3545; }

/* Speed badge styles */
.speed-badge {
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.9em;
}

/* Point details modal styles */
.point-details .detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.point-details .detail-row:last-child {
    border-bottom: none;
}

.detail-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.detail-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    font-size: 14px;
}

/* Custom marker styles */
.start-marker, .end-marker {
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.temp-marker {
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Trail animation */
@keyframes trailAnimation {
    0% { stroke-dasharray: 0, 1000; }
    100% { stroke-dasharray: 1000, 0; }
}

.animated-trail {
    animation: trailAnimation 3s ease-in-out;
}

/* Popup content styles */
.popup-content {
    min-width: 200px;
}

.popup-content h4 {
    margin: 0 0 10px 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.popup-content p {
    margin: 5px 0;
    font-size: 13px;
}

.popup-content button {
    margin-top: 10px;
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    background: #667eea;
    color: white;
    cursor: pointer;
    font-size: 12px;
}

/* Error styles */
.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    padding: 15px 20px;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Loading styles */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Table action buttons */
table td button {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    margin: 0 2px;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

table td button:hover {
    background-color: #f8f9fa;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .map-overlay {
        position: relative;
        top: auto;
        right: auto;
        flex-direction: row;
        justify-content: center;
        padding: 20px;
    }
    
    .map-container {
        height: 500px;
    }
}

@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .map-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .map-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .table-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .map-overlay {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .stat-icon {
        font-size: 2em;
    }
    
    .map-container {
        height: 400px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
}

/* Notification styles */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}