﻿/* ==========================================================================
   Aurora Web - Capa responsive comun
   Se carga despues de Bootstrap 5.3 en todas las master pages.
   1) Estructura (barra superior, menu lateral, contenido, pie)
   2) Adaptacion automatica del contenido "legado" (tablas, GridView,
      controles con ancho fijo, AjaxControlToolkit, Crystal Reports)
   ========================================================================== */

:root {
    --aurora-verde: #14532d;
    --aurora-verde-2: #166534;
    --aurora-verde-claro: #dcfce7;
    --aurora-azul: #1f3a68;
    --aurora-rojo: #b91c1c;
    --aurora-amarillo: #facc15;
    --aurora-fondo: #f3f5f4;
    --aurora-borde: #d9dfdb;
    --aurora-texto: #1f2937;
    --aurora-sidebar-ancho: 264px;
    --aurora-topbar-alto: 60px;
    --aurora-radio: .6rem;
}

/* --------------------------------------------------------------------------
   1. ESTRUCTURA
   -------------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }

body.aurora {
    background: var(--aurora-fondo);
    color: var(--aurora-texto);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: .95rem;
    min-height: 100vh;
}

/* Barra superior ---------------------------------------------------------- */
.aurora-topbar {
    position: sticky;
    top: 0;
    z-index: 1040;
    height: var(--aurora-topbar-alto);
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 0 .75rem;
    background: var(--aurora-verde);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}

.aurora-btn-menu {
    border: 0;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: .5rem;
    font-size: 1.2rem;
    flex: 0 0 auto;
}
.aurora-btn-menu:hover, .aurora-btn-menu:focus { background: rgba(255, 255, 255, .22); color: #fff; }

.aurora-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
    flex: 0 0 auto;
}
.aurora-brand:hover { color: #fff; }
.aurora-brand img {
    height: 42px;
    width: 42px;
    object-fit: contain;
    background: #fff;
    border-radius: .5rem;
    padding: 2px;
}

.aurora-quick {
    display: flex;
    align-items: stretch;
    gap: .15rem;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
    min-width: 0;
}
.aurora-quick::-webkit-scrollbar { display: none; }
.aurora-quick a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 64px;
    padding: .25rem .55rem;
    border-radius: .5rem;
    color: #fff;
    text-decoration: none;
    font-size: .72rem;
    line-height: 1.1;
    white-space: nowrap;
}
.aurora-quick a i { font-size: 1.15rem; }
.aurora-quick a:hover, .aurora-quick a.active { background: rgba(255, 255, 255, .14); }

.aurora-user {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    font-size: .85rem;
    white-space: nowrap;
    flex: 0 0 auto;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aurora-user span { overflow: hidden; text-overflow: ellipsis; }

/* Contenedor principal ---------------------------------------------------- */
.aurora-shell {
    display: flex;
    min-height: calc(100vh - var(--aurora-topbar-alto));
}

.aurora-content {
    flex: 1 1 auto;
    min-width: 0;            /* permite que las tablas anchas hagan scroll en vez de romper el layout */
    padding: 1.25rem;
}

.aurora-footer {
    padding: .75rem 1.25rem;
    font-size: .8rem;
    color: #6b7280;
    border-top: 1px solid var(--aurora-borde);
    background: #fff;
}

/* Menu lateral (offcanvas en movil, fijo en escritorio) ------------------- */
.aurora-sidebar {
    --bs-offcanvas-width: 290px;
    --bs-offcanvas-bg: var(--aurora-verde);
    --bs-offcanvas-color: #e7f3eb;
    background: var(--aurora-verde);
    color: #e7f3eb;
}
.aurora-sidebar .offcanvas-header { border-bottom: 1px solid rgba(255, 255, 255, .12); }
.aurora-sidebar .offcanvas-title { color: #fff; font-weight: 600; }

.aurora-sidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .75rem;
}

@media (min-width: 992px) {
    .aurora-sidebar,
    .aurora-sidebar.offcanvas-lg {
        background-color: var(--aurora-verde) !important;
        position: sticky;
        top: var(--aurora-topbar-alto);
        width: var(--aurora-sidebar-ancho);
        flex: 0 0 var(--aurora-sidebar-ancho);
        height: calc(100vh - var(--aurora-topbar-alto));
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, .25) transparent;
    }
    .aurora-sidebar .offcanvas-body {
        display: flex !important;
        flex-direction: column;
        padding: .75rem !important;
        overflow-y: visible;
    }
    /* Escritorio: el boton hamburguesa oculta / muestra el menu */
    body.aurora-menu-oculto .aurora-sidebar { display: none; }
}

