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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.status-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status.online {
    background-color: #10b981;
    color: white;
}

.status.offline {
    background-color: #ef4444;
    color: white;
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 1rem;
}

.panel {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.panel h3 {
    margin-bottom: 1rem;
    color: #374151;
    font-size: 1.1rem;
}

.map-container {
    flex: 1;
    position: relative;
}

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

/* Marcadores personalizados */
.custom-marker {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 30px;
    height: 42px;
    border-radius: 50% 50% 50% 0;
    position: relative;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.marker-pin:hover {
    transform: rotate(-45deg) scale(1.1);
}

.marker-pin span {
    transform: rotate(45deg);
    font-size: 18px;
}

.marker-pin.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.marker-pin.inactive {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.marker-pin.sos {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: pulse-sos 1.5s infinite;
}

@keyframes pulse-sos {
    0%, 100% {
        box-shadow: 0 3px 10px rgba(239, 68, 68, 0.5);
    }
    50% {
        box-shadow: 0 3px 20px rgba(239, 68, 68, 0.9);
    }
}

.device-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.device-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.device-item.active {
    background: #dbeafe;
    border-color: #3b82f6;
}

.device-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.device-info {
    font-size: 0.875rem;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.status-dot.online {
    background-color: #10b981;
}

.status-dot.offline {
    background-color: #ef4444;
}

.alert-item {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.alert-item.sos {
    background: #fef2f2;
    border-color: #ef4444;
}

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

.alert-type {
    background: #ef4444;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.alert-time {
    font-size: 0.75rem;
    color: #6b7280;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

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

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

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

.btn-danger {
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

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

.test-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.test-controls input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.close:hover {
    color: #374151;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Leaflet customizations */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 0.75rem;
    min-width: 200px;
}

.popup-content h4 {
    margin: 0 0 0.75rem 0;
    color: #111827;
    font-size: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.popup-info {
    font-size: 0.875rem;
    color: #374151;
}

.popup-info div {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.popup-info strong {
    color: #6b7280;
    font-weight: 500;
}

/* Controles del mapa */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-control-zoom a {
    border: none !important;
    border-radius: 4px !important;
    margin: 2px !important;
}

.leaflet-bar a:first-child {
    border-top-left-radius: 4px !important;
    border-top-right-radius: 4px !important;
}

.leaflet-bar a:last-child {
    border-bottom-left-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 300px;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }
}