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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #eee;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background: #16213e;
    padding: 12px 16px;
    border-bottom: 1px solid #0f3460;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: #4cc9f0;
}

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

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-group label {
    font-size: 0.85rem;
    color: #aaa;
}

select, input[type="date"], input[type="url"], input[type="password"] {
    padding: 6px 10px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #1a1a2e;
    color: #eee;
    font-size: 0.9rem;
}

select:focus, input:focus {
    outline: none;
    border-color: #4cc9f0;
}

input[type="checkbox"] {
    margin-right: 4px;
}

button {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    background: #4cc9f0;
    color: #1a1a2e;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background: #7dd8f7;
}

button#settings-btn {
    background: #0f3460;
    color: #eee;
}

button#settings-btn:hover {
    background: #16213e;
}

#map {
    flex: 1;
    z-index: 0;
}

#status-bar {
    background: #16213e;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #aaa;
    border-top: 1px solid #0f3460;
}

#status-text.error {
    color: #e94560;
}

#status-text.success {
    color: #4ade80;
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: #16213e;
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #4cc9f0;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #aaa;
}

.form-group input {
    width: 100%;
    padding: 10px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-buttons button#cancel-settings {
    background: #0f3460;
    color: #eee;
}

/* Device colors for markers */
.device-0 { background-color: #4cc9f0; }
.device-1 { background-color: #f72585; }
.device-2 { background-color: #4ade80; }
.device-3 { background-color: #fbbf24; }
.device-4 { background-color: #a78bfa; }
.device-5 { background-color: #fb7185; }
.device-6 { background-color: #2dd4bf; }
.device-7 { background-color: #f97316; }

/* Leaflet customization */
.leaflet-popup-content-wrapper {
    background: #16213e;
    color: #eee;
    border-radius: 8px;
}

.leaflet-popup-tip {
    background: #16213e;
}

.leaflet-popup-content {
    margin: 12px;
}

.popup-device {
    font-weight: 600;
    color: #4cc9f0;
    margin-bottom: 8px;
}

.popup-coords {
    font-family: monospace;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.popup-time {
    color: #aaa;
    font-size: 0.85rem;
}

.popup-accuracy {
    color: #aaa;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 10px 12px;
    }

    header h1 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    #controls {
        gap: 8px;
    }

    .control-group {
        flex: 1 1 calc(50% - 8px);
    }

    button {
        flex: 1;
    }
}
