/* Inicio AlfaDesign (Launcher.razor). Boceto aprobado: Figma "06 — Bocetos", v2 simple.
   Saludo + buscador (recientes cuando está vacío), favoritos como chips y los módulos como
   mosaicos que abren un panel con sus aplicaciones. */

.alfa-home {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding: 56px var(--alfa-space-16, 16px) 64px;
    background: var(--alfa-bg-canvas, #0e1014);
    color: var(--alfa-text-primary, #f5f5f7);
}

.alfa-home > * {
    flex-shrink: 0;
    width: min(960px, 100%);
}

.alfa-home__hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.alfa-home__title {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    line-height: 1.25;
}

.alfa-home__subtitle {
    margin: 6px 0 24px;
    color: var(--alfa-text-secondary, #a6abb5);
    font-size: 15px;
}

/* Buscador */
.alfa-home__search {
    position: relative;
    width: min(640px, 100%);
    text-align: left;
}

.alfa-home__search.is-open {
    z-index: 20;
}

.alfa-home__search-box {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: var(--alfa-space-12, 12px);
    height: 48px;
    padding: 0 var(--alfa-space-16, 16px);
    border: 1px solid var(--alfa-border-default, #333640);
    border-radius: var(--alfa-radius-md, 8px);
    background: var(--alfa-bg-input, #252830);
    color: var(--alfa-text-secondary, #a6abb5);
}

.alfa-home__search-box:focus-within {
    border-color: var(--alfa-accent, #4f9efa);
    box-shadow: 0 0 0 1px var(--alfa-accent, #4f9efa);
}

.alfa-home__search-box > .bi-search {
    font-size: 16px;
}

.alfa-home__search-box input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--alfa-text-primary, #f5f5f7);
    font: inherit;
    font-size: 15px;
    outline: none;
}

.alfa-home__search-box input::-webkit-search-cancel-button {
    display: none;
}

.alfa-home kbd {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--alfa-border-default, #333640);
    border-radius: var(--alfa-radius-sm, 4px);
    background: var(--alfa-bg-surface, #16181d);
    color: var(--alfa-text-secondary, #a6abb5);
    font-family: inherit;
    font-size: 11px;
    line-height: 16px;
}

.alfa-home__results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    max-height: min(420px, 60vh);
    overflow-y: auto;
    padding: var(--alfa-space-4, 4px) 0;
    border: 1px solid var(--alfa-border-default, #333640);
    border-radius: var(--alfa-radius-md, 8px);
    background: var(--alfa-bg-surface, #16181d);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}

.alfa-home__results-label {
    padding: var(--alfa-space-8, 8px) var(--alfa-space-16, 16px) var(--alfa-space-4, 4px);
    color: var(--alfa-text-secondary, #a6abb5);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.alfa-home__results-hint {
    margin: 0;
    padding: var(--alfa-space-8, 8px) var(--alfa-space-16, 16px) var(--alfa-space-12, 12px);
    color: var(--alfa-text-secondary, #a6abb5);
    font-size: var(--alfa-font-small, 12px);
}

.alfa-home__results-foot {
    margin: var(--alfa-space-4, 4px) 0 0;
    padding: var(--alfa-space-8, 8px) var(--alfa-space-16, 16px) var(--alfa-space-4, 4px);
    border-top: 1px solid var(--alfa-border-default, #333640);
    color: var(--alfa-text-secondary, #a6abb5);
    font-size: 11px;
}

.alfa-home__result {
    display: flex;
    align-items: center;
    gap: var(--alfa-space-12, 12px);
    min-height: 40px;
    padding: 0 var(--alfa-space-8, 8px) 0 var(--alfa-space-16, 16px);
    color: var(--alfa-text-primary, #f5f5f7);
    font-size: var(--alfa-font-body, 13px);
    cursor: pointer;
}

.alfa-home__result:hover,
.alfa-home__result.is-active {
    background: var(--alfa-state-hover, #21242b);
}

.alfa-home__result.is-active {
    box-shadow: inset 2px 0 0 var(--alfa-accent, #4f9efa);
}

.alfa-home__result:focus-visible {
    outline: 2px solid var(--alfa-accent, #4f9efa);
    outline-offset: -2px;
}

.alfa-home__result-icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: var(--alfa-radius-sm, 4px);
    background: var(--alfa-bg-surface-raised, #1d2026);
    color: var(--alfa-accent, #4f9efa);
    font-size: 14px;
}

.alfa-home__result-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alfa-home__result-meta {
    flex: 0 0 auto;
    color: var(--alfa-text-secondary, #a6abb5);
    font-size: var(--alfa-font-small, 12px);
}

.alfa-home__star {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 0;
    border-radius: var(--alfa-radius-sm, 4px);
    background: transparent;
    color: var(--alfa-text-disabled, #666b75);
    cursor: pointer;
}

.alfa-home__star:hover {
    color: var(--alfa-warning, #f2c94c);
    background: var(--alfa-bg-surface-raised, #1d2026);
}

.alfa-home__star.is-active {
    color: var(--alfa-warning, #f2c94c);
}

.alfa-home__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
}

/* Secciones */
.alfa-home__section {
    display: flex;
    flex-direction: column;
    gap: var(--alfa-space-12, 12px);
}

.alfa-home__section-title {
    margin: 0;
    color: var(--alfa-text-secondary, #a6abb5);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.alfa-home__hint {
    margin: 0;
    color: var(--alfa-text-secondary, #a6abb5);
    font-size: var(--alfa-font-body, 13px);
}

/* Favoritos */
.alfa-home__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--alfa-space-8, 8px);
}

.alfa-home__chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--alfa-border-default, #333640);
    border-radius: var(--alfa-radius-full, 999px);
    background: var(--alfa-bg-surface, #16181d);
}

.alfa-home__chip:hover {
    border-color: var(--alfa-border-strong, #4d525e);
}

.alfa-home__chip-open {
    display: inline-flex;
    align-items: center;
    gap: var(--alfa-space-8, 8px);
    height: 32px;
    padding: 0 var(--alfa-space-4, 4px) 0 var(--alfa-space-12, 12px);
    border: 0;
    background: transparent;
    color: var(--alfa-text-primary, #f5f5f7);
    font: inherit;
    font-size: var(--alfa-font-body, 13px);
    cursor: pointer;
}

.alfa-home__chip-open > i {
    color: var(--alfa-accent, #4f9efa);
}

.alfa-home__chip-remove {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-right: 3px;
    border: 0;
    border-radius: var(--alfa-radius-full, 999px);
    background: transparent;
    color: var(--alfa-text-secondary, #a6abb5);
    cursor: pointer;
    opacity: 0;
}

.alfa-home__chip:hover .alfa-home__chip-remove,
.alfa-home__chip-remove:focus-visible {
    opacity: 1;
}

.alfa-home__chip-remove:hover {
    background: var(--alfa-state-hover, #21242b);
    color: var(--alfa-text-primary, #f5f5f7);
}

.alfa-home__chip-open:focus-visible,
.alfa-home__chip-remove:focus-visible,
.alfa-home__module:focus-visible,
.alfa-home__star:focus-visible,
.alfa-home__panel-close:focus-visible {
    outline: 2px solid var(--alfa-accent, #4f9efa);
    outline-offset: 2px;
}

/* Módulos */
.alfa-home__modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--alfa-space-12, 12px);
}

.alfa-home__module-wrap {
    position: relative;
}

.alfa-home__module {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--alfa-space-8, 8px);
    width: 100%;
    height: 100%;
    min-height: 104px;
    padding: var(--alfa-space-12, 12px) var(--alfa-space-8, 8px);
    border: 1px solid var(--alfa-border-default, #333640);
    border-radius: var(--alfa-radius-md, 8px);
    background: var(--alfa-bg-surface, #16181d);
    color: var(--alfa-text-primary, #f5f5f7);
    font: inherit;
    cursor: pointer;
    transition: border-color .12s ease, background-color .12s ease;
}

.alfa-home__module:hover {
    border-color: var(--alfa-border-strong, #4d525e);
    background: var(--alfa-bg-surface-raised, #1d2026);
}

.alfa-home__module.is-open {
    position: relative;
    z-index: 2;
    border-color: var(--alfa-accent, #4f9efa);
    background: var(--alfa-bg-surface-raised, #1d2026);
}

.alfa-home__module-icon {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--alfa-radius-md, 8px);
    background: color-mix(in srgb, var(--alfa-accent, #4f9efa) 16%, transparent);
    color: var(--alfa-accent, #4f9efa);
    font-size: 19px;
}

.alfa-home__module-name {
    max-width: 100%;
    min-height: 2.5em; /* reserva 2 líneas: todos los mosaicos quedan del mismo alto */
    overflow: hidden;
    font-size: var(--alfa-font-body, 13px);
    line-height: 1.25;
    text-align: center;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.alfa-home__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    z-index: 3;
    display: flex;
    flex-direction: column;
    width: min(300px, calc(100vw - 32px));
    max-height: min(420px, 60vh);
    border: 1px solid var(--alfa-border-default, #333640);
    border-radius: var(--alfa-radius-md, 8px);
    background: var(--alfa-bg-surface, #16181d);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
    transform: translateX(-50%);
    overflow: hidden;
}

.alfa-home__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--alfa-space-8, 8px);
    padding: var(--alfa-space-8, 8px) var(--alfa-space-8, 8px) var(--alfa-space-8, 8px) var(--alfa-space-16, 16px);
    border-bottom: 1px solid var(--alfa-border-default, #333640);
    font-size: var(--alfa-font-body, 13px);
}

.alfa-home__panel-close {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: var(--alfa-radius-sm, 4px);
    background: transparent;
    color: var(--alfa-text-secondary, #a6abb5);
    cursor: pointer;
}

.alfa-home__panel-close:hover {
    background: var(--alfa-state-hover, #21242b);
}

.alfa-home__panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: var(--alfa-space-4, 4px) 0;
}

.alfa-home__panel-foot {
    padding: var(--alfa-space-8, 8px) var(--alfa-space-16, 16px);
    border-top: 1px solid var(--alfa-border-default, #333640);
}

.alfa-home__panel-foot a {
    display: inline-flex;
    align-items: center;
    gap: var(--alfa-space-4, 4px);
    color: var(--alfa-accent, #4f9efa);
    font-size: var(--alfa-font-small, 12px);
    text-decoration: none;
}

.alfa-home__panel-foot a:hover {
    text-decoration: underline;
}

/* Página completa de un módulo (/shell/{clave}): mismos mosaicos, con estrella de favorito. */
.alfa-home--workspace {
    align-items: center;
    gap: 28px;
    padding-top: 32px;
}

.alfa-home__ws-head {
    display: flex;
    flex-direction: column;
    gap: var(--alfa-space-12, 12px);
}

.alfa-home__ws-back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: var(--alfa-space-4, 4px);
    color: var(--alfa-text-secondary, #a6abb5);
    font-size: var(--alfa-font-small, 12px);
    text-decoration: none;
}

.alfa-home__ws-back:hover {
    color: var(--alfa-accent, #4f9efa);
}

.alfa-home__ws-title {
    display: flex;
    align-items: center;
    gap: var(--alfa-space-12, 12px);
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.alfa-home__tile-star {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 1;
    opacity: 0;
}

.alfa-home__module-wrap:hover .alfa-home__tile-star,
.alfa-home__tile-star:focus-visible,
.alfa-home__tile-star.is-active {
    opacity: 1;
}

/* Las secciones del módulo suelen tener pocas aplicaciones: se acomodan una al lado de la otra
   con mosaicos de ancho fijo en vez de ocupar una fila entera cada una. */
.alfa-home__ws-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 28px 40px;
}

.alfa-home__ws-sections .alfa-home__modules {
    display: flex;
    flex-wrap: wrap;
}

.alfa-home__ws-sections .alfa-home__module-wrap {
    width: 128px;
}

/* El Inicio ocupa todo el alto: sin el padding del .shell__content genérico. */
.shell.shell--alfa-design .shell__content:has(> .alfa-home) {
    padding: 0;
}

/* En el Inicio el logo ya es la página actual: el botón de casa sobra. */
.shell.shell--alfa-home .alfa-app-topbar__history .alfa-app-topbar__global-icon:first-child {
    display: none;
}

@media (max-width: 720px) {
    .alfa-home {
        gap: 24px;
        padding-top: 32px;
    }

    .alfa-home__title {
        font-size: 22px;
    }

    .alfa-home__kbd {
        display: none !important;
    }

    .alfa-home__modules {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    }

    .alfa-home__module {
        min-height: 96px;
    }

    /* En pantallas angostas el panel del módulo se abre como hoja inferior. */
    .alfa-home__panel {
        position: fixed;
        top: auto;
        right: var(--alfa-space-16, 16px);
        bottom: var(--alfa-space-16, 16px);
        left: var(--alfa-space-16, 16px);
        width: auto;
        transform: none;
    }

    .alfa-home__chip-remove,
    .alfa-home__tile-star {
        opacity: 1;
    }
}
