/* General Styles
#3DAF49 verde mas claro */
:root {
    --color-primario: #5bb163;      /* Verde esmeralda suave */
    --color-secundario: #263238;    /* Gris oscuro */
    --color-secundario_fade: #5e7079;
    --color-fondo: #E8F5E9;         /* Blanco puro */
    --color-accento-azul: #20a5ec;  /* Azul cielo */
    --color-accento-azul-dark: #1b8ecc;
    --color-accento-naranja: #FF7043; /* Naranja cálido */
    --color-accento-naranja-dark: #F4511E;
    --color-table-head: #2E7D32;
    --color-table-row-hover: #FFFFFF;
    --color-table-text: #263238;
    --color-btn-small-bg: #263238;
    --color-btn-small-hover: #2E7D32;
    --color-btn-small-shadow: #1B5E20;
    --color-btn-thirth-bg: #2E7D32;
    --color-btn-thirth-hover: #1B5E20;
    --color-navbar-bg: #2E7D32;
    --color-navbar-text: #E8F5E9;
    --color-footer-bg: #263238;
    --color-footer-text: #E8F5E9;
    --color-chat-header-bg: #20a5ec;
    --color-chat-header-border: #FF7043;
    --color-chat-header-text: #E8F5E9;
    --color-chat-body-bg: #E8F5E9;
    --color-chat-body-text: #263238;
    --color-dropdown-bg: #FFECB3;
    --color-dropdown-border: #FF7043;
}
/* ################################################################################# */
/* ################################################################################# */
body {
    font-family: 'Arial', sans-serif;
    color: var(--color-fondo);
    background-color: var(--color-fondo);
    margin: 0;
    padding: 0;
    width: 100%;
}

.container {
    width: 100%;
    height: 100%;
    background-color: var(--color-primario);
}
/* Spinner circular */
.loader {
  border: 4px solid #f3f3f3; /* color de fondo */
  border-top: 4px solid #3DAF49; /* color del spinner */
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 0.8s linear infinite;
  margin: auto;
  display: none; /* oculto por defecto */
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Clase para mostrarlo */
.loader.active {
  display: block;
}

.plans_intro {
    padding: 5%;
    text-align: center;
}

.plans_intro div {
    margin-bottom: 1em;
}
/* ################################################################################# */
/* ################################################################################# */
/* Contenedor de todas las gráficas */
#greenhousesContainer,
#rowChartContainer,
#groupedRowsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    justify-items: center;
    padding: 30px;
    max-width: 100%;   /* evita desbordamiento */
    box-sizing: border-box;
}

/* Cada gráfica individual */
.chart-item {
    width: 100%;
    max-width: 500px;
    min-width: 280px;   /* se ajusta en móviles */
    background-color: var(--color-secundario);
    padding: 10px;
    max-height: 500px;
    min-height: 280px;
    box-shadow: 0px 5px 10px rgba(0,0,0,0.3);
    border-radius: 20px;
    transition: transform 0.2s ease;
}

/* Hover */
.chart-item:hover {
    transform: scale(1.03);
}

/* Tablets */
@media (max-width: 1024px) {
    #greenhousesContainer,
    #rowChartContainer,
    #groupedRowsContainer {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
        padding: 20px;
    }
}

/* Móviles */
@media (max-width: 700px) {
    #greenhousesContainer,
    #rowChartContainer,
    #groupedRowsContainer {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
    }

    .chart-item {
        min-width: auto;    /* 🚀 ya no fuerza 280px */
    }
}

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


