/* ================= RELLENAGRO (drop-in UNHEVAL) ================= */
:root {
    /* Mantenemos los nombres de variables originales para compatibilidad */
    --uhe-blue: #2A9659;
    /* ahora: verde primario */
    --uhe-blue-dark: #1F7446;
    /* verde profundo */
    --uhe-blue-100: #E7F5EC;
    /* verde muy claro (fondos sutiles) */

    --uhe-green: #34B36B;
    /* acento éxito (más brillante) */
    --uhe-green-dark: #207548;

    --uhe-gold: #C88A4A;
    /* tierra/arcilla cálida */
    --uhe-gold-200: #E3B788;

    --uhe-text: #243133;
    /* gris verdoso profundo (legibilidad) */
    --uhe-muted: #6C7A7A;

    --uhe-surface: #F6FAF7;
    /* fondo app suave verdoso */
    --uhe-elev: #FFFFFF;
    /* tarjetas/nav */
    --uhe-border: rgba(42, 150, 89, .14);
    --shadow: 0 2px 6px rgba(15, 45, 30, .08);

    /* Extras para este tema (usadas internamente) */
    --agro-sky: #38A3D1;
    --agro-sky-100: #E8F6FD;
    --agro-sky-200: #CFEAFA;
    --agro-danger: #DC2626;
    --agro-warning: #E3A008;

    /* Gradientes */
    --grad-hero: linear-gradient(180deg, var(--uhe-blue) 0%, var(--uhe-blue-dark) 100%);
    --grad-cardhead: linear-gradient(135deg, #CFECDD, #96D9B7);
    --grad-tableth: linear-gradient(135deg, #EAF7F0, #D6EFDF);
}

/* ============ Base ============ */
html,
body {
    height: 100%
}

html,
body {
    overflow-x: hidden !important;
}

body {
    background: var(--uhe-surface);
    font-family: 'Poppins', sans-serif;
    color: var(--uhe-text);
    margin: 0;
}

/* layout principal: navbar + sidebar + main (flex) */
.d-flex>main {
    min-width: 0;
    /* CLAVE: permite encoger dentro de flex */
    overflow-x: clip;
    /* evita sangrados laterales */
}

/* ============ Hero (portada) ============ */
.masthead {
    background: var(--grad-hero);
    color: #fff !important;
    min-height: 30rem;
    padding-top: 1rem;
}

.masthead h1 {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, .35);
    color: var(--uhe-gold);
}

@media (min-width: 992px) {
    .masthead h1 {
        font-size: 3.5rem
    }
}

.masthead .logo-app,
.masthead .logo-uheval {
    height: 250px;
    width: auto;
}

.masthead .logo-uheval {
    opacity: .95
}

@media (max-width: 576px) {

    .masthead .logo-app,
    .masthead .logo-uheval {
        height: 96px
    }
}

.masthead .gap-4 {
    gap: 1.25rem !important
}

/* ============ Navbar ============ */
.navbar-uhe {
    background-color: var(--uhe-blue) !important;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--uhe-border);
    --bs-navbar-color: #fff;
    --bs-navbar-hover-color: var(--uhe-gold);
    --bs-navbar-active-color: var(--uhe-gold);
    --bs-navbar-brand-color: #fff;
    --bs-navbar-brand-hover-color: var(--uhe-gold);
    --bs-navbar-toggler-border-color: var(--uhe-gold);
}

.navbar-uhe .navbar-toggler-icon {
    filter: invert(1) opacity(.9)
}

.navbar,
.navbar .nav-link {
    color: var(--uhe-text)
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
    color: var(--uhe-blue)
}

.navbar.is-scrolled {
    padding-top: .25rem;
    padding-bottom: .25rem;
    box-shadow: var(--shadow)
}

.navbar-toggler {
    padding: .25rem .35rem;
    border-color: var(--uhe-gold) !important
}

.navbar-uhe .text-end,
.navbar-uhe .text-end strong {
    color: #fff !important
}