.aurora-filtro {
    position: relative;
}
.aurora-filtro i {
    position: absolute;
    left: .7rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, .6);
    font-size: .85rem;
}
.aurora-filtro input {
    width: 100%;
    padding: .5rem .75rem .5rem 2rem;
    border-radius: .5rem;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: .9rem;
}
.aurora-filtro input::placeholder { color: rgba(255, 255, 255, .6); }
.aurora-filtro input:focus { outline: none; border-color: var(--aurora-amarillo); background: rgba(255, 255, 255, .14); }

.aurora-sidebar .accordion {
    --bs-accordion-bg: transparent;
    --bs-accordion-color: #e7f3eb;
    --bs-accordion-border-width: 0;
    --bs-accordion-btn-color: #fff;
    --bs-accordion-btn-bg: transparent;
    --bs-accordion-active-color: #fff;
    --bs-accordion-active-bg: rgba(255, 255, 255, .1);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 .15rem rgba(250, 204, 21, .45);
    --bs-accordion-btn-padding-x: .75rem;
    --bs-accordion-btn-padding-y: .6rem;
    --bs-accordion-body-padding-x: 0;
    --bs-accordion-body-padding-y: .25rem;
}
.aurora-sidebar .accordion-item { border-radius: .5rem; overflow: hidden; margin-bottom: 2px; }
.aurora-sidebar .accordion-button {
    font-size: .9rem;
    font-weight: 600;
    border-radius: .5rem !important;
    gap: .55rem;
}
.aurora-sidebar .accordion-button i { width: 1.2rem; text-align: center; color: var(--aurora-amarillo); }
.aurora-sidebar .accordion-button::after { filter: brightness(0) invert(1); opacity: .8; transform: scale(.8); }
.aurora-sidebar .accordion-button:not(.collapsed)::after { transform: scale(.8) rotate(-180deg); }
.aurora-sidebar .accordion-button:hover { background: rgba(255, 255, 255, .07); }

.aurora-sidebar .nav-link {
    display: block;
    color: #d5eadb;
    font-size: .84rem;
    padding: .38rem .75rem .38rem 2.35rem;
    border-radius: .4rem;
    line-height: 1.25;
}
.aurora-sidebar .nav-link:hover,
.aurora-sidebar .nav-link:focus { background: rgba(255, 255, 255, .09); color: #fff; }
.aurora-sidebar .nav-link.active {
    background: rgba(250, 204, 21, .18);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--aurora-amarillo);
}
.aurora-sin-resultados { display: none; font-size: .85rem; color: rgba(255, 255, 255, .7); padding: .5rem .75rem; }

