/* =========================================================
   NOESOR - ESTRUCTURA DEL PROYECTO
   Explorador lateral, resumen general, detalle de secciones
   y vista previa de componentes generables.
   ========================================================= */

/* =========================================================
   ESTADO VACÍO
   ========================================================= */

.structure-empty-state {
    width: min(calc(100% - 40px), 760px);
    margin: 80px auto 110px;
    padding: 48px;
    text-align: center;
}

    .structure-empty-state h1 {
        margin: 12px 0 0;
        font-size: clamp(2rem, 5vw, 3.4rem);
        line-height: 1.12;
        letter-spacing: -0.045em;
    }

    .structure-empty-state p {
        max-width: 620px;
        margin: 20px auto 0;
        color: var(--text-soft);
        line-height: 1.75;
    }

    .structure-empty-state .button {
        margin-top: 28px;
    }

/* =========================================================
   ENCABEZADO
   ========================================================= */

.structure-page-header {
    width: min(calc(100% - 40px), 1180px);
    margin: 0 auto 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 32px;
}

    .structure-page-header > div:first-child {
        min-width: 0;
    }

.structure-score {
    min-width: 150px;
    padding: 18px 20px;
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 16px;
    background: radial-gradient( circle at top left, rgba(139, 92, 246, 0.16), transparent 55% ), rgba(255, 255, 255, 0.025);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
    text-align: right;
}

    .structure-score span {
        display: block;
        color: var(--text-muted);
        font-size: 0.76rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }

    .structure-score strong {
        display: block;
        margin-top: 6px;
        color: white;
        font-size: 2rem;
        line-height: 1;
        letter-spacing: -0.04em;
    }

/* =========================================================
   BARRA DE ACCIONES
   ========================================================= */

.structure-toolbar {
    width: min(calc(100% - 40px), 1180px);
    margin: 0 auto 28px;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.structure-alert {
    width: min(calc(100% - 40px), 1180px);
    margin: 0 auto 24px;
}

/* =========================================================
   DISTRIBUCIÓN PRINCIPAL
   ========================================================= */

.project-structure-layout {
    width: min(calc(100% - 40px), 1180px);
    margin: 0 auto;
    padding-bottom: 100px;
    display: grid;
    grid-template-columns: minmax(260px, 0.32fr) minmax(0, 1fr);
    align-items: start;
    gap: 24px;
}

.project-tree-card,
.structure-detail-card {
    min-width: 0;
}

.project-tree-card {
    position: sticky;
    top: 102px;
    overflow: hidden;
}

.structure-detail-card {
    padding: 0;
    overflow: hidden;
}

/* =========================================================
   EXPLORADOR DEL PROYECTO
   ========================================================= */

.tree-heading {
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--border);
}

    .tree-heading h2 {
        margin: 7px 0 0;
        font-size: 1.15rem;
        letter-spacing: -0.025em;
    }

.project-root {
    padding: 18px;
}

