/* Importar fuentes de Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

:root {
    --primary-color: #0056b3; /* Un azul corporativo */
    --secondary-color: #004085; /* Azul más oscuro */
    --background-color: #f0f2f5; /* Gris claro para el fondo */
    --card-background: #ffffff; /* Blanco para el contenedor */
    --text-color: #333333; /* Color de texto principal */
    --border-color: #dddddd; /* Color de bordes */
    --error-color: #d9534f; /* Rojo para mensajes de error */
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: #f0f2f5;
    color: #333;
}

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
	width: 100%;
}

.login-container {
    background: var(--card-background);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-header {
    margin-bottom: 30px;
}

.logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

h2 {
    font-weight: 600;
    color: var(--secondary-color);
    margin: 10px 0 0;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box; /* Asegura que el padding no afecte el ancho */
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-button {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.login-button:hover {
    background: var(--secondary-color);
}

.error-message {
    background-color: #f2dede;
    color: var(--error-color);
    border: 1px solid #ebccd1;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
}
/* -- Dashboard y Estructura Principal -- */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}


.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;               /* el ancho que ya usabas */
    background: #ffffff;        /* respeta tu color original */
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 100;               /* para que siempre quede encima de fondo */
}
.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
}

.sidebar-logo {
    width: 60px;
    height: 60px;
}

.sidebar-title {
    display: block;
    margin-top: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 10px;
}

.sidebar-nav a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 5px;
    transition: background-color 0.3s;
}

.sidebar-nav a:hover, .sidebar-nav .active a {
    background-color: var(--primary-color);
    color: white;
}

.main-content {
    margin-left: 250px;         /* deja el espacio del sidebar */
    flex: 1;
    width: calc(100% - 250px);
    min-height: 100vh;
    padding: 40px;
    background: var(--background-color); /* el gris que ya usabas */
    box-sizing: border-box;
}

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

.main-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: var(--secondary-color);
}

.btn-logout {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: var(--primary-color);
    color: white;
}

/* -- Widgets del Dashboard -- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.widget-card {
    
	
	text-decoration: none;  /* 🔑 quita la rayita de los links */
    color: inherit;         /* 🔑 mantiene el color original del texto */
	 display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
	  cursor: pointer;        /* opcional: da sensación de clic */
}
.widget-card:hover {
    transform: translateY(-4px);
}
.widget-icon {
    font-size: 2.5rem;
}
a.widget-card,
a.widget-card:link,
a.widget-card:visited,
a.widget-card:hover,
a.widget-card:active,
a.widget-card * {
    text-decoration: none !important; /* 🚫 sin subrayado */
    color: inherit !important;        /* 🚫 sin color azul */
}
.widget-info h3 {
    margin: 0;
    font-size: 1rem;
    color: #666;
}

.widget-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 5px 0 0;
}

/* -- Sección de Eventos Recientes -- */
.recent-events-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.recent-events-section h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.event-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding: 15px 0;
}

.event-item:last-child {
    border-bottom: none;
}

.event-time {
    color: #888;
    font-size: 0.9rem;
    flex-shrink: 0;
    width: 120px;
}

.event-details {
    flex-grow: 1;
    font-size: 1rem;
}

.event-actor {
    font-weight: 600;
}

.event-status {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.status-sent {
    background-color: #f0ad4e;
    color: white;
}
.status-ack {
    background-color: #5bc0de;
    color: white;
}
.status-done {
    background-color: #5cb85c;
    color: white;
}
.status-error {
    background-color: #d9534f;
    color: white;
}
.status-timeout {
    background-color: #337ab7;
    color: white;
}
.no-events {
    text-align: center;
    color: #888;
    padding: 20px;
}
/* --- Estilos de tablas --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th, .data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.data-table th {
    background-color: var(--secondary-color);
    color: white;
    font-weight: 600;
}

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* --- Botones --- */
.btn {
    padding: 8px 12px;
    border-radius: 5px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
}

.btn-details {
    background-color: var(--primary-color);
    color: white;
}

.btn-details:hover {
    background-color: var(--secondary-color);
}

.btn-action {
    background-color: #f0ad4e;
    color: white;
}

.btn-action:hover {
    background-color: #ec971f;
}

/* --- Badges de estado --- */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: white;
    font-weight: 600;
}

.status-badge.active {
    background-color: #5cb85c;
}

.status-badge.inactive {
    background-color: #d9534f;
}

.no-devices {
    text-align: center;
    color: #888;
    padding: 20px;
}

/* botón de "Crear Nuevo Proyecto" y para el nuevo mensaje no-data */
.btn-create {
    background-color: #5cb85c;
    color: white;
}
.btn-create:hover {
    background-color: #449d44;
}

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

.no-data {
    text-align: center;
    color: #888;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
}




/* --- Estilos de formularios --- */
.form-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.project-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.project-form .input-group label {
    font-weight: 600;
    margin-bottom: 5px;
}

.project-form .input-group input,
.project-form .input-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
    font-family: inherit;
}

.project-form .input-group textarea {
    resize: vertical;
}

/* --- Mensajes de alerta --- */
.alert-message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 600;
}

.alert-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --- Botón para volver --- */
.btn-back {
    background-color: #6c757d;
    color: white;
}
.btn-back:hover {
    background-color: #5a6268;
}

.main-header .btn-back {
    margin-left: 20px;
}

/* --- Estilos de asignación de dispositivos --- */
.assignment-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.device-selection {
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background-color: #f9f9f9;
}

.device-item {
    display: flex;
    align-items: center;
}

.device-item input[type="checkbox"] {
    margin-right: 15px;
    transform: scale(1.5);
}

.device-item label {
    flex-grow: 1;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/* --- Estilos de carga de archivos --- */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.upload-form input[type="file"] {
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 5px;
}

/* --- Galería de contenido --- */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.content-item {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.content-media {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background-color: black;
}

.content-actions {
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-name {
    font-size: 0.9rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-delete {
    background-color: #d9534f;
    color: white;
    border-radius: 5px;
    padding: 5px 10px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-delete:hover {
    background-color: #c9302c;
}


.status-badge.assigned {
    background-color: #dc3545; /* rojo */
    color: #fff;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.status-badge.not-assigned {
    background-color: #28a745; /* verde */
    color: #fff;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.8rem;
}