/* Menu basado en Web.sitemap (asp:Menu RenderingMode="List") ------------- */
.aurora-sitemenu ul { list-style: none; margin: 0; padding: 0; }
.aurora-sitemenu a { display: block; text-decoration: none; }
.aurora-sitemenu a:empty { display: none !important; }      /* items ocultados por rol (Text = "") */
.aurora-sitemenu a.level1 {
    color: #fff; font-weight: 600; font-size: .9rem;
    padding: .55rem .75rem; border-radius: .5rem;
}
.aurora-sitemenu a.level1:hover { background: rgba(255, 255, 255, .08); }
.aurora-sitemenu a.level2 {
    position: relative;
    color: #fff; font-weight: 600; font-size: .9rem;
    padding: .55rem 2rem .55rem .75rem; border-radius: .5rem; margin-top: 2px;
}
.aurora-sitemenu a.level2:hover { background: rgba(255, 255, 255, .08); }
.aurora-sitemenu li.aurora-grupo > a.level2::after {
    content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900;
    position: absolute; right: .8rem; top: 50%; transform: translateY(-50%);
    font-size: .7rem; opacity: .75; transition: transform .2s;
}
.aurora-sitemenu li.aurora-grupo.abierto > a.level2 { background: rgba(255, 255, 255, .1); }
.aurora-sitemenu li.aurora-grupo.abierto > a.level2::after { transform: translateY(-50%) rotate(180deg); }
.aurora-sitemenu li.aurora-grupo > ul { display: none; padding: .2rem 0; }
.aurora-sitemenu li.aurora-grupo.abierto > ul,
.aurora-sitemenu.filtrando li.aurora-grupo > ul { display: block; }
.aurora-sitemenu a.level3 {
    color: #d5eadb; font-size: .84rem; padding: .38rem .75rem .38rem 1.6rem; border-radius: .4rem;
}
.aurora-sitemenu a.level3:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.aurora-sitemenu a.active { background: rgba(250, 204, 21, .18); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--aurora-amarillo); }
.aurora-sitemenu .skip-link, .aurora-sitemenu img[alt^="Skip"] { display: none; }

/* --------------------------------------------------------------------------
   2. CONTENIDO LEGADO (se aplica a todas las paginas existentes sin tocarlas)
   -------------------------------------------------------------------------- */