.navbar-uhe .text-end small {
    color: rgba(255, 255, 255, .8) !important
}

/* Marca e iconos */
.brand-img {
    display: block;
    height: 40px;
    width: auto;
    object-fit: contain
}

@media (min-width: 576px) {
    .brand-img {
        height: 44px
    }
}

@media (min-width: 992px) {
    .brand-img {
        height: 54px
    }
}

.nav-icon-link {
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    line-height: 1
}

.nav-icon-link:hover,
.nav-icon-link:focus {
    color: var(--uhe-gold)
}

.avatar-img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border: 2px solid var(--uhe-blue-100)
}

@media (max-width: 575.98px) {
    .avatar-img {
        width: 40px;
        height: 40px
    }
}

/* ============ Sidebar (modo claro) ============ */
.sidebar-uhe-light {
    background: var(--uhe-elev) !important;
    color: var(--uhe-blue-dark)
}

.sidebar-uhe-light .p-3 {
    background: var(--uhe-elev);
    border-bottom: 1px solid var(--uhe-border)
}

.sidebar-uhe-light .sidebar-title {
    color: var(--uhe-blue-dark)
}

.sidebar-uhe-light #toggle-btn {
    border-color: var(--uhe-blue);
    color: var(--uhe-blue)
}

.sidebar-uhe-light #toggle-btn:hover {
    background: var(--uhe-blue);
    color: #fff
}

.sidebar-uhe-light #toggle-btn i {
    color: var(--uhe-blue)
}

.sidebar-uhe-light .sidebar-section {
    color: var(--uhe-blue-dark) !important;
    letter-spacing: .06em
}

.sidebar-uhe-light .nav-link {
    color: var(--uhe-blue) !important;
    border-radius: .5rem;
    padding: .55rem .75rem
}

.sidebar-uhe-light .nav-link i {
    color: var(--uhe-blue) !important
}

.sidebar-uhe-light .nav-link:hover {
    background: var(--uhe-blue-100);
    color: var(--uhe-blue-dark) !important
}

.sidebar-uhe-light .nav-link:hover i {
    color: var(--uhe-blue-dark) !important
}

.sidebar-uhe-light .nav-link.active {
    position: relative;
    background: var(--uhe-blue-100);
    color: var(--uhe-blue-dark) !important;
    font-weight: 600
}

.sidebar-uhe-light .nav-link.active i {
    color: var(--uhe-blue-dark) !important
}

.sidebar-uhe-light .nav-link.active::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 3px;
    background: var(--uhe-blue)
}

.sidebar-uhe-light .logout-link {
    color: #dc3545 !important
}

.sidebar-uhe-light .logout-link:hover {
    background: rgba(220, 53, 69, .08);
    color: #b02a37 !important
}

.sidebar-uhe-light.sidebar {
    position: sticky;
    top: 56px;
    height: calc(100dvh - 56px)
}

.sidebar-uhe-light.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: .65rem 0
}

.sidebar-uhe-light.sidebar.collapsed .nav-link i {
    margin-right: 0 !important
}

.sidebar-uhe-light.sidebar.collapsed .sidebar-section,
.sidebar-uhe-light.sidebar.collapsed .label,
.sidebar-uhe-light.sidebar.collapsed .sidebar-title {
    display: none !important
}

#sidebarMobile.sidebar-uhe-light .offcanvas-header {
    background: var(--uhe-elev);
    border-bottom: 1px solid var(--uhe-border)
}

#sidebarMobile.sidebar-uhe-light .btn-close {
    filter: none
}

/* ============ Botones ============ */
.btn {
    border-radius: 10px;
    font-weight: 600;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    position: relative;
    overflow: hidden;
    font-size: 14px;
    padding: 8px 16px
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .2), transparent);
    transition: left .5s
}

.btn:hover::before {
    left: 100%
}

.btn-outline-secondary {
    background: rgba(148, 163, 184, .1);
    border: 2px solid rgba(148, 163, 184, .3);
    color: #475569;
    backdrop-filter: blur(10px)
}