/* ################################################################################# */
/* ################################################################################# */
/* TEXT CONTAINER */
.text-container {
    font-family: Arial, Helvetica, sans-serif;
    color: var(--color-fondo);
    padding: 1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-container-tophead {
    font-family: Arial, Helvetica, sans-serif;
    color: var(--color-fondo);
    padding: 1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0px 5px 10px rgba(0,0,0,0.3);
    border-radius: 50px;
    margin-bottom: 1em;
    padding-left: 3em;
    padding-right: 3em;
}

.text-container p {
    padding-left: 1em;
    padding-right: 1em;
    overflow-x: hidden;
}

.text-container a {
    text-decoration: none;
    color: var(--color-fondo);
    font-weight: bold;
}
/* ################################################################################# */
/* ################################################################################# */
.charts-description {
    background: var(--color-navbar-bg);
    padding: 15px 20px;
    margin-top: 10px;
    border-radius: 12px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.95rem;
    line-height: 1.6;
}

.charts-description h4 {
    margin-bottom: 10px;
}


.charts-description li {
    margin-bottom: 8px;
}

.charts-description b {
    font-weight: bolder;
    color: #00a6ff; /* celeste para destacar parámetros */
}

/* ################################################################################# */
/* ################################################################################# */
/* Navbar Styles */
/* Navbar Styles */
.navbar {
    background-color: var(--color-navbar-bg); /* color de fondo */
    color: var(--color-navbar-text);

    /* Patrón en mosaico + capa semitransparente para controlar la opacidad */
    background-image: linear-gradient(rgba(46,125,50,0.7), rgba(46,125,50,1)), url("/static/mi_app/img/patron_back.png"); /* cambia a tu ruta */
    background-repeat: repeat;
    background-size: auto; /* si quieres mosaico 1:1 */

}


.navbar-container {
    height: fit-content;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-logo img {
    height: 8em;
    width: auto;
    margin-left: 1em;
}
.navbar-logo:hover {
    transform: scale(1.05);
}
/* ################################################################################# */
/* ################################################################################# */
/* Imagen de fondo con difuminado */
.background-section_welcome {
    position: relative;
    width: 100%;
    min-height: 480px; /* Ajusta según tu diseño */
    background-image: url('/static/mi_app/img/pexels-nc-farm-bureau-mark-2749165.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center; /* Centra verticalmente el contenido */
    justify-content: center; /* Centra horizontalmente el contenido */
    overflow-x: hidden;
}

.background-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(38, 50, 56, 0.4); /* Sombra oscura mejor contraste */
    box-shadow: inset 0px 5px 8px rgba(38, 50, 56, 1);
    z-index: 1;
}

.background-content {
    position: relative;
    z-index: 2;
    color: var(--color-fondo);
    text-align: center;
    padding: 2em;
}

/* ################################################################################# */
/* ################################################################################# */
/* Button Styles */
.btn {
    font-size: 14px;
    color: var(--color-navbar-text);
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s ease-out;
    border: none;
}
/* Primary */
.btn-primary {
    background-color: var(--color-accento-azul);
}
.btn-primary:hover {
    background-color: var(--color-accento-azul-dark);
    transform: scale(1.05);
}
/* Secondary */
.btn-secondary {
    background-color: var(--color-accento-naranja);
}

.btn-secondary:hover {
    background-color: var(--color-accento-naranja-dark);
    transform: scale(1.05);
}
/* Third button (custom) */
.btn-thirth {
    background-color: var(--color-table-head);
    color: var(--color-navbar-text);
    border: none;
    border-radius: 6px;
    padding: 1em 2em;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-thirth:hover {
    background-color: var(--color-table-row-hover);
    color: var(--color-table-text);
    transform: scale(1.03);
}
/* Small Button - Minimalista */
.btn-small {
    font-size: 0.75em;
    padding: 1em 2em;
    margin-top: 0.3em;
    border-radius: 6px;
    background-color: var(--color-btn-small-bg);
    color: var(--color-fondo);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.btn-small:hover {
    background: linear-gradient(145deg, var(--color-btn-small-hover), #1b5e20);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
/* ################################################################################# */
/* ################################################################################# */

/* Registro general */
.register-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #3DAF49, #1B5E20);
    padding: 2em;
}

/* Tarjeta del registro */
.register-card {
    background: #fff;
    color: #222;
    padding: 2.5em;
    border-radius: 16px;
    width: 380px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: left;
    animation: fadeIn 0.4s ease;
}

/* Animación de entrada */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Título */
.title {
    font-size: 1.8em;
    margin-bottom: 1em;
}

/* Inputs del formulario */
.register-card input {
    width: 95%;
    padding: 0.8em;
    margin: 0.6em 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    transition: 0.3s ease;
}

.register-card input:focus {
    border-color: #3DAF49;
    outline: none;
    box-shadow: 0 0 6px rgba(61, 175, 73, 0.4);
}

/* Botón */
.btn-register {
    width: 100%;
    padding: 0.9em;
    margin-top: 1em;
    background: #3DAF49;
    color: white;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-register:hover {
    background: #2E7D32;
}

/* Texto debajo */
.login-text {
    margin-top: 1.2em;
    font-size: 0.9em;
    color: #555;
}

.login-text a {
    color: #3DAF49;
    font-weight: 600;
    text-decoration: none;
}

.login-text a:hover {
    text-decoration: underline;
}
/* ################################################################################# */
/* ################################################################################# */

/* Login Screen general */
.background-section_login {
    position: relative;
    width: 100%;
    min-height: 100vh; /* asegura que ocupe toda la pantalla */
    background-image: url('/static/mi_app/img/pexels-soo-ann-woon-571568-3265437.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

.background-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(38, 50, 56, 0.55); /* sombra oscura */
    box-shadow: inset 0px 5px 8px rgba(38, 50, 56, 0.9);
    z-index: 1;
}

.login-container {
    position: relative;
    z-index: 2; /* va por delante del overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2em;
    width: 100%;
}


/* Tarjeta del login */
.login-card {
    background: #fff;
    color: #222;
    padding: 2.5em;
    border-radius: 16px;
    width: 380px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    text-align: left;
    animation: fadeIn 0.4s ease;
}

/* Título */
.title {
    font-size: 1.8em;
    margin-bottom: 1em;
    text-align: center;
    color: #2E7D32;
}

/* Inputs */
.login-card input {
    width: 95%;
    padding: 0.8em;
    margin: 0.6em 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    transition: 0.3s ease;
}

.login-card input:focus {
    border-color: #3DAF49;
    outline: none;
    box-shadow: 0 0 6px rgba(61, 175, 73, 0.4);
}

/* Botón */
.btn-login {
    width: 100%;
    padding: 0.9em;
    margin-top: 1em;
    background: #3DAF49;
    color: white;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-login:hover {
    background: #2E7D32;
}

/* Error */
.error-msg {
    color: red;
    margin-top: 0.5em;
    font-size: 0.9em;
}

/* Texto debajo */
.register-text {
    margin-top: 1.2em;
    font-size: 0.9em;
    color: #555;
    text-align: center;
}

.register-text a {
    color: #3DAF49;
    font-weight: 600;
    text-decoration: none;
}

.register-text a:hover {
    text-decoration: underline;
}
/* ################################################################################# */
/* ################################################################################# */
/* Table Styles */
.table_container{
    overflow-x: auto;
    box-shadow: 0px 5px 10px rgba(0,0,0,0.3);
}
.table {
    width: 100%;
    background-color: var(--color-navbar-text);
    color: var(--color-table-text);
    border-radius: 8px;
    overflow-x: auto;
    border-collapse: collapse;
    table-layout: auto; /* columnas automáticas */
    text-align: center;
    font-size: 14px;
}

/* Encabezado */
.table thead tr th {
    background-color: var(--color-table-head);
    color: var(--color-navbar-text);
    padding: 10px 8px;
    vertical-align: middle;
    white-space: nowrap;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(0,0,0,0.1);
}

/* Cuerpo */
.table tbody tr {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.table tbody tr:last-child {
    border-bottom: none; /* quita borde al último */
}

.table tbody tr:hover {
    background-color: var(--color-table-row-hover);
    transition: background-color 0.2s ease-in-out;
}

.table tbody td {
    text-align: center;
    vertical-align: middle;
    padding: 8px 6px;
    font-size: 13px;
}

/* Bordes redondeados arriba */
.table thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
}
.table thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

/* Bordes redondeados abajo */
.table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}
.table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}
/* ################################################################################# */
/* ################################################################################# */
/* Modal overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.2);

    /* Centrado */
    align-items: center;
    justify-content: center;
}

/* Contenido modal */
.modal > div {
    background: #fff;
    color: #222;
    padding: 2em;
    border-radius: 12px;
    width: 350px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease;
}

/* Animación suave */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Formulario */
.form-group {
    margin-bottom: 1em;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3em;
}

.form-group input,
.form-group select {
    width: 95%;
    padding: 0.6em;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
}

/* Botones */
.modal .actions {
    display: flex;
    justify-content: flex-end;
    gap: 1em;
    margin-top: 1.2em;
}

.modal .actions button {
    padding: 0.6em 1.2em;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.modal .actions .btn-small {
    background: #3DAF49;
    color: #fff;
}

.modal .actions .btn-small.close-modal {
    background: #ccc;
    color: #222;
}
/* ################################################################################# */
/* ################################################################################# */
/* Contenedor filtros */
#chart-filters {
    display: flex;
    max-width: 50%;
    align-items: center;
    overflow: hidden;
    overflow-x: auto;
    gap: 5px;
    background-color: var(--color-navbar-text);
    color: var(--color-table-text);
    padding: 5px 15px;
    border-radius: 8px;
    box-shadow: 0px 2px 6px rgba(0,0,0,0.05);
    font-size: 14px;
}

/* Labels tipo inline */
#chart-filters label {
    font-weight: 600;
    color: var(--color-table-text);
    margin-right: 6px;
}

/* Inputs de fecha */
#chart-filters input[type="text"] {
    padding: 6px 10px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 6px;
    font-size: 13px;
    background-color: #fff;
    color: #333;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#chart-filters input[type="text"]:focus {
    border-color: var(--color-table-head);
    box-shadow: 0 0 4px rgba(0,0,0,0.15);
}
/* Inputs de fecha */
#chart-filters select {
    padding: 6px 10px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 6px;
    font-size: 13px;
    background-color: #fff;
    color: #333;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#chart-filters select:focus {
    border-color: var(--color-table-head);
    box-shadow: 0 0 4px rgba(0,0,0,0.15);
}
/* ################################################################################# */
/* ################################################################################# */
/* Chat Widget Grafic Chat */
#chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 30em;
    max-width: 45%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    z-index: 10;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    overflow: hidden;
}

#gc-header {
    background: var(--color-chat-header-bg);
    padding: 10px 15px;
    border-bottom: 2px solid var(--color-chat-header-border);
    color: var(--color-chat-header-text);
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#gc-toggle {
    font-size: 18px;
}

#gc-body {
    display: none;
    background: var(--color-chat-body-bg);
    padding: 10px;
    color: var(--color-chat-body-text);
}

