/* Estilos personalizados para IoT Dashboard */

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

/* Sistema de notificaciones unificado - Simplificado */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 320px;
    width: 100%;
}

.toast-notification {
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    margin-bottom: 8px;
    overflow: hidden;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease-out;
    border-left: 3px solid;
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-notification.success {
    border-left-color: #28a745;
    background-color: #d4edda;
}

.toast-notification.error {
    border-left-color: #dc3545;
    background-color: #f8d7da;
}

.toast-notification.warning {
    border-left-color: #ffc107;
    background-color: #fff3cd;
}

.toast-notification.info {
    border-left-color: #17a2b8;
    background-color: #d1ecf1;
}

/* Contenido simplificado - una sola línea */
.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.toast-notification.success .toast-icon {
    color: #28a745;
}

.toast-notification.error .toast-icon {
    color: #dc3545;
}

.toast-notification.warning .toast-icon {
    color: #856404;
}

.toast-notification.info .toast-icon {
    color: #17a2b8;
}

.toast-text {
    flex: 1;
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

/* Animación de entrada */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animación de salida */
@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Efectos para formularios validados */
.was-validated .form-control:valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 1.88 1.88 3.77-3.77.94.94-4.71 4.71z'/%3e%3c/svg%3e");
}

.was-validated .form-control:invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 1.4 1.4 1.4-1.4'/%3e%3c/svg%3e");
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
}

.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

.form-control {
    border-radius: 6px;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.table {
    border-radius: 6px;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.badge {
    font-size: 0.75em;
    padding: 0.35em 0.65em;
}

.alert {
    border-radius: 8px;
    border: none;
}

.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 10px 10px 0 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 10px 10px;
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* Transiciones suaves para valores de sensores */
.sensor-valor {
    transition: all 0.3s ease-in-out;
}

.sensor-timestamp {
    transition: all 0.3s ease-in-out;
}

.system-memory,
.system-wifi,
.system-uptime,
.system-status {
    transition: all 0.3s ease-in-out;
}

/* Efecto sutil cuando cambian los valores */
.sensor-valor.updated {
    background-color: rgba(13, 110, 253, 0.1);
    border-radius: 4px;
    padding: 2px 4px;
}

.sensor-valor.updated {
    animation: highlight 0.5s ease-out;
}

@keyframes highlight {
    0% {
        background-color: rgba(13, 110, 253, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 

/* Estilos para actualizaciones suaves del panel */
.sensor-card {
    transition: all 0.4s ease;
    position: relative;
}

/* NOMBRE DEL DISPOSITIVO - Prueba diferentes tamaños */
.sensor-card .card-title {
    /* OPCIÓN 1: Muy pequeño */
    font-size: 0.75rem;
    
    /* OPCIÓN 2: Pequeño */
    /* font-size: 0.85rem; */
    
    /* OPCIÓN 3: Mediano-pequeño */
    /* font-size: 0.9rem; */
    
    /* OPCIÓN 4: Mediano (original) */
    /* font-size: 1rem; */
    
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

/* NOMBRE DEL SENSOR - Prueba diferentes tamaños */
.sensor-card .card-subtitle {
    /* OPCIÓN 1: Muy pequeño */
    font-size: 0.8rem;
    
    /* OPCIÓN 2: Pequeño */
    /* font-size: 0.9rem; */
    
    /* OPCIÓN 3: Mediano-pequeño */
    /* font-size: 1rem; */
    
    /* OPCIÓN 4: Mediano (original) */
    /* font-size: 1.1rem; */
    
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
}

/* VALOR DEL SENSOR - Prueba diferentes tamaños */
.sensor-card .sensor-value {
    transition: all 0.3s ease;
    font-weight: bold;
    
    /* OPCIÓN 1: Muy grande */
    font-size: 2.5rem;
    
    /* OPCIÓN 2: Grande */
    /* font-size: 2.2rem; */
    
    /* OPCIÓN 3: Mediano-grande */
    /* font-size: 2rem; */
    
    /* OPCIÓN 4: Mediano (original) */
    /* font-size: 1.8rem; */
    
    /* OPCIÓN 5: Pequeño */
    /* font-size: 1.5rem; */
    
    color: #007bff;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.sensor-card .sensor-value.updating {
    transform: scale(1.05);
    color: #28a745 !important;
}

.sensor-card .sensor-unit {
    font-size: 0.8em;
    color: #6c757d;
    margin-left: 0.25rem;
}

.alert-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 4px 4px 0 0;
    transition: all 0.4s ease;
}

.alert-indicator.alerta_alta {
    background: linear-gradient(90deg, #dc3545, #fd7e14);
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
}

.alert-indicator.alerta_baja {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

/* Animación de pulso para alertas */
@keyframes pulse-alert {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.sensor-card.alerta_alta .alert-indicator,
.sensor-card.alerta_baja .alert-indicator {
    animation: pulse-alert 2s infinite;
}

/* Transiciones suaves para cambios de estado */
.sensor-card.normal {
    border-color: #dee2e6;
}

.sensor-card.alerta_alta {
    border-color: #dc3545;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.1);
}

.sensor-card.alerta_baja {
    border-color: #ffc107;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.1);
} 