.btn-outline-secondary:hover {
    background: #475569;
    border-color: #475569;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(71, 85, 105, .3)
}

/* éxito (verde hoja) */
.btn-outline-success {
    background: linear-gradient(135deg, var(--uhe-green), var(--uhe-green-dark));
    border: none;
    color: #fff
}

.btn-outline-success:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--uhe-green-dark), #165C37);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(32, 117, 72, .35)
}

.btn-outline-success:disabled {
    background: rgba(148, 163, 184, .3);
    color: rgba(100, 116, 139, .5);
    border: 1px solid rgba(148, 163, 184, .3)
}

/* peligro */
.btn-outline-danger {
    background: linear-gradient(135deg, #ef4444, var(--agro-danger));
    border: none;
    color: #fff
}

.btn-outline-danger:hover {
    background: linear-gradient(135deg, var(--agro-danger), #B91C1C);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(239, 68, 68, .4)
}

/* primario (verde institucional) */
.btn-primary {
    background: linear-gradient(135deg, var(--uhe-blue), var(--uhe-blue-dark));
    border: none;
    color: #fff
}

.btn-primary:hover {
    background: linear-gradient(135deg, #268854, #1B6D41)
}

/* informativo (cielo/agua) */
.btn-info {
    background: linear-gradient(135deg, var(--agro-sky), #227EAA);
    border: none;
    color: #fff
}

.btn-info:hover {
    background: linear-gradient(135deg, #227EAA, #1B6588)
}

/* ============ Hero compacto vistas internas (equipos-hero) ============ */
.equipos-hero {
    background: linear-gradient(135deg, #EAF6F0, #D8EFE3);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 3px 6px rgba(32, 117, 72, .12);
    flex-wrap: wrap;
    gap: .75rem;
}

.equipos-hero h1 {
    margin: 0;
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--uhe-blue-dark)
}

.equipos-hero small {
    display: block;
    margin-top: .25rem;
    font-size: .9rem;
    color: #556A5E
}

.equipos-hero .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: .5rem 1rem;
    background: var(--uhe-blue);
    border: none;
    box-shadow: 0 2px 4px rgba(32, 117, 72, .25);
    transition: transform .12s ease, box-shadow .12s ease
}

.equipos-hero .btn:hover {
    background: var(--uhe-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 10px rgba(32, 117, 72, .3)
}

@media (max-width: 576px) {
    .equipos-hero>div {
        width: 100%
    }

    .equipos-hero .btn {
        width: 100%
    }
}

/* ============ TABLAS (con DataTables scrollX) ============ */
.table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px
}

.table th {
    background: var(--grad-tableth);
    color: var(--uhe-blue-dark);
    font-weight: 600;
    border: none;
    padding: 14px 12px;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

.table td {
    border: none;
    padding: 14px 12px;
    vertical-align: middle;
    transition: background .2s ease;
    white-space: normal;
    word-break: break-word;
}

.table th.text-center,
.table td.text-center,
.table th.text-end,
.table td.text-end {
    white-space: nowrap
}

.table tbody tr:hover {
    background: #EDF7F0
}

@media (max-width: 576px) {
    .table tbody tr:hover {
        transform: none !important
    }

    .table .btn {
        padding: 6px 10px;
        font-size: .8rem
    }
}

/* ---- DataTables: scroll horizontal confiable ---- */
.dataTables_wrapper .dataTables_scrollHead {
    overflow: hidden
}

.dataTables_wrapper .dataTables_scrollHead table {
    margin: 0 !important
}

.dataTables_wrapper .dataTables_scrollBody {
    overflow-x: auto !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.dataTables_wrapper .dataTables_scrollBody table {
    margin: 0 !important
}

/* Opcional: mantener cabecera siempre visible con FixedHeader */
.fixedHeader-floating {
    z-index: 1030;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .08)
}

/* Si usas clase .nowrap en la tabla, fuerza no cortar contenido horizontal */
table.nowrap td,
table.nowrap th {
    white-space: nowrap
}

/* ============ Modales ============ */
.modal,
.modal-dialog,
.modal-content,
.modal * {
    pointer-events: auto !important
}

.modal-content {
    border: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, .98);
    backdrop-filter: blur(16px);
    box-shadow: 0 20px 40px rgba(32, 117, 72, .12)
}

.modal-header {
    background: linear-gradient(135deg, #F0F8F3, #E5F3EA);
    border: none;
    border-radius: 16px 16px 0 0
}

.modal-title {
    width: 100%;
    text-align: center;
    color: var(--uhe-blue);
    font-weight: 800
}

.modal-footer {
    border: none;
    background: #F2F7F4;
    border-radius: 0 0 16px 16px
}

.modal-footer .btn-secondary {
    background: #EEF2F0;
    color: #3C4B3E;
    border: 1px solid #D7E2D9;
    font-weight: 600
}

.modal-footer .btn-secondary:hover {
    background: #3C4B3E;
    color: #fff;
    border-color: #3C4B3E
}

.modal-footer .btn-success {
    background: linear-gradient(135deg, var(--uhe-green), var(--uhe-green-dark));
    border: none;
    font-weight: 700
}

.modal-footer .btn-success:hover {
    background: linear-gradient(135deg, var(--uhe-green-dark), #165C37)
}

.modal-body .form-label {
    color: var(--uhe-blue-dark);
    font-weight: 700
}

.modal-body .form-control {
    border: 2px solid rgba(148, 163, 184, .32);
    border-radius: 10px;
    padding: 12px 14px;
    transition: box-shadow .2s, border-color .2s;
    background: #fff;
}

.modal-body .form-control:focus {
    border-color: var(--uhe-blue);
    box-shadow: 0 0 0 3px rgba(42, 150, 89, .14)
}

.modal-body .input-group .btn.btn-outline-secondary {
    border-left: none
}

/* ============ Footer ============ */
.footer-uheval,
.footer-greenlinks {
    background: linear-gradient(180deg, var(--uhe-blue-dark) 0%, #155C37 100%);
    color: #F5F5F5;
    width: 100%;
    padding-top: 3rem;
    padding-bottom: 2rem;
    font-family: 'Poppins', sans-serif;
}

.footer-uheval h4,
.footer-greenlinks h4 {
    color: var(--uhe-gold) !important;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    text-transform: uppercase
}

.footer-uheval p,
.footer-uheval a,
.footer-uheval i,
.footer-uheval span,
.footer-greenlinks p,
.footer-greenlinks a,
.footer-greenlinks i,
.footer-greenlinks span {
    color: #E8F1EA !important;
    opacity: 1 !important;
    font-size: .95rem;
    transition: color .3s ease, opacity .3s ease
}

.footer-uheval a:hover,
.footer-greenlinks a:hover {
    color: var(--uhe-gold) !important;
    text-decoration: none
}

.footer-uheval .btn-outline-light,
.footer-greenlinks .btn-outline-light {
    border-color: var(--uhe-gold) !important;
    color: var(--uhe-gold) !important;
    margin-right: .5rem;
    transition: all .3s ease-in-out
}

.footer-uheval .btn-outline-light:hover,
.footer-greenlinks .btn-outline-light:hover {
    background-color: var(--uhe-gold) !important;
    color: var(--uhe-blue-dark) !important
}

.footer-uheval .border-top,
.footer-greenlinks .border-top {
    border-top: 1px solid rgba(255, 255, 255, .15);
    font-size: .85rem;
    color: #D1E2D5
}

.footer-uheval .link-item,
.footer-greenlinks .link-item {
    color: var(--uhe-gold) !important;
    font-weight: 600
}

.footer-uheval .link-item:hover,
.footer-greenlinks .link-item:hover {
    color: var(--uhe-gold-200) !important
}

.footer-uheval i,
.footer-greenlinks i {
    width: 1.25rem;
    text-align: center
}

@media (max-width: 576px) {

    .footer-uheval h4,
    .footer-greenlinks h4 {
        font-size: 1rem
    }

    .footer-uheval p,
    .footer-uheval a,
    .footer-uheval span,
    .footer-greenlinks p,
    .footer-greenlinks a,
    .footer-greenlinks span {
        font-size: .9rem
    }
}

/* ====== Team Members (scoped) ====== */
.tm-scope {
    --tm-blue: var(--uhe-blue, #2A9659);
    --tm-blue-dark: var(--uhe-blue-dark, #1F7446);
    --tm-blue-100: var(--uhe-blue-100, #E7F5EC);
    --tm-blue-50: #F3FAF6;
    --tm-accent: var(--agro-sky);

    --tm-grad-primary: linear-gradient(135deg, var(--tm-blue) 0%, var(--tm-blue-dark) 100%);
    --tm-grad-light: linear-gradient(135deg, var(--tm-blue-100) 0%, #D7EFDF 100%);

    --tm-card-shadow: 0 4px 6px -1px rgba(0, 0, 0, .08), 0 2px 4px -1px rgba(0, 0, 0, .05);
    --tm-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, .08), 0 4px 6px -2px rgba(0, 0, 0, .05);
    --tm-radius: 12px;
    --tm-transition: all .3s cubic-bezier(.4, 0, .2, 1);
}

/* Header compacto de la vista */
.tm-scope .tm-header {
    background: var(--tm-grad-light);
    padding: 20px;
    border-radius: var(--tm-radius);
    margin-bottom: 20px;
    border: 1px solid rgba(42, 150, 89, .12);
    transition: var(--tm-transition);
}

.tm-scope .tm-header:hover {
    transform: translateY(-2px);
    box-shadow: var(--tm-hover-shadow);
}

.tm-scope .tm-title {
    background: var(--tm-grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 6px;
}

/* Tarjetas */
.tm-scope .card {
    border: none;
    border-radius: var(--tm-radius);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(16px);
    transition: var(--tm-transition);
    overflow: hidden;
    box-shadow: var(--tm-card-shadow);
}

.tm-scope .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--tm-hover-shadow);
}

.tm-scope .card-header {
    background: var(--tm-grad-primary);
    color: #fff;
    border: none;
    font-weight: 600;
    padding: 14px 18px;
}

.tm-scope .card-body {
    padding: 16px;
}

.tm-scope .card-footer {
    background: var(--tm-blue-50);
    border: none;
    padding: 12px 16px;
}

/* Formularios breves dentro de la tarjeta */
.tm-scope .tm-inline-form .form-label {
    font-weight: 600;
    color: var(--tm-blue-dark);
    margin-bottom: 6px;
    font-size: 14px;
}

.tm-scope .tm-inline-form .form-control {
    border: 2px solid rgba(148, 163, 184, .3);
    border-radius: 10px;
    padding: 10px 12px;
    transition: var(--tm-transition);
    background: #fff;
    font-size: 14px;
}

.tm-scope .tm-inline-form .form-control:focus {
    border-color: var(--tm-blue);
    box-shadow: 0 0 0 3px rgba(42, 150, 89, .14);
}

/* DataTables: contenedores con scroll horizontal fiable */
.tm-scope .dt-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tm-scope table.dataTable.no-footer {
    border-bottom: none;
}

/* Responsive tweaks */
@media (min-width: 768px) {
    .tm-scope .tm-header {
        padding: 22px;
    }

    .tm-scope .tm-title {
        font-size: 1.8rem;
    }

    .tm-scope .card-body {
        padding: 18px;
    }
}

/* evita saltos cuando DataTables aplica scrollX */
.dataTables_wrapper .dataTables_scroll {
    overflow: auto;
}

/* Encabezado de secciones con chips */
.integrantes-header {
    background: linear-gradient(90deg, var(--uhe-blue-dark), var(--uhe-blue));
    /* verde degradado */
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    border-top-left-radius: .5rem;
    border-top-right-radius: .5rem;
    padding: .75rem 1rem;
}

.integrantes-header .badge {
    font-weight: 600;
    padding: 0.4em 0.75em;
}