.aurora-legacy {
    background: #fff;
    border: 1px solid var(--aurora-borde);
    border-radius: var(--aurora-radio);
    padding: 1.1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.aurora-legacy img { max-width: 100%; height: auto; }
.aurora-legacy table { max-width: 100%; }
.aurora-legacy p { margin-bottom: .6rem; }

/* Campos de formulario con aspecto moderno (los colores inline del sitio se respetan) */
.aurora-legacy input[type="text"],
.aurora-legacy input[type="password"],
.aurora-legacy input[type="number"],
.aurora-legacy input[type="email"],
.aurora-legacy input[type="date"],
.aurora-legacy input:not([type]),
.aurora-legacy select,
.aurora-legacy textarea {
    max-width: 100%;
    min-height: 34px;
    padding: .3rem .55rem;
    border: 1px solid #c9d1cc;
    border-radius: .4rem;
    font-size: .92rem;
    transition: border-color .15s, box-shadow .15s;
}
.aurora-legacy textarea { min-height: 60px; }
.aurora-legacy input[type="text"]:focus,
.aurora-legacy input[type="password"]:focus,
.aurora-legacy input:not([type]):focus,
.aurora-legacy select:focus,
.aurora-legacy textarea:focus {
    outline: none;
    border-color: var(--aurora-verde-2);
    box-shadow: 0 0 0 .2rem rgba(22, 101, 52, .18);
}
.aurora-legacy input[disabled], .aurora-legacy input[readonly], .aurora-legacy select[disabled] { background-color: #f1f3f2; }

.aurora-legacy input[type="submit"],
.aurora-legacy input[type="button"],
.aurora-legacy input[type="reset"],
.aurora-legacy button:not(.btn):not(.accordion-button):not(.btn-close) {
    min-height: 36px;
    padding: .35rem .9rem;
    border: 1px solid #b9c4bd;
    border-radius: .45rem;
    background-color: #f8faf9;
    color: var(--aurora-texto);
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s, box-shadow .15s;
}
.aurora-legacy input[type="submit"]:hover,
.aurora-legacy input[type="button"]:hover { background-color: #e9efeb; }
.aurora-legacy input[type="submit"]:focus-visible,
.aurora-legacy input[type="button"]:focus-visible { outline: none; box-shadow: 0 0 0 .2rem rgba(22, 101, 52, .25); }
.aurora-legacy input[type="submit"][disabled],
.aurora-legacy input[type="button"][disabled] { opacity: .55; cursor: not-allowed; }
.aurora-legacy input[type="image"] { max-width: 100%; height: auto; }

/* Tablas de datos (GridView, DetailsView, etc.) envueltas por aurora.js */
.aurora-grid {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: .75rem;
    border-radius: .45rem;
}
.aurora-grid > table { margin-bottom: 0; }
.aurora-grid > table td,
.aurora-grid > table th { padding: .35rem .55rem; vertical-align: middle; }
.aurora-grid > table th { white-space: nowrap; }

/* AjaxControlToolkit */
.aurora-legacy .ajax__tab_container { max-width: 100%; }
.aurora-legacy .ajax__tab_header { white-space: normal !important; }
.aurora-legacy .ajax__tab_body { overflow: auto; }
.aurora-legacy .ajax__calendar_container { z-index: 1050 !important; }

/* Crystal Reports / ReportViewer: scroll horizontal dentro del contenido */
.aurora-legacy [id*="CrystalReportViewer"],
.aurora-legacy [id*="ReportViewer"] { max-width: 100%; overflow: auto; }

/* Popups simples */
.aurora-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 520px);
    background: #fffbea;
    border: 1px solid #f2d675;
    border-left: 5px solid var(--aurora-amarillo);
    border-radius: var(--aurora-radio);
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    z-index: 2000;
    text-align: left;
    font-size: 1rem;
}

/* ---- Tablet y movil (< 992px): todo cabe en el ancho de la pantalla ---- */
@media (max-width: 991.98px) {
    .aurora-content { padding: .9rem; }
    .aurora-legacy [style*="width"]:not(.aurora-keep) { max-width: 100% !important; }
    .aurora-legacy table[width], .aurora-legacy table[style*="width"] { width: 100% !important; }
    .aurora-legacy .ajax__tab_container,
    .aurora-legacy .ajax__tab_body { width: auto !important; height: auto !important; }
    .aurora-user { display: none; }
}

/* ---- Movil (< 768px): las tablas de "maquetacion" se apilan ---- */
@media (max-width: 767.98px) {
    body.aurora { font-size: .95rem; }
    .aurora-content { padding: .6rem; }
    .aurora-legacy { padding: .8rem; border-radius: .5rem; }
    .aurora-quick a { min-width: 44px; padding: .25rem .4rem; }
    .aurora-quick a span { display: none; }
    .aurora-brand span { display: none; }

    /* iOS hace zoom en campos con letra < 16px */
    .aurora-legacy input[type="text"],
    .aurora-legacy input[type="password"],
    .aurora-legacy input:not([type]),
    .aurora-legacy select,
    .aurora-legacy textarea { font-size: 16px; }

    table.aurora-form,
    table.aurora-form > tbody,
    table.aurora-form > tbody > tr,
    table.aurora-form > tbody > tr > td,
    table.aurora-form > tr,
    table.aurora-form > tr > td {
        display: block;
        width: 100% !important;
        height: auto !important;
    }
    table.aurora-form > tbody > tr > td,
    table.aurora-form > tr > td { padding: .2rem 0 !important; text-align: left !important; }
    table.aurora-form > tbody > tr > td,
    table.aurora-form > tr > td { margin-left: 0 !important; margin-right: 0 !important; }
    table.aurora-form > tbody > tr > td.aurora-vacia,
    table.aurora-form > tr > td.aurora-vacia { display: none; }

    table.aurora-form input[type="text"],
    table.aurora-form input[type="password"],
    table.aurora-form input:not([type]),
    table.aurora-form select,
    table.aurora-form textarea { width: 100% !important; }

    /* Los validadores (*) quedan junto al campo */
    table.aurora-form span[style*="color:Red"],
    table.aurora-form span[style*="color: Red"] { display: inline-block; }
}

/* --------------------------------------------------------------------------
   3. PANTALLA DE ACCESO (MasterPage2) y paginas de inicio
   -------------------------------------------------------------------------- */
body.aurora-login { background: #fff; }

.aurora-login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background: #fff;
}
.aurora-login-card { width: 100%; max-width: 380px; }
.aurora-login-card .logo { width: 84px; height: 84px; object-fit: contain; }
.aurora-login-card h1 { font-size: 1.6rem; font-weight: 700; color: var(--aurora-azul); }
.aurora-login-card .form-control { padding: .65rem .85rem; font-size: 1rem; }
.aurora-login-card .form-control:focus { border-color: var(--aurora-verde-2); box-shadow: 0 0 0 .2rem rgba(22, 101, 52, .18); }
.aurora-login-card .btn-aurora { padding: .65rem; font-size: 1rem; }

.btn-aurora {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--aurora-verde);
    --bs-btn-border-color: var(--aurora-verde);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--aurora-verde-2);
    --bs-btn-hover-border-color: var(--aurora-verde-2);
    --bs-btn-active-bg: #0f3f22;
    --bs-btn-focus-shadow-rgb: 22, 101, 52;
    font-weight: 600;
}

