/* Fallback CSS for when CDN resources don't load */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #111827;
    color: #f3f4f6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
nav {
    background-color: #1f2937;
    color: #f3f4f6;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border-bottom: 1px solid #374151;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav h1 {
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0;
}

.nav-btn {
    background-color: #2563eb;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.nav-btn:hover {
    background-color: #1d4ed8;
}

/* Main content */
.page {
    margin: 2rem 0;
}

.page.hidden {
    display: none !important;
}

/* Cards */
.card {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Buttons */
button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    margin: 0.25rem;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

/* Grid layouts */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
}

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

/* Sensor data containers */
.sensor-container {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.gps-container {
    background-color: #1e3a8a;
    border-color: #1e40af;
}

.orientation-container {
    background-color: #14532d;
    border-color: #166534;
}

.motion-container {
    background-color: #78350f;
    border-color: #92400e;
}

.weather-container {
    background-color: #581c87;
    border-color: #7c2d12;
}

/* Weather status indicators */
.weather-status {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(139, 92, 246, 0.5);
}

.text-green-600 {
    color: #10b981;
}

.text-yellow-600 {
    color: #f59e0b;
}

.text-red-600 {
    color: #ef4444;
}

.text-gray-500 {
    color: #9ca3af;
}

.border-purple-200 {
    border-color: rgba(139, 92, 246, 0.5);
}

.border-t {
    border-top-width: 1px;
}

.sensor-data {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

/* Status display */
.status-display {
    background-color: #374151;
    border: 1px solid #4b5563;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #d1d5db;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
    background: #1f2937;
    border: 1px solid #374151;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #374151;
    font-size: 0.875rem;
    color: #f3f4f6;
}

th {
    background-color: #374151;
    font-weight: 500;
}

tr:hover {
    background-color: #2d3748;
}

/* Map container */
.map-container {
    height: 400px;
    width: 100%;
    border: 2px solid #4b5563;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    background-color: #1f2937;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: #1f2937;
    border: 1px solid #374151;
    padding: 1.5rem;
    border-radius: 0.5rem;
    max-width: 32rem;
    max-height: 24rem;
    overflow-y: auto;
    margin: 1rem;
    color: #f3f4f6;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-close {
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.25rem;
}

.modal-close:hover {
    color: #d1d5db;
}

/* Loading spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 20px auto;
}

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

/* Form elements */
input, select {
    padding: 0.5rem;
    border: 1px solid #4b5563;
    background-color: #374151;
    color: #f3f4f6;
    border-radius: 0.375rem;
    margin: 0.25rem;
}

input:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Video and canvas */
video, canvas {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    border: 2px solid #4b5563;
    background-color: #1f2937;
}

audio {
    width: 100%;
    margin-top: 0.5rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    nav .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Utility classes */
.text-center { text-align: center; }
.font-bold { font-weight: bold; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0,0,0,0.1); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.space-y-4 > * + * { margin-top: 1rem; }
.overflow-x-auto { overflow-x: auto; }
.min-w-full { min-width: 100%; }