﻿/* ========================================= */
/* 1. CONFIGURACIÓN GLOBAL                   */
/* ========================================= */
html, body {
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background-color: #f5f7fa;
    overscroll-behavior: none;
}


/* ========================================= */
/* 2. ESTILOS GENERALES                      */
/* ========================================= */
a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    color: white;
    padding: 1rem;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: #6c757d;
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ========================================= */
/* 3. LANDING PAGE                           */
/* ========================================= */
.landing-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100dvh; 
    width: 100vw;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 2vh 4vw;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 20;
}

/* Centrar títulos en la Landing para Mobile */
@media (max-width: 768px) {
    /* Centrado total para la landing */
    .app-title, .app-subtitle {
        text-align: center !important;
        width: 100% !important;
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Ajuste de margen para que no queden pegados */
    .app-title {
        margin-top: 20px;
        margin-bottom: 5px;
        font-weight: bold;
    }

    .app-subtitle {
        margin-top: 0;
        color: #666;
    }
}

.header-top {
    display: flex;
    justify-content: flex-end;
    flex-basis: 10%;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: clamp(1.5rem, 5vh, 2.5rem);
    padding: 0;
    cursor: pointer;
    color: #555;
}

.content-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.app-logo {
    height: 20vh;
    width: auto;
    margin-bottom: 2vh;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.2));
}

.app-title {
    font-size: clamp(1.2rem, 6vh, 3rem);
    color: #2c3e50;
    margin: 0;
    font-weight: 800;
    line-height: 1.1;
    outline: none !important;
    box-shadow: none !important;
}

.app-subtitle {
    font-size: clamp(0.8rem, 3vh, 1.5rem);
    color: #7f8c8d;
    margin-bottom: 4vh;
}

.main-actions {
    display: flex;
    gap: 2vw;
    width: 100%;
    max-width: 500px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-grande {
    height: 8vh;
    min-height: 40px;
    padding: 0 20px;
    font-size: clamp(0.9rem, 2.5vh, 1.5rem);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    flex: 1 1 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 0.5vh 1vh rgba(0,0,0,0.1);
}

    .btn-grande.btn-primary {
        background-color: #007bff;
        color: white;
    }

    .btn-grande.btn-secondary {
        background-color: white;
        color: #333;
        border: 1px solid #ddd;
    }

.footer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex-basis: 25%;
    width: 100%;
    gap: 15px;
    margin-top: 10px;
    padding-bottom: 10px;
}

.btn-login {
    background: white;
    border: 1px solid #ccc;
    height: 6vh;
    min-height: 35px;
    border-radius: 3vh;
    font-size: clamp(0.7rem, 2.2vh, 1.2rem);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    width: auto;
    min-width: 200px;
    justify-content: center;
    color: #555;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.legal-links {
    font-size: clamp(0.6rem, 1.8vh, 1rem);
    margin-top: 0.5vh;
}

    .legal-links a {
        color: #666;
        text-decoration: none;
        margin: 0 5px;
    }

.version-text {
    font-size: clamp(0.5rem, 1.5vh, 0.8rem);
    color: #aaa;
    margin: 0;
}

/* ========================================= */
/* 4. EDITOR DE CROQUIS                      */
/* ========================================= */
.editor-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100vw;
    background-color: #333;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 1;
}

.editor-top-bar {
    height: 50px;
    flex: 0 0 50px;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
}

.top-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #0056b3;
    margin: 0;
}

/* LAYOUT FLEXIBLE */
.cuerpo-central-flex {
    flex: 1;
    min-height: 0;
    position: relative;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .cuerpo-central-flex {
        flex-direction: row;
        overflow: visible;
    }
}

#canvas-wrapper {
    flex-grow: 1;
    width: 100%;
    background-color: #f0f0f0;
    position: relative;
    overflow: hidden;
}

/* BARRA INFERIOR */
.editor-bottom-bar {
    height: 55px;
    flex: 0 0 55px;
    background-color: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 2px 5px;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    position: relative;
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: content-box;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #555;
    font-size: 0.65rem;
    gap: 2px;
    width: 60px;
    height: 100%;
    border-radius: 8px;
    position: relative;
}

    .tool-btn:active {
        background-color: #f0f0f0;
        transform: scale(0.95);
    }

.tool-icon {
    font-size: 1.3rem;
}

@media (min-width: 768px) {
    .editor-bottom-bar {
        height: 60px;
        flex: 0 0 60px;
        padding: 5px;
    }

    .tool-btn {
        width: 70px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .tool-icon {
        font-size: 1.5rem;
    }
}

/* --- AJUSTES TOP BAR MÓVIL --- */
@media (max-width: 768px) {
    .top-title {
        font-size: 0.8rem;
        line-height: 1.2;
    }

    /* Recuperamos padding para que los botones no sean flacos */
    .editor-top-bar .btn {
        flex-shrink: 0;
        padding-left: 8px !important;
        padding-right: 8px !important;
        min-width: 38px;
    }

    .editor-top-bar > div {
        gap: 6px !important;
    }
}

/* ========================================= */
/* 5. SIDEBAR (REFERENCIAS)                  */
/* ========================================= */
.sidebar-referencias {
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), margin 0.3s;
    position: relative;
    z-index: auto;
}

