* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #2c3e50;
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-config {
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.user-config:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Logo */
.logo img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-content {
    padding: 20px;
}

.sidebar h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.filter-option:hover {
    background-color: #f0f2f5;
}

.filter-option.active {
    background-color: #3498db;
    color: white;
}

.filter-option i {
    width: 20px;
    text-align: center;
}

.separator {
    height: 1px;
    background-color: #ecf0f1;
    margin: 20px 0;
}

.settings-section h3 {
    margin-bottom: 15px;
}

.settings-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 5px;
}

.settings-option:hover {
    background-color: #f0f2f5;
}

/* Content */
.content {
    flex: 1;
    padding: 20px;
    background-color: #f5f7fa;
}

/* Fondos por categoría para el index */
.content.automotriz {
    background-image: url('../imagenes/automotriz.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.content.domestico {
    background-image: url('../imagenes/domestico.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.content.industrial {
    background-image: url('../imagenes/industrial.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.content.refrigeracion {
    background-image: url('../imagenes/refrigeracion.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.content.todos {
    background-image: url('../imagenes/todos.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Asegurar que el contenido sea legible sobre las imágenes de fondo */
.sensors-section {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.sensors-section h2 {
    color: #2c3e50;
    font-size: 20px;
    padding-bottom: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
}

.add-device-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.add-device-btn:hover:not(:disabled) {
    background-color: #2980b9;
}

.add-device-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

.hide-device-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.hide-device-btn:hover {
    background-color: #c0392b;
}

.hide-device-btn.hidden {
    background-color: #2ecc71;
}

.hide-device-btn.hidden:hover {
    background-color: #27ae60;
}

.sensor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.sensor-card {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
    border-left: 4px solid #3498db;
    cursor: pointer;
}

.sensor-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.sensor-name {
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sensor-options {
    position: relative;
    cursor: pointer;
    color: #7f8c8d;
    padding: 5px;
    border-radius: 4px;
    transition: color 0.2s;
}

.sensor-options:hover {
    color: #2c3e50;
    background-color: rgba(0, 0, 0, 0.05);
}

.options-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid #ecf0f1;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    min-width: 120px;
    display: none;
}

.option-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.option-item:hover {
    background-color: #f8f9fa;
}

.option-item:not(:last-child) {
    border-bottom: 1px solid #ecf0f1;
}

.sensor-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
}

.sensor-status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Nuevos estados de presión según los rangos 0-200 PSI */
.status-muy-baja, .status-muy-alta {
    background-color: #e74c3c !important;
    color: white !important;
}

.status-baja, .status-alta {
    background-color: #FFD900;
    color: #333;
}

.status-normal {
    background-color: #2ecc71;
    color: white;
}

.no-sensors {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
    font-style: italic;
}

/* Alerts Panel */
.alerts-panel {
    width: 300px;
    background-color: white;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow-y: auto;
}

.alerts-panel h2 {
    color: #2c3e50;
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.alert-item {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-item.critical {
    background-color: #ffebee;
    border-left: 4px solid #e74c3c;
}

.alert-item.warning {
    background-color: #fff8e1;
    border-left: 4px solid #f39c12;
}

.alert-item.info {
    background-color: #e3f2fd;
    border-left: 4px solid #3498db;
}

.alert-icon {
    font-size: 18px;
    margin-top: 2px;
}

.alert-critical .alert-icon {
    color: #e74c3c;
}

.alert-warning .alert-icon {
    color: #f39c12;
}

.alert-info .alert-icon {
    color: #3498db;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.alert-message {
    font-size: 14px;
    margin-bottom: 5px;
}

.alert-time {
    font-size: 12px;
    color: #7f8c8d;
}

/* Last Update */
.last-update {
    text-align: center;
    color: #7f8c8d;
    font-size: 14px;
    padding: 15px;
    background-color: white;
    border-top: 1px solid #ecf0f1;
}

/* 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: 10% auto;
    padding: 0;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    color: #2c3e50;
    font-size: 18px;
}

.close {
    color: #7f8c8d;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Add Modal Styles */
.add-all-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ecf0f1;
}

.add-all-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    transition: background-color 0.3s;
}

.add-all-btn:hover {
    background-color: #2980b9;
}

.available-device {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid #ecf0f1;
    border-radius: 5px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.available-device:hover {
    background-color: #f8f9fa;
}

.device-info {
    display: flex;
    flex-direction: column;
}

.device-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.device-category {
    font-size: 12px;
    color: #7f8c8d;
}

.add-icon {
    color: #3498db;
    font-size: 18px;
}

/* Estilos para el modal de información del dispositivo */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #ecf0f1;
}

.info-label {
    font-weight: 600;
    color: #2c3e50;
}

.info-value {
    color: #7f8c8d;
}

/* Estilos para el interruptor deslizante */
.config-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #ecf0f1;
}

.config-label {
    font-weight: 600;
    color: #2c3e50;
}

.config-description {
    color: #7f8c8d;
    font-size: 14px;
    margin-top: 10px;
    font-style: italic;
}

/* Interruptor deslizante */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

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

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3498db;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Estilos para la sección de ayuda */
.help-section {
    line-height: 1.6;
}

.help-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
}

.help-item {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ecf0f1;
}

.help-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.help-item strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 5px;
}

.help-item ul {
    margin: 10px 0;
    padding-left: 20px;
}

.help-item li {
    margin-bottom: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .alerts-panel {
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        z-index: 1000;
        transform: translateX(100%);
    }

    .alerts-panel.active {
        transform: translateX(0);
    }

    .sensor-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .button-group {
        width: 100%;
        justify-content: space-between;
    }

    .add-device-btn, .hide-device-btn {
        flex: 1;
        justify-content: center;
    }
}
