/* RID Sensor - Drone Tracker Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #1a1a2e;
    color: #eee;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: #16213e;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #0f3460;
}

.sidebar-header {
    padding: 16px;
    background: #0f3460;
    border-bottom: 1px solid #1a1a2e;
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #e94560;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header h1::before {
    content: "📡";
}

.stats-bar {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: #aaa;
}

.stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-value {
    color: #4ecca3;
    font-weight: 600;
}

/* Drone List */
.drone-list-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.drone-list-header {
    padding: 12px 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    border-bottom: 1px solid #0f3460;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drone-list-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.time-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-filter label {
    font-size: 11px;
    color: #666;
    text-transform: none;
    letter-spacing: normal;
}

.time-select {
    background: #0f3460;
    border: 1px solid #1a4a7a;
    color: #eee;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    flex: 1;
}

.time-select:hover {
    background: #1a4a7a;
}

.time-select:focus {
    outline: none;
    border-color: #4ecca3;
}

.refresh-btn {
    background: #0f3460;
    border: none;
    color: #4ecca3;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.refresh-btn:hover {
    background: #1a4a7a;
}

.drone-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.drone-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #1a1a2e;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.drone-item:hover {
    background: #0f3460;
}

.drone-item.selected {
    border-color: #e94560;
    background: #0f3460;
}

.drone-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.drone-id {
    font-weight: 600;
    font-size: 14px;
    color: #4ecca3;
    word-break: break-all;
}

.drone-count {
    font-size: 11px;
    background: #e94560;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
}

.drone-meta {
    font-size: 11px;
    color: #888;
}

.drone-meta span {
    margin-right: 12px;
}

/* Info Panel */
.info-panel {
    border-top: 1px solid #0f3460;
    max-height: 40%;
    overflow-y: auto;
    background: #1a1a2e;
}

.info-panel-header {
    padding: 12px 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    background: #16213e;
    position: sticky;
    top: 0;
    border-bottom: 1px solid #0f3460;
}

.info-content {
    padding: 12px 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #0f3460;
    font-size: 13px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #888;
}

.info-value {
    color: #4ecca3;
    text-align: right;
    word-break: break-all;
    max-width: 60%;
}

.no-selection {
    padding: 20px 16px;
    text-align: center;
    color: #666;
    font-size: 13px;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
}

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

/* Map Controls Overlay */
.map-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-btn {
    background: #16213e;
    border: 1px solid #0f3460;
    color: #eee;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.map-btn:hover {
    background: #0f3460;
}

/* Connection Status */
.connection-status {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    background: #16213e;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e94560;
}

.status-dot.connected {
    background: #4ecca3;
}

/* Custom Leaflet Markers */
.drone-marker {
    background: #e94560;
    border: 2px solid white;
    border-radius: 50%;
    width: 12px;
    height: 12px;
}

.drone-marker.selected {
    background: #4ecca3;
    width: 16px;
    height: 16px;
}

/* Pulsing animation for latest drone position */
.pulse-marker {
    position: relative;
}

.pulse-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(78, 204, 163, 0.3);
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
}

.pulse-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: rgba(78, 204, 163, 0.5);
    border-radius: 50%;
    animation: pulse 2s ease-out infinite 0.5s;
}

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

/* Operator marker glow */
.operator-glow {
    position: relative;
}

.operator-glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(243, 156, 18, 0.4);
    border-radius: 50%;
    animation: operator-pulse 3s ease-in-out infinite;
}

@keyframes operator-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.4;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.2;
    }
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #666;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #0f3460;
    border-top-color: #4ecca3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1a4a7a;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid #0f3460;
}

.nav-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.nav-tab:hover {
    background: #0f3460;
    color: #eee;
}

.nav-tab.active {
    background: #0f3460;
    color: #4ecca3;
    border-bottom: 2px solid #4ecca3;
}

/* Sensor Panel */
.sensor-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.sensor-panel.active {
    display: flex;
}

.drone-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.drone-panel.active {
    display: flex;
}

.sensor-list-header {
    padding: 12px 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    border-bottom: 1px solid #0f3460;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sensor-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sensor-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #1a1a2e;
    border-radius: 8px;
    border: 1px solid #0f3460;
}

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

.sensor-id {
    font-weight: 600;
    font-size: 14px;
    color: #4ecca3;
}

.sensor-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.sensor-status.enabled {
    background: #4ecca3;
    color: #1a1a2e;
}

.sensor-status.disabled {
    background: #e94560;
    color: white;
}

.sensor-meta {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
}

.sensor-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 4px 10px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit {
    background: #0f3460;
    color: #4ecca3;
}

.btn-edit:hover {
    background: #1a4a7a;
}

.btn-delete {
    background: #3d1a2e;
    color: #e94560;
}

.btn-delete:hover {
    background: #5d2a3e;
}

.btn-add {
    background: #4ecca3;
    color: #1a1a2e;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.btn-add:hover {
    background: #3dbb92;
}

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

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #16213e;
    border-radius: 8px;
    width: 400px;
    max-width: 90vw;
    border: 1px solid #0f3460;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid #0f3460;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #eee;
}

.modal-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

.modal-body {
    padding: 16px;
}

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

.form-group label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #eee;
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4ecca3;
}

.form-group input:disabled,
.form-group input[readonly] {
    background: #12121f;
    color: #999;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group-inline label {
    margin-bottom: 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f3460;
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #888;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #4ecca3;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #1a1a2e;
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid #0f3460;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #4ecca3;
    color: #1a1a2e;
}

.btn-primary:hover {
    background: #3dbb92;
}

.btn-secondary {
    background: #0f3460;
    color: #eee;
}

.btn-secondary:hover {
    background: #1a4a7a;
}

.api-key-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-key-display input {
    flex: 1;
}

.btn-generate {
    background: #0f3460;
    color: #4ecca3;
    border: none;
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.btn-generate:hover {
    background: #1a4a7a;
}

.btn-copy {
    background: #0f3460;
    color: #4ecca3;
    border: none;
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-copy:hover {
    background: #1a4a7a;
}

.copy-hint {
    font-size: 11px;
    color: #e94560;
    margin-top: 4px;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 3000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: #4ecca3;
    color: #1a1a2e;
}

.toast.error {
    background: #e94560;
    color: white;
}

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