.step-3 .sidebar-referencias,
.step-4 .sidebar-referencias,
.step-5 .sidebar-referencias {
    display: none !important;
}

@media (max-width: 767px) {
    .sidebar-referencias {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 200px;
        border-right: 1px solid #ccc;
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
        transform: translateX(-100%);
        z-index: 2020;
    }

        .sidebar-referencias.tutorial-highlight {
            z-index: 2020 !important;
            pointer-events: none !important;
        }

        .sidebar-referencias.abierto {
            transform: translateX(0);
        }

        .sidebar-referencias.cerrado {
            transform: translateX(-100%);
        }
}

@media (min-width: 768px) {
    .sidebar-referencias {
        width: 280px;
        border-right: 1px solid #e0e0e0;
        flex-shrink: 0;
        transform: none;
    }

        .sidebar-referencias.abierto {
            margin-left: 0;
            padding: 15px;
        }

        .sidebar-referencias.cerrado {
            margin-left: -280px;
            padding: 15px;
        }
}

.ref-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: #444;
    white-space: nowrap;
}

.ref-color-box {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    margin-right: 10px;
    border: 1px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.ref-titulo {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0056b3;
    display: block;
}

.btn-toggle-ref {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 15;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 1.2rem;
}

/* ========================================= */
/* 6. TUTORIAL                               */
/* ========================================= */
.tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    pointer-events: all;
    display: block !important;
}

.tutorial-highlight {
    position: relative;
    z-index: 2010 !important;
    background-color: white !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5), 0 0 20px black;
    border-radius: 8px;
    pointer-events: auto;
}

.tutorial-bubble {
    position: fixed !important;
    width: 220px;
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    z-index: 2147483647 !important;
    text-align: center;
    font-size: 0.9rem;
    color: #333;
    border: 2px solid #007bff;
    pointer-events: auto !important;
    animation: fadeInSimple 0.2s ease-out forwards;
}

@keyframes fadeInSimple {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.tutorial-bubble.arrow-left {
    left: 295px !important;
    top: 130px !important;
    transform: none;
}

    .tutorial-bubble.arrow-left::after {
        content: '';
        position: absolute;
        top: 20px;
        right: 100%;
        border-width: 10px;
        border-style: solid;
        border-color: transparent #007bff transparent transparent;
    }

@media (max-width: 767px) {
    .tutorial-bubble.arrow-left {
        left: 215px !important;
        top: 60px !important;
        width: 140px;
    }

        .tutorial-bubble.arrow-left::after {
            display: block !important;
            right: 100%;
            border-color: transparent #007bff transparent transparent;
        }
}

.tutorial-bubble.arrow-bottom {
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    position: absolute !important;
}

    .tutorial-bubble.arrow-bottom::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 50%;
        margin-left: -10px;
        border-width: 10px;
        border-style: solid;
        border-color: #007bff transparent transparent transparent;
    }

@media (max-width: 768px) {
    .tutorial-bubble.arrow-bottom.step-herramientas {
        position: fixed !important;
        bottom: 75px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
    }
}

.tutorial-bubble.centered-canvas {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
}

.tutorial-bubble.arrow-top {
    top: 120%;
    left: 50%;
    transform: translateX(-50%);
    position: absolute !important;
    width: 200px;
}

    .tutorial-bubble.arrow-top::after {
        content: '';
        position: absolute;
        bottom: 100%;
        left: 50%;
        margin-left: -10px;
        border-width: 10px;
        border-style: solid;
        border-color: transparent transparent #007bff transparent;
    }

    .tutorial-bubble.arrow-top.last-step {
        position: fixed !important;
        top: 60px !important;
        left: auto !important;
        right: 10px !important;
        transform: none !important;
    }

@media (min-width: 768px) {
    .tutorial-bubble.arrow-top.last-step::after {
        left: auto !important;
        right: 115px !important;
        margin-left: 0 !important;
    }
}

@media (max-width: 767px) {
    /* Ajuste de la flecha de Deshacer: menor valor = más a la derecha */
    .tutorial-bubble.arrow-top.last-step::after {
        left: auto !important;
        right: 60px !important;
        margin-left: 0 !important;
    }
}

