
body {
   font-family: Arial, sans-serif;
   background-color: #111827;
   color: #e5e7eb;
   margin: 0;
   padding: 30px;
}
/* LOGIN */
* {
    box-sizing: border-box;
}
.login-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 80px;
}
.login-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-page1 {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-card {
    max-width: 380px;
    width: 100%;
    padding: 30px;
}
.remember-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.remember-container input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}
.remember-container label {
    margin: 0;
    font-size: 0.9rem;
    cursor: pointer;
}
.enlaces_login {
    color: #CD5C5C;                /* Cambia el color del texto */
    text-decoration: none;         /* Quita el subrayado */
    font-weight: bold;             /* Pone el texto en negrita */
    padding: 5px;                  /* Añade espacio alrededor */
    font-size: 0.8rem;
    margin-bottom: 18px;
    margin: 10px 0;                   /* Añade espacio entre los enlaces */
}
.enlaces_login:hover {
    color: #995500;                 /* Cambia el color del texto al pasar el mouse */
}
/* Evitar que el checkbox herede width 100% */
.login-card input[type="checkbox"] {
    width: auto;
    flex: 0 0 auto;
}

/* Asegurar que texto no herede tamaño grande */
.login-card .remember-container label {
    font-size: 0.85rem;
    font-weight: normal;
}
/* CONTENIDO */
.content {
   padding: 40px;
}

/* CARDS */
.card-container {
   display: flex;
   gap: 20px;
   margin-bottom: 40px;
   flex-wrap: wrap;
   align-items: stretch;
}

.card {
   background: #1f2937;
   padding: 20px;
   border-radius: 12px;
   flex: 1;
   min-width: 200px;
   box-shadow: 0 0 15px rgba(0,0,0,0.4);
}

.card h3 {
   margin: 0 0 10px 0;
   font-size: 14px;
   color: #9ca3af;
}

.card .value {
   font-size: 36px;
   font-weight: bold;
}

/* COLORES VALORES */
.temp { color: #f87171; }
.hum  { color: #60a5fa; }
.pres { color: #34d399; }

/* FORMULARIOS */
input {
   width: 100%;
   padding: 12px;
   margin-bottom: 15px;
   border-radius: 6px;
   border: 1px solid #374151;
   background-color: #1f2937;
   color: #e5e7eb;
   font-size: 14px;
}

button {
   width: 100%;
   padding: 12px;
   border-radius: 6px;
   border: none;
   background-color: #2a5298;
   color: white;
   font-size: 15px;
   cursor: pointer;
   transition: 0.2s;
}

button:hover {
   background-color: #1e3c72;
}

.error {
   background-color: #7f1d1d;
   color: #fecaca;
   padding: 10px;
   margin-bottom: 15px;
   border-radius: 6px;
   font-size: 14px;
}

/* GRÁFICAS */
canvas {
   background: #1f2937;
   padding: 15px;
   border-radius: 12px;
   margin-bottom: 30px;
}

.chart-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
   gap: 20px;
}

.chart-box {
   background: #1f2937;
   padding: 15px;
   border-radius: 12px;
   height: 280px;
   box-shadow: 0 0 15px rgba(0,0,0,0.4);
}

.chart-box canvas {
   width: 100% !important;
   height: 100% !important;
}

.stats {
   font-size: 13px;
   color: #9ca3af;
   margin-top: 10px;
}
.card-link {
    display: block;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.card-link:hover .card {
    transform: translateY(-3px);
    transition: 0.2s ease;
    cursor: pointer;
}

/*DETALLES*/
.chart-wrapper {
    width: 95%;
    max-width: 1400px;
    height: 60vh;
    margin: 30px auto;
    position: relative;
}

.stats-inline {
    font-size: 0.6em;
    font-weight: normal;
    margin-left: 15px;
    color: #555;
}
/* NAVBAR */
/* contacto */
.contact-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 16px;
    color: #ffffff;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #4b5563;
    transition: 0.2s;
}
.contact-info:hover {
    background-color: #506070;
}
.area-contac input,
.area-contac textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #374151;
    background-color: #1f2937;
    color: white;
    padding: 8px;
    border-radius: 6px;
}
/* fecha y hora */
.datetime {
    margin-left: 20px;
    font-size: 14px;
    opacity: 0.9;
}

.navbar {
   background-color: #1e3c72;
   color: white;
   padding: 15px 30px;
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 10px;
   border-radius: 15px;
}
.logo {
   font-weight: bold;
   font-size: 18px;
   color: #f9fafb;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: 20px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-size: 14px;
}

.nav-links a:hover {
    opacity: 0.8;
}

.nav-right a {
   margin-left: 20px;
}
/* DROPDOWN */

.dropdown {
    position: relative;
}

.dropbtn {
    background: none;
    border: none;
    color: white;
    font: inherit;
    cursor: pointer;
}
.dropbtn:hover {
    background-color: #1f2957;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #1f2937; /*#1f2937; color de menú admin*/
    min-width: 160px;
    border-radius: 6px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    overflow: hidden;
}

.dropdown-content a {
    padding: 10px 14px;
    display: block;
    color: white;
    text-decoration: none;
}

.dropdown-content a:hover {
    background-color: #374151;/*#374151; color de los botones admin al pasar*/
}

.show {
    display: block;
}

/* ADMIN */

/* Contenedor general admin */

.admin-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.admin-title {
    margin-bottom: 15px;
}

.admin-actions {
    margin-bottom: 15px;
}

/* Tabla base admin */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #1f2937;
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    font-size: 14px;
}