.tree-project-name,
.tree-node {
    width: 100%;
    border: 0;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.tree-project-name {
    min-height: 46px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 11px;
    background: rgba(139, 92, 246, 0.08);
    color: white;
    font-size: 0.9rem;
    font-weight: 800;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

    .tree-project-name:hover {
        background: rgba(139, 92, 246, 0.13);
        transform: translateX(2px);
    }

.tree-branch {
    position: relative;
    margin-top: 12px;
    padding-left: 15px;
    display: grid;
    gap: 5px;
}

    .tree-branch::before {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 6px;
        width: 1px;
        content: "";
        background: linear-gradient( to bottom, rgba(139, 92, 246, 0.32), rgba(148, 163, 184, 0.06) );
    }

.tree-node {
    position: relative;
    min-height: 43px;
    padding: 0 10px 0 12px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    border-radius: 10px;
    background: transparent;
    color: var(--text-soft);
    font-size: 0.83rem;
    font-weight: 650;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

    .tree-node::before {
        position: absolute;
        top: 50%;
        left: -9px;
        width: 9px;
        height: 1px;
        content: "";
        background: rgba(148, 163, 184, 0.18);
    }

    .tree-node:hover {
        color: white;
        background: rgba(255, 255, 255, 0.04);
        transform: translateX(2px);
    }

    .tree-node.active {
        color: white;
        background: rgba(139, 92, 246, 0.14);
    }

    .tree-node strong {
        min-width: 27px;
        padding: 3px 7px;
        border-radius: 999px;
        background: rgba(148, 163, 184, 0.09);
        color: var(--text-muted);
        font-size: 0.68rem;
        text-align: center;
    }

    .tree-node.active strong {
        background: rgba(139, 92, 246, 0.18);
        color: #d8ccff;
    }

.tree-icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: var(--primary-light);
    font-size: 0.82rem;
}

/* =========================================================
   CABECERA DEL DETALLE
   ========================================================= */

.structure-detail-header {
    padding: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.018);
}

    .structure-detail-header h2 {
        margin: 7px 0 0;
        font-size: clamp(1.55rem, 3vw, 2.15rem);
        line-height: 1.18;
        letter-spacing: -0.035em;
    }

    .structure-detail-header p {
        max-width: 700px;
        margin: 12px 0 0;
        color: var(--text-soft);
        line-height: 1.65;
    }

.structure-count {
    flex-shrink: 0;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

/* =========================================================
   RESUMEN GENERAL
   ========================================================= */

.project-overview {
    padding: 24px 28px 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.overview-card {
    min-width: 0;
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.024);
}

    .overview-card span {
        display: block;
        color: var(--text-muted);
        font-size: 0.76rem;
        font-weight: 650;
    }

    .overview-card strong {
        display: block;
        margin-top: 10px;
        color: white;
        font-size: 1.7rem;
        line-height: 1;
    }

.structure-summary,
.generation-preview {
    margin: 24px 28px 0;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.02);
}

.generation-preview {
    margin-bottom: 28px;
}

    .structure-summary h3,
    .generation-preview h3 {
        margin: 0;
        font-size: 1.06rem;
        letter-spacing: -0.02em;
    }

.structure-summary p {
    margin: 13px 0 0;
    color: var(--text-soft);
    line-height: 1.72;
}

.generation-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

    .generation-grid article {
        min-width: 0;
        padding: 18px;
        border: 1px solid rgba(139, 92, 246, 0.14);
        border-radius: 13px;
        background: linear-gradient( 145deg, rgba(139, 92, 246, 0.055), rgba(255, 255, 255, 0.01) );
    }

    .generation-grid strong,
    .generation-grid span {
        display: block;
    }

    .generation-grid strong {
        color: white;
        font-size: 0.88rem;
    }

    .generation-grid span {
        margin-top: 7px;
        color: var(--text-muted);
        font-size: 0.79rem;
        line-height: 1.55;
    }

/* =========================================================
   LISTADOS DE ESTRUCTURA
   ========================================================= */

.structure-items {
    padding: 24px 28px 28px;
    display: grid;
    gap: 12px;
}

.structure-item {
    min-width: 0;
    padding: 17px 18px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.022);
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

    .structure-item:hover {
        border-color: var(--border-hover);
        background: rgba(255, 255, 255, 0.032);
        transform: translateY(-1px);
    }

.structure-item-marker {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary-light);
    font-size: 0.74rem;
    font-weight: 850;
}

.structure-item p {
    margin: 3px 0 0;
    color: var(--text-soft);
    line-height: 1.65;
}

.observation-item {
    border-color: rgba(251, 191, 36, 0.2);
    background: rgba(251, 191, 36, 0.025);
}

    .observation-item .structure-item-marker {
        background: rgba(251, 191, 36, 0.1);
        color: var(--warning);
    }

.observation-type {
    display: inline-block;
    margin-bottom: 4px;
    color: var(--warning);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* =========================================================
   SIN ELEMENTOS
   ========================================================= */

.structure-no-items {
    margin: 28px;
    padding: 30px;
    border: 1px dashed rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.015);
    color: var(--text-muted);
    text-align: center;
    line-height: 1.65;
}