/* ========================================= */
/* 7. MODALES, EXTRAS & PDF                  */
/* ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 99999 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: aparecer 0.3s ease-out;
}

.grid-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.item-card {
    border: 1px solid #eee;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    width: 90px;
    background: #f0f2f5;
    transition: transform 0.2s;
}

    .item-card:hover {
        transform: translateY(-3px);
        background-color: #e7f1ff;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        border-color: #007bff;
    }

    .item-card img {
        width: 100%;
        height: auto;
        margin-bottom: 5px;
        filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
    }

    .item-card small {
        display: block;
        font-size: 0.75rem;
        color: #666;
        line-height: 1.1;
    }

.settings-modal-card, .legal-modal-card {
    background: white;
    width: 90%;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease-out;
}

.settings-modal-card {
    max-width: 400px;
    max-height: 85vh;
}

.legal-modal-card {
    max-width: 600px;
    height: 80vh;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

    .settings-modal-header h3 {
        margin: 0;
        font-size: 1.2rem;
        color: #333;
        font-weight: 700;
    }

.btn-close-arrow {
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #555;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.settings-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
}

    .settings-option:active {
        background-color: #f5f5f5;
    }

.opt-icon {
    margin-right: 15px;
    width: 25px;
    text-align: center;
    font-size: 1.2rem;
}

.opt-text {
    flex: 1;
    font-weight: 500;
}

.legal-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #fcfcfc;
    font-size: 0.9rem;
    color: #444;
    line-height: 1.6;
    text-align: left;
}

.ayuda-content {
    max-width: 500px;
    width: 90%;
    line-height: 1.5;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}

.loading-text {
    color: white;
    margin-top: 15px;
    font-weight: 500;
}

@keyframes aparecer {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes desvanecer {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.blazored-toast {
    animation: desvanecer 1s linear 4s forwards !important;
}

#contenedor-exportacion {
    width: 210mm !important;
    min-height: 297mm !important;
    padding: 15mm !important;
    background: white;
    box-sizing: border-box;
    margin: 0 auto;
    font-family: 'Segoe UI', sans-serif;
    color: #333;
}

    /* --- AGREGAR ESTO PARA LAS IMÁGENES DEL REPORTE --- */
    #contenedor-exportacion img {
        width: auto !important; /* No permite que se estire a lo ancho */
        height: auto !important; /* No permite que se estire a lo alto */
        max-width: 100% !important; /* No deja que se salga del cuadro */
        max-height: 350px !important; /* Altura máxima del cuadro del reporte */
        display: inline-block !important;
        vertical-align: middle !important;
    }


@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    body {
        margin: 0;
        padding: 0;
        background: white;
    }

    .editor-container, .loading-overlay, .modal-overlay, .sidebar, .top-row, #app {
        display: none !important;
    }

    #contenedor-exportacion {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        z-index: 9999 !important;
        visibility: visible !important;
        width: 210mm !important;
        overflow: hidden;
    }
}

.animate-fade-inReference {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}

/* Estilos exclusivos para la página de políticas */

.legal-page-container {
    padding: 5vh 5vw;
    height: 100dvh; /* Cambiamos min-height por height fijo */
    overflow-y: auto; /* ¡Esta es la magia que habilita el scroll! */
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.legal-card {
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    max-width: 800px;
    width: 100%;
    overflow: hidden;
    margin-bottom: 5vh; /* <--- Agregá esta línea */
}

.legal-header {
    background: #0056b3;
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

    .btn-back:hover {
        background: rgba(255,255,255,0.4);
    }

.legal-title {
    margin: 0;
    font-size: 2rem;
    font-weight: bold; /* Bajamos de 800 a bold para limpiar el trazo */
    color: #ffffff !important; /* Forzamos blanco puro */
    text-shadow: none !important; /* Matamos cualquier sombra heredada */
    -webkit-text-stroke: 0px transparent !important; /* Anulamos bordes nativos del navegador */
}

.legal-date {
    margin: 10px 0 0 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

.legal-body {
    padding: 40px;
    color: #444;
    line-height: 1.6;
    text-align: left;
}

    .legal-body h2 {
        color: #0056b3;
        font-size: 1.4rem;
        margin-top: 30px;
        margin-bottom: 15px;
        border-bottom: 2px solid #f0f2f5;
        padding-bottom: 5px;
    }

    .legal-body h3 {
        color: #333;
        font-size: 1.1rem;
        margin-top: 20px;
    }

    .legal-body p {
        margin-bottom: 15px;
    }

    .legal-body ul {
        margin-bottom: 20px;
        padding-left: 20px;
    }

    .legal-body li {
        margin-bottom: 8px;
    }

    .legal-body a {
        color: #0056b3;
        text-decoration: none;
        font-weight: bold;
    }

        .legal-body a:hover {
            text-decoration: underline;
        }

/* Acá ya no choca con MAUI porque estamos en un archivo .css puro */
@media (max-width: 768px) {
    .legal-page-container {
        padding: 0;
    }

    .legal-card {
        border-radius: 0;
        box-shadow: none;
        margin-bottom: 0;
        min-height: 100dvh;
    }

    /* --- ACÁ ESTÁ LA MAGIA --- */
    .legal-header {
        padding: 15px;
        padding-top: 65px; /* Empuja el título hacia abajo para dejarle espacio exclusivo al botón */
    }

    .btn-back {
        top: 15px;
        left: 15px;
        font-size: 0.85rem; /* Achicamos un poquito la letra del botón */
        padding: 6px 12px; /* Lo hacemos menos gordito */
    }

    .legal-title {
        font-size: 1.5rem;
        margin-top: 0; /* Le sacamos el margen porque el padding-top del header ya hace el trabajo */
    }
    /* ------------------------- */

    .legal-body {
        padding: 20px 15px;
        padding-bottom: 40px;
    }
}