.admin-table th {
    background-color: #111827;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}
.admin-table thead th {
    text-align: left;
}

.admin-table tbody td {
    text-align: left;
}

.acciones-col {
    text-align: center;
}

.admin-actions-cell {
    display: flex;
    justify-content: center;
    gap: 8px;
}

label {
    font-size: 13px;
    color: #9ca3af;
    display: block;
    margin-bottom: 4px;
}
.admin-table tr {
    border-top: 1px solid #374151;
}

.admin-table tr:hover {
    background-color: #374151;
}

/* Tabla estaciones específica */

.table-estaciones td:nth-child(1) {
    width: 160px;
}
.table-estaciones td:nth-child(6) {
    text-align: center;
}

.btn-admin {
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    border: 1px solid #4b5563;
    color: white;
    transition: 0.2s;
}

.btn-admin:hover {
    background-color: #506070;
}

.btn-success {
    border-color: #22c55e;
    color: #22c55e;
}

.btn-danger {
    border-color: #ef4444;
    color: #ef4444;
}

.status-active {
    color: #22c55e;
    font-weight: bold;
    border-color: #22c55e;
}
.btn-md {
    width: 90px;
}
.status-inactive {
    color: #ef4444;
    font-weight: bold;
    border-color: #ef4444;
}
.table-estaciones th:last-child,
.table-estaciones td:last-child {
    text-align: center;
}
.admin-actions-cell {
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* Crear/Editar estación */
.admin-card {
    background: #1e293b;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}
.checkbox-estacion {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    white-space: nowrap;
}

.checkbox-estacion input {
    transform: scale(2.2);
    margin: 0;
    margin-right: 10px;
}
.form-full {
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.form-actions button {
    width: 220px;
}

.form-actions a {
    width: 120px;
    text-align: center;
}
/* para movil */
@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}
/* inputs más consistentes */
.form-field select,
.form-field input {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
}

.form-control {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: none;
}
.form-control {
    background-color: #111827;   /* un poco más claro que el fondo */
    color: #f3f4f6;
    border: 1px solid #374151;
}

.form-control:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 1px #22c55e;
}
select.form-control {
    background-color: #111827;
    color: #f3f4f6;
    border: 1px solid #374151;
}



/* ===== TELEGRAM CONFIG ===== */
.telegram-box{
max-width:600px;
margin:40px auto;
background:#1f2933;
border:1px solid #374151;
padding:28px;
border-radius:10px;
box-shadow:0 4px 14px rgba(0,0,0,0.4);
color:#e5e7eb;
}

.telegram-box h2{
margin-bottom:8px;
}
.telegram-info{
color:#9ca3af;
margin-bottom:20px;
}

.telegram-step{
margin-top:24px;
}

.telegram-button{
display:inline-block;
background:#229ED9;
color:white;
padding:11px 22px;
border-radius:6px;
text-decoration:none;
font-weight:600;
transition:background .15s;
}

.telegram-button:hover{
background:#1b8bc0;
}

.telegram-command{
background:#111827;
border:1px solid #374151;
padding:12px;
border-radius:6px;
font-family:monospace;
margin-top:10px;
margin-bottom:10px;
word-break:break-all;
color:#d1d5db;
}

.telegram-copy{
background:#374151;
color:#f3f4f6;
border:none;
padding:10px 16px;
border-radius:6px;
cursor:pointer;
}

.telegram-copy:hover{
background:#4b5563;
}

/* ===== TELEGRAM STATUS ===== */

.telegram-header{
display:flex;
align-items:center;
gap:10px;
margin-bottom:12px;
}

.telegram-icon{
width:28px;
height:28px;
filter:invert(1);
}

.telegram-status{
margin-top:15px;
padding:12px 14px;
border-radius:6px;
font-size:14px;
}

.telegram-ok{
background:#0f2e1c;
color:#6ee7b7;
border:1px solid #14532d;
}

.telegram-off{
background:#3a1f1f;
color:#fca5a5;
border:1px solid #7f1d1d;
}

/* ===== CONFIG PANEL ===== */

.config-grid{
display:grid;
grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
gap:20px;
max-width:900px;
margin:40px auto;
}

.config-card{
background:#1f2933;
border:1px solid #374151;
padding:22px;
border-radius:10px;
transition:all .15s;
}

.config-card:hover{
transform:translateY(-3px);
border-color:#4b5563;
}

.config-card h3{
margin-bottom:8px;
}

.config-card p{
color:#9ca3af;
font-size:14px;
margin-bottom:16px;
}

.config-button{
display:inline-block;
background:#2563eb;
color:white;
padding:8px 14px;
border-radius:6px;
text-decoration:none;
font-size:14px;
}

.config-button:hover{
background:#1d4ed8;
}

.separa_bottom{
margin-bottom:20px;
}

/* Tabla usuarios específica */
.table-usuarios td:nth-child(1) {
    width: 60px;
}

.table-usuarios th:last-child,
.table-usuarios td:last-child {
    text-align: center;
}
.table-usuarios th:nth-child(1),
.table-usuarios td:nth-child(1) {
    min-width: 180px;
}

/* Tabla sensores específica */

.table-sensores th:nth-child(4),
.table-sensores td:nth-child(4) {
    text-align: center;
}

.table-sensores th:last-child,
.table-sensores td:last-child {
    text-align: center;
}

/* ===== FORMULARIO SENSORES (aislado, no rompe estaciones) ===== */

.admin-card-form {
    max-width: 720px;
    margin: 40px auto;
}

.admin-card-form h3 {
    margin-left: 40px;
}

.admin-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-vertical {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 20px;
}

.input-admin {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    background: #111827;
    color: #e5e7eb;
    border: 1px solid #374151;
}

.input-admin:focus {
    outline: none;
    border-color: #22c55e;
}

.form-checkboxes {
    display: flex;
    gap: 60px;
    margin-top: 40px;
    margin-bottom: 30px;
    margin-left: 60px;
}

.checkbox-admin {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    white-space: nowrap;
}

.checkbox-admin input {
    transform: scale(2.2);
    margin: 0;
    margin-right: 10px;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* ===== CONFIGURACIÓN DE ACCESOS ===== */

.config-access-section {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 10px;
    padding: 22px;
    margin-bottom: 18px;
}

.config-access-section h2 {
    margin: 0 0 20px 0;
}


/* ===== TABLAS ===== */

.config-access-table {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    border-collapse: collapse;
}

.config-access-table th,
.config-access-table td {
    padding: 10px 12px;
    text-align: left;
}

.config-access-table th {
    color: #d1d5db;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid #4b5563;
}

.config-access-table td {
    border-top: 1px solid #374151;
}

.config-access-table tbody tr:hover {
    background-color: #273449;
}

/* La última columna contiene normalmente las acciones */
.config-access-table th:last-child,
.config-access-table td:last-child {
    width: 1%;
    white-space: nowrap;
}


/* ===== BOTONES ===== */

.config-access-btn {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #4b5563;
    border-radius: 6px;
    color: #e5e7eb;
    background: transparent;
    text-decoration: none;
    font-size: 13px;
    transition: 0.2s ease;
    white-space: nowrap;
}

.config-access-btn:hover {
    background-color: #374151;
    border-color: #6b7280;
}


/* Acción positiva: Mostrar / Aprobar */

.config-access-btn-success {
    border-color: #22c55e;
    color: #22c55e;
}

.config-access-btn-success:hover {
    background-color: #14532d;
    border-color: #22c55e;
}


/* Acción peligrosa: Ocultar / Denegar / Revocar */

.config-access-btn-danger {
    border-color: #ef4444;
    color: #ef4444;
}

.config-access-btn-danger:hover {
    background-color: #7f1d1d;
    border-color: #ef4444;
}


/* Acción principal: Gestionar / Solicitar */

.config-access-btn-primary {
    border-color: #60a5fa;
    color: #60a5fa;
}

.config-access-btn-primary:hover {
    background-color: #1e3a5f;
    border-color: #60a5fa;
}


/* ===== ESTADOS ===== */

.config-access-status {
    font-weight: 600;
}

.config-access-status-success {
    color: #22c55e;
}

.config-access-status-pending {
    color: #facc15;
}

.config-access-status-danger {
    color: #ef4444;
}

.config-access-status-muted {
    color: #9ca3af;
}

/* ===== GRUPO DE ACCIONES ===== */

.config-access-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.config-access-container {
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.sensor-box-container{
    max-width:600px;
    margin: 30px auto;
    padding: 0 20px;
}

.config-access-back-container {
    margin-bottom: 12px;
}

.config-access-title {
    margin-bottom: 24px;
}

.config-access-title span {
    color: #60a5fa;
}

/* ===== ALERTAS ===== */

.alertas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.alerta-card {
    background: #1f2933;
    border: 1px solid #374151;
    padding: 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.alerta-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.alerta-card-header h3 {
    margin: 0;
    font-size: 18px;
}

.alerta-sensor,
.alerta-condicion,
.alerta-rearme {
    margin: 6px 0;
    color: #9ca3af;
    font-size: 14px;
}

.alerta-estado {
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
}

.alerta-estado.activa {
    color: #22c55e;
    border: 1px solid #22c55e;
}

.alerta-estado.desactivada {
    color: #ef4444;
    border: 1px solid #ef4444;
}

.alerta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 18px;
}

.alerta-actions form {
    margin: 0;
}

.alerta-actions .config-button,
.alerta-actions button {
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
    display: inline-block;
}

.alerta-delete {
    border: 1px solid #ef4444;
}

.alerta-delete:hover {
    background-color: #7f1d1d;
}


/* ===== ALERTAS EN MÓVIL ===== */

@media (max-width: 700px) {

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

    .alerta-card-header {
        flex-direction: column;
    }

    .alerta-actions {
        flex-direction: column;
    }

    .alerta-actions .config-button,
    .alerta-actions button {
        width: 100%;
    }
}

/* ===== FORMULARIO DE ALERTAS ===== */

.alerta-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 20px;
}

.alerta-form-field {
    min-width: 0;
}

.alerta-form-full {
    grid-column: 1 / -1;
}

.alerta-form-field label {
    display: block;
    margin-bottom: 6px;
}

.alerta-form-field .form-control {
    width: 100%;
    margin-bottom: 0;
}


.alerta-opciones {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #374151;
}

.alerta-opciones h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
}


.alerta-checkboxes {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.alerta-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    color: #e5e7eb;
}

.alerta-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}


.alerta-form-actions {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.alerta-form-actions .config-button {
    width: 220px;
}


/* ===== FORMULARIO ALERTAS EN MÓVIL ===== */

@media (max-width: 700px) {

    .alerta-form-grid {
        grid-template-columns: 1fr;
    }

    .alerta-form-full {
        grid-column: auto;
    }

    .alerta-checkboxes {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .alerta-form-actions .config-button {
        width: 100%;
    }
}

/* =========================================
   MENSAJE PERSONALIZADO DE ALERTAS
   ========================================= */

.alerta-mensaje {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #374151;

    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
    gap: 20px;
}

.alerta-mensaje-textarea {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    margin-top: 8px;
    box-sizing: border-box;
}

.alerta-mensaje-herramientas {
    min-width: 0;
}

.alerta-placeholder-titulo {
    margin-bottom: 8px;
    color: #9ca3af;
    font-size: 14px;
}

.alerta-placeholder-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.alerta-placeholder-buttons .config-button {
    width: 100%;
    padding: 7px 8px;
    font-size: 13px;
    margin: 0;
}

.alerta-vista-previa {
    margin-top: 20px;
}

.alerta-preview-text {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 6px;
    padding: 14px;
    min-height: 100px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #e5e7eb;
    font-size: 14px;
    line-height: 1.5;
}


/* En móvil volvemos a una columna */

@media (max-width: 700px) {

    .alerta-mensaje {
        grid-template-columns: 1fr;
    }

    .alerta-placeholder-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

}