/* =========================================================
   RESET GLOBAL DE HABYTAL
   IMPORTANTE:
   Esto NO debe ir en SuperMainLayout.razor.css porque ese
   archivo usa CSS isolation y no aplica bien sobre html/body.
   ========================================================= */

html,
body,
#app {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 100%;
    width: 100%;
    background: #eef2f7 !important;
}

body {
    overflow-x: hidden;
}

/* =========================================================
   RESET GLOBAL MUDLAYOUT
   Elimina la franja blanca/gris superior antes del topbar.
   ========================================================= */

.mud-layout,
.mud-main-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
/* =========================================================
   1. TIPOGRAFÍA GLOBAL
   ========================================================= */
html,
body {
    font-family: 'Poppins', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
}


/* =========================================================
   2. ACCESIBILIDAD Y ENFOQUE
   ========================================================= */
h1:focus {
    outline: none;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}


/* =========================================================
   3. ENLACES Y BOTONES GENERALES
   ========================================================= */
a,
.btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}


/* =========================================================
   4. LAYOUT GENERAL
   ========================================================= */
.auth-layout {
    min-height: 100vh;
    width: 100%;
}

.content {
    padding-top: 1.1rem;
}


/* =========================================================
   5. VALIDACIONES DE FORMULARIOS
   ========================================================= */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
    font-size: 0.85rem;
    margin-top: 4px;
}


/* =========================================================
   6. UI DE ERROR DE BLAZOR
   ========================================================= */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }


/* =========================================================
   7. INDICADOR DE CARGA
   ========================================================= */
.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }


/* =========================================================
   8. CÓDIGO Y TEXTO ESPECIAL
   ========================================================= */
code {
    color: #c02d76;
}


/* =========================================================
   9. FORM FLOATING
   ========================================================= */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}


/* =========================================================
   10. LOGIN PAGE - CONTENEDOR PRINCIPAL
   ========================================================= */
.login-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: linear-gradient(rgba(20, 34, 108, 0.16), rgba(20, 34, 108, 0.16)), url('/images/Fondo.png') center center / cover no-repeat;
}


/* =========================================================
   11. LOGIN CONTAINER
   ========================================================= */
.login-container {
    width: 100%;
    max-width: 540px;
    display: flex;
    flex-direction: column;
    align-items: center;
}


/* =========================================================
   12. LOGO SUPERIOR
   ========================================================= */
.login-logo {
    margin-bottom: 22px;
    text-align: center;
}

    .login-logo img {
        width: 340px;
        max-width: 100%;
        height: auto;
        display: block;
    }


/* =========================================================
   13. TARJETA DEL LOGIN
   ========================================================= */
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 34px 30px 26px 30px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 38px rgba(8, 16, 64, 0.24), 0 4px 10px rgba(8, 16, 64, 0.10);
    backdrop-filter: blur(3px);
}


/* =========================================================
   14. HEADER DEL LOGIN
   ========================================================= */
.login-header {
    text-align: center;
    margin-bottom: 24px;
}

    .login-header h1 {
        margin: 0;
        font-size: 2.25rem;
        font-weight: 800;
        line-height: 1.1;
        color: #1c2d68;
    }

    .login-header p {
        margin: 10px 0 0;
        font-size: 1rem;
        color: #69779b;
        font-weight: 500;
    }


/* =========================================================
   15. FORMULARIO
   ========================================================= */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}


/* =========================================================
   16. OPCIONES LOGIN
   ========================================================= */