#gc-form {
    width: 100%;
    display: flex;
    flex-direction: column;
}

#gc-form div{
    display: flex;
    flex-wrap: nowrap;
}

#gc-form div div{
    flex-direction: column;
    width: 50%
}

#gc-form input,
#gc-form textarea,
#gc-form select {
    width: auto;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#gc-form button[type="submit"] {
    padding: 8px 12px;
    background: var(--color-accento-azul);
    color: var(--color-fondo);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    width: 80%;
    margin-top: 5px;
}

#gc-form button[type="submit"]:hover {
    background: var(--color-accento-azul-dark);
}

#gc-form button[type="button"] {
    padding: 8px 12px;
    background: var(--color-secundario);
    color: var(--color-fondo);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    width: 20%;
    margin-top: 5px;
}

#gc-form button[type="button"]:hover {
    background: var(--color-secundario_fade);
}

#gc-messages {
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #ccc;
    background: var(--color-chat-body-text);
    color: var(--color-fondo);
    border-radius: 4px;
}

/* Mensajes de usuario */
#gc-messages .user-msg {
    background: var(--color-primario);
    color: var(--color-fondo);
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    text-align: right;
}

/* Mensajes del LLM */
#gc-messages .llm-msg {
    background: var(--color-accento-azul);
    color: var(--color-fondo);
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    text-align: left;
}

/* Efecto focus */
#gc-form input:focus,
#gc-form textarea:focus,
#gc-form select:focus {
    border-color: #3DAF49;
    box-shadow: 0 0 4px rgba(61, 175, 73, 0.4);
}

/* Warning */
#chat-warning {
    display: none;
    color: red;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Footer */
footer {
    background-color: var(--color-footer-bg);
    color: var(--color-footer-text);
    text-align: center;
    padding: 5px 0;
    position: bottom;
    bottom: 0;
    width: 100%;
}