.aurora-login-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background:
        radial-gradient(circle at 20% 20%, rgba(250, 204, 21, .18), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(185, 28, 28, .14), transparent 45%),
        linear-gradient(135deg, var(--aurora-verde) 0%, #0f3f22 100%);
    color: #fff;
}
.aurora-login-hero h1, .aurora-login-hero h2, .aurora-login-hero h3 { color: #fff; }
.aurora-login-hero .aurora-hero-contenido {
    width: 100%;
    max-width: 680px;
    text-align: center;
}
.aurora-login-hero img { max-width: 100%; height: auto; }
.aurora-hero-img {
    width: min(78%, 460px);
    border-radius: 50%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.aurora-login-hero .aurora-hero-contenido > .aurora-legacy { color: var(--aurora-texto); text-align: left; }

@media (max-width: 991.98px) {
    .aurora-login-hero { padding: 1.5rem 1rem; }
    .aurora-hero-img { width: min(60%, 260px); }
}

/* Panel de inicio (Default2.aspx) */
.aurora-bienvenida {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: var(--aurora-radio);
    background: linear-gradient(120deg, var(--aurora-verde) 0%, #1f6b3d 100%);
    color: #fff;
    margin-bottom: 1rem;
}
.aurora-bienvenida img { width: 72px; height: 72px; border-radius: 50%; background: #fff; object-fit: cover; flex: 0 0 auto; }
.aurora-bienvenida h1 { font-size: 1.35rem; margin: 0; font-weight: 700; color: #fff; }
.aurora-bienvenida p { margin: .15rem 0 0; opacity: .85; }

.aurora-tile {
    display: flex;
    align-items: center;
    gap: .8rem;
    height: 100%;
    padding: .9rem 1rem;
    border-radius: var(--aurora-radio);
    background: #fff;
    border: 1px solid var(--aurora-borde);
    color: var(--aurora-texto);
    text-decoration: none;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.aurora-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .08); border-color: #9cc5aa; color: var(--aurora-texto); }
.aurora-tile i {
    width: 44px; height: 44px; flex: 0 0 44px;
    display: grid; place-items: center;
    border-radius: .6rem;
    background: var(--aurora-verde-claro);
    color: var(--aurora-verde);
    font-size: 1.15rem;
}
.aurora-tile strong { display: block; font-size: .95rem; }
.aurora-tile small { color: #6b7280; }

/* --------------------------------------------------------------------------
   4. IMPRESION
   -------------------------------------------------------------------------- */
@media print {
    .aurora-topbar, .aurora-sidebar, .aurora-footer, .aurora-btn-menu { display: none !important; }
    .aurora-shell { display: block; }
    .aurora-content { padding: 0; }
    .aurora-legacy { border: 0; box-shadow: none; padding: 0; }
    .aurora-grid { overflow: visible; }
    body.aurora { background: #fff; }
}

/* Iconos del modulo TFM (antes /fonts/style.css, que no existe) -> Font Awesome */
.icon { font-style: normal; }
.icon::before { font-family: "Font Awesome 6 Free"; font-weight: 900; display: inline-block; margin-right: .25rem; }
.icon-rocket::before { content: "\f135"; }
.icon-stats-bars::before { content: "\f080"; }
.icon-user::before { content: "\f007"; }
.icon-home::before { content: "\f015"; }
.icon-forward::before { content: "\f04e"; }