.login-options {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.remember-me {
    margin-right: auto;
    color: #38476f;
    font-weight: 600;
    font-size: 0.98rem;
}

.forgot-link {
    color: #5e79bb;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

    .forgot-link:hover {
        text-decoration: underline;
    }


/* =========================================================
   17. BOTÓN LOGIN
   ========================================================= */
.login-button {
    height: 50px;
    border-radius: 8px;
    text-transform: none;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0;
    background: linear-gradient(90deg, #3d8cff 0%, #165ae5 100%) !important;
    box-shadow: 0 6px 18px rgba(27, 91, 224, 0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

    .login-button:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 22px rgba(27, 91, 224, 0.40);
    }


/* =========================================================
   18. DIVISOR
   ========================================================= */
.login-divider {
    margin-top: 6px;
    height: 1px;
    background: #e9e9ef;
}


/* =========================================================
   19. FOOTER LOGIN
   ========================================================= */
.login-footer {
    text-align: center;
    color: #4d587d;
    font-weight: 500;
    font-size: 0.98rem;
}

    .login-footer a {
        color: #355fd0;
        font-weight: 700;
        text-decoration: none;
    }

        .login-footer a:hover {
            text-decoration: underline;
        }


/* =========================================================
   20. AJUSTES VISUALES PARA INPUTS MUD
   ========================================================= */
::deep .login-input .mud-input-control {
    margin-top: 0 !important;
}

::deep .login-input .mud-input-slot {
    min-height: 50px;
}

::deep .login-input .mud-input-root {
    background: #ffffff !important;
    border-radius: 8px;
}

::deep .login-input .mud-input-root-outlined {
    border-radius: 8px;
}

::deep .login-input input {
    color: #445174 !important;
    font-weight: 500;
    font-size: 1rem;
}

::deep .login-input .mud-input-label {
    color: #7b86a5 !important;
    font-weight: 500;
}

::deep .login-input .mud-input-adornment {
    color: #6f7ca5 !important;
}

::deep .login-input .mud-input-outlined-border {
    border-color: #d7dbe8 !important;
}

::deep .login-input:hover .mud-input-outlined-border {
    border-color: #b9c3df !important;
}

::deep .login-input.mud-input-focused .mud-input-outlined-border,
::deep .login-input .mud-input-root.mud-input-focused .mud-input-outlined-border {
    border-color: #4a7dff !important;
    border-width: 2px !important;
}


/* =========================================================
   21. CHECKBOX MUD
   ========================================================= */
::deep .login-options .mud-checkbox {
    margin: 0;
}

::deep .login-options .mud-button-root {
    padding: 0;
}

::deep .login-options .mud-icon-button-label {
    color: #3d8cff;
}


/* =========================================================
   22. RESPONSIVE
   ========================================================= */
@media (max-width: 600px) {
    .login-page {
        padding: 24px 12px;
        background-position: center;
    }

    .login-logo {
        margin-bottom: 18px;
    }

        .login-logo img {
            width: 260px;
        }

    .login-card {
        max-width: 100%;
        padding: 26px 18px 22px 18px;
        border-radius: 16px;
    }

    .login-header h1 {
        font-size: 1.95rem;
    }

    .login-header p {
        font-size: 0.95rem;
    }

    .login-options {
        gap: 6px;
    }

    .forgot-link {
        width: 100%;
        text-align: right;
        margin-top: 4px;
    }
}


/* =========================================================
   HABYTAL CHARTS - FIX GLOBAL LABELS DARK/LIGHT
   Soluciona etiquetas ocultas de ejes y leyendas sin tocar
   la lógica de los componentes ni la estructura del dashboard.
   ========================================================= */

:root,
.habytal-shell.light-mode,
.habytal-light-charts {
    --habytal-chart-text: #0f172a;
    --habytal-chart-muted: #475569;
    --habytal-chart-axis: #0f172a;
    --habytal-chart-grid: rgba(15, 23, 42, 0.14);
    --habytal-chart-tooltip-bg: #ffffff;
    --habytal-chart-tooltip-text: #0f172a;
}

.habytal-shell.dark-mode,
.habytal-dark-charts,
.mud-theme-dark,
.dark,
[data-theme="dark"] {
    --habytal-chart-text: #ffffff;
    --habytal-chart-muted: #f8fafc;
    --habytal-chart-axis: #ffffff;
    --habytal-chart-grid: rgba(248, 250, 252, 0.30);
    --habytal-chart-tooltip-bg: #0f172a;
    --habytal-chart-tooltip-text: #ffffff;
}

.habytal-shell.dark-mode .apexcharts-text,
.habytal-shell.dark-mode .apexcharts-xaxis text,
.habytal-shell.dark-mode .apexcharts-yaxis text,
.habytal-shell.dark-mode .apexcharts-xaxis-label,
.habytal-shell.dark-mode .apexcharts-yaxis-label,
.habytal-shell.dark-mode .apexcharts-legend-text,
.habytal-shell.dark-mode .apexcharts-datalabel,
.habytal-shell.dark-mode .apexcharts-title-text,
.habytal-shell.dark-mode .apexcharts-subtitle-text,
.habytal-dark-charts .apexcharts-text,
.habytal-dark-charts .apexcharts-xaxis text,
.habytal-dark-charts .apexcharts-yaxis text,
.habytal-dark-charts .apexcharts-xaxis-label,
.habytal-dark-charts .apexcharts-yaxis-label,
.habytal-dark-charts .apexcharts-legend-text,
.habytal-dark-charts .apexcharts-datalabel,
.habytal-dark-charts .apexcharts-title-text,
.habytal-dark-charts .apexcharts-subtitle-text {
    fill: #ffffff !important;
    color: #ffffff !important;
    opacity: 1 !important;
}

.habytal-shell.light-mode .apexcharts-text,
.habytal-shell.light-mode .apexcharts-xaxis text,
.habytal-shell.light-mode .apexcharts-yaxis text,
.habytal-shell.light-mode .apexcharts-xaxis-label,
.habytal-shell.light-mode .apexcharts-yaxis-label,
.habytal-shell.light-mode .apexcharts-legend-text,
.habytal-shell.light-mode .apexcharts-datalabel,
.habytal-shell.light-mode .apexcharts-title-text,
.habytal-shell.light-mode .apexcharts-subtitle-text,
.habytal-light-charts .apexcharts-text,
.habytal-light-charts .apexcharts-xaxis text,
.habytal-light-charts .apexcharts-yaxis text,
.habytal-light-charts .apexcharts-xaxis-label,
.habytal-light-charts .apexcharts-yaxis-label,
.habytal-light-charts .apexcharts-legend-text,
.habytal-light-charts .apexcharts-datalabel,
.habytal-light-charts .apexcharts-title-text,
.habytal-light-charts .apexcharts-subtitle-text {
    fill: #0f172a !important;
    color: #0f172a !important;
    opacity: 1 !important;
}

.habytal-shell.dark-mode .apexcharts-gridline,
.habytal-shell.dark-mode .apexcharts-xaxis line,
.habytal-shell.dark-mode .apexcharts-yaxis line,
.habytal-shell.dark-mode .apexcharts-xaxis-tick,
.habytal-dark-charts .apexcharts-gridline,
.habytal-dark-charts .apexcharts-xaxis line,
.habytal-dark-charts .apexcharts-yaxis line,
.habytal-dark-charts .apexcharts-xaxis-tick {
    stroke: rgba(248, 250, 252, 0.30) !important;
    opacity: 0.9 !important;
}

.habytal-shell.light-mode .apexcharts-gridline,
.habytal-shell.light-mode .apexcharts-xaxis line,
.habytal-shell.light-mode .apexcharts-yaxis line,
.habytal-shell.light-mode .apexcharts-xaxis-tick,
.habytal-light-charts .apexcharts-gridline,
.habytal-light-charts .apexcharts-xaxis line,
.habytal-light-charts .apexcharts-yaxis line,
.habytal-light-charts .apexcharts-xaxis-tick {
    stroke: rgba(15, 23, 42, 0.14) !important;
    opacity: 0.9 !important;
}

.habytal-shell.dark-mode .tenant-donut-chart__legend-label,
.habytal-shell.dark-mode .tenant-donut-chart__legend-value,
.habytal-dark-charts .tenant-donut-chart__legend-label,
.habytal-dark-charts .tenant-donut-chart__legend-value {
    color: #ffffff !important;
    opacity: 1 !important;
}

.habytal-shell.dark-mode .tenant-donut-chart__legend-value span,
.habytal-dark-charts .tenant-donut-chart__legend-value span {
    color: #e2e8f0 !important;
    opacity: 1 !important;
}

.habytal-shell.light-mode .tenant-donut-chart__legend-label,
.habytal-shell.light-mode .tenant-donut-chart__legend-value,
.habytal-light-charts .tenant-donut-chart__legend-label,
.habytal-light-charts .tenant-donut-chart__legend-value {
    color: #0f172a !important;
    opacity: 1 !important;
}

.habytal-shell.light-mode .tenant-donut-chart__legend-value span,
.habytal-light-charts .tenant-donut-chart__legend-value span {
    color: #475569 !important;
    opacity: 1 !important;
}

.habytal-shell.dark-mode .apexcharts-tooltip,
.habytal-dark-charts .apexcharts-tooltip,
.habytal-shell.dark-mode .apexcharts-tooltip-title,
.habytal-dark-charts .apexcharts-tooltip-title {
    background: #0f172a !important;
    color: #ffffff !important;
    border-color: rgba(248, 250, 252, 0.24) !important;
}

.habytal-shell.light-mode .apexcharts-tooltip,
.habytal-light-charts .apexcharts-tooltip,
.habytal-shell.light-mode .apexcharts-tooltip-title,
.habytal-light-charts .apexcharts-tooltip-title {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: rgba(15, 23, 42, 0.14) !important;
}

.apexcharts-tooltip *,
.apexcharts-tooltip-title {
    color: var(--habytal-chart-tooltip-text) !important;
}
