/* =========================================================
   CONTENEDOR GENERAL
   ========================================================= */

.da-dictionary {
    max-width: 760px;
    margin: 0 auto;
}


/* =========================================================
   BUSCADOR
   ========================================================= */

.da-search-box {
    position: relative;
    display: grid;
    gap: 12px;
}

.da-search-box select,
.da-search-box input {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
}

.da-search-controls {
    display: grid;
    grid-template-columns: 1fr 180px auto;
    gap: 0.5rem;
    align-items: stretch;
}

.da-search-controls input,
.da-search-controls select {
    min-height: 42px;
    padding: 0.5rem 0.875rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
}

#da-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.5rem 4rem;
    border: 0;
    border-radius: 0.25rem;

    background-color: var(--bricks-color-vmelkg);
    color: var(--blanco);

    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
    text-decoration: none;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        opacity 0.2s ease;
}

#da-search-button:hover {
    background-color: rgba(116, 22, 64, 0.75);
    color: var(--blanco);
}


/* =========================================================
   SUGERENCIAS / AUTOCOMPLETADO
   ========================================================= */

.da-suggestions {
    margin-top: 0.75rem;

    display: grid;
    gap: 0;

    border: 1px solid #e2e2e2;
    border-radius: 0.5rem;

    background: #fff;
    overflow: hidden;

    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.da-suggestions:empty {
    display: none;
}

.da-suggestions button {
    position: relative;

    width: 100%;
    min-height: 44px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    padding: 0.75rem 1rem;

    border: 0;
    border-bottom: 1px solid #eee;

    background: #fff;
    color: #222;

    font-size: 0.975rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    text-transform: none;

    cursor: pointer;

    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        padding-left 0.18s ease;
}

.da-suggestions button:last-child {
    border-bottom: 0;
}

.da-suggestions button::after {
    content: "→";

    color: var(--bricks-color-vmelkg);
    font-weight: 600;

    opacity: 0;
    transform: translateX(-4px);

    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
}

.da-suggestions button:hover,
.da-suggestions button:focus {
    padding-left: 1.15rem;

    background: rgba(116, 22, 64, 0.06);
    color: var(--bricks-color-vmelkg);

    outline: none;
}

.da-suggestions button:hover::after,
.da-suggestions button:focus::after {
    opacity: 1;
    transform: translateX(0);
}


/* =========================================================
   RESULTADOS
   ========================================================= */

.da-results {
    margin-top: 24px;

    display: grid;
    gap: 16px;
}

.da-result-card {
    padding: 1.5rem;

    border: 1px solid #e1e1e1;
    border-radius: 0.75rem;

    background: #fff;
}

.da-result-header h3 {
    margin: 0;

    font-family: inherit;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.1;

    color: #111;
}

.da-display-lang {
    margin: 0.35rem 0 0;

    font-size: 0.9rem;
    font-weight: 600;

    color: var(--bricks-color-vmelkg);
}


/* =========================================================
   METADATOS DE LA PALABRA PRINCIPAL
   ========================================================= */

.da-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;

    margin-top: 0.75rem;

    font-size: 0.9rem;
    color: #555;
}


/* Categoría gramatical: m, f, adj, etc. */
.da-sense-category {
    font-size: 0.82rem;
    font-weight: 600;
    font-style: italic;

    color: #777;
}


/* Área temática: BOT · botánica */
.da-theme-area {
    display: inline-flex;
    align-items: center;

    padding: 0.25rem 0.55rem;

    border-radius: 999px;

    background: rgba(116, 22, 64, 0.08);
    color: var(--bricks-color-vmelkg);

    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
}


/* =========================================================
   BLOQUE DE TRADUCCIÓN
   ========================================================= */

.da-result-translation {
    margin-top: 1.25rem;
}

.da-result-translation h4 {
    margin: 0 0 0.75rem;

    font-size: 1rem;
    font-weight: 700;

    color: #222;
}

.da-translation {
    line-height: 1.6;
}


/* =========================================================
   ACEPCIONES
   ========================================================= */

.da-senses {
    margin: 0;
    padding-left: 1.35rem;

    display: grid;
    gap: 0.9rem;
}

.da-sense {
    padding-left: 0.25rem;
}


/* Línea principal de cada acepción */
.da-sense-main {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}


/* Traducción */
.da-sense-term {
    font-size: 1.05rem;
    font-weight: 600;

    color: #111;
}


/* =========================================================
   METADATOS DE CADA ACEPCIÓN
   ========================================================= */

.da-sense-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;

    margin-top: 0.3rem;
}


/* Contexto / nombre científico / aclaración */
.da-context-note {
    display: inline-flex;
    align-items: center;

    padding: 0;

    background: transparent;
    color: #666;

    font-size: 0.85rem;
    font-style: italic;
    line-height: 1.2;
}


/* Separador entre área temática y contexto */
.da-theme-area + .da-context-note::before {
    content: "·";

    margin-right: 0.5rem;

    color: #aaa;
}
/* área temática doble */
.da-result-meta, .da-sense-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}
/* Contenedor del badge y su ventana emergente */
.da-theme-item {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Todo el badge es clicable */
.da-theme-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: auto;
    height: auto;
    min-height: 28px;
    padding: 0.3rem 0.7rem;

    border: 0;
    border-radius: 999px;

    background: #f1f1f1;
    color: #959595;

    font-family: inherit;
    font-size: 0.8rem;
    font-style: normal;
    font-weight: 600;
    line-height: 1.2;

    text-transform: none;
    cursor: pointer;

    transition: background-color 0.2s ease, color 0.2s ease;
}

.da-theme-info:hover,
.da-theme-info[aria-expanded="true"] {
    background: rgba(116, 22, 64, 0.1);
    color: var(--bricks-color-vmelkg);
}

.da-theme-info:focus-visible {
    outline: 2px solid var(--bricks-color-vmelkg);
    outline-offset: 2px;
}
.da-theme-popover {
    position: absolute;
    z-index: 30;
    left: 50%;
    bottom: calc(100% + .5rem);
    transform: translateX(-50%);
    padding: .45rem .65rem;
    max-width: min(240px, 80vw);
    min-width: max-content;
    border: 1px solid #ddd;
    border-radius: .4rem;
    background: #fff;
    color: #333;
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    font-size: .82rem;
    font-weight: 400;
    line-height: 1.4;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}
.da-theme-item.is-open .da-theme-popover {
    visibility: visible;
    opacity: 1;
}
.da-sense-meta .da-context-note { font-size: .85rem; font-style: italic; color: #666; }
/* Idioma encima de la entrada */
.da-display-lang {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bricks-color-vmelkg);
}

/* Palabra principal y contexto */
.da-result-header h3 {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 0.6rem;
    row-gap: 0.15rem;
    margin: 0;
}

.da-entry-context {
    font-family: inherit;
    font-size: 0.55em;
    font-style: italic;
    font-weight: 400;
    line-height: 1.4;
    color: #777;
}

/* Encabezado de la lengua de destino */
.da-result-translation h4 {
    margin: 0 0 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--bricks-color-vmelkg);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
    .da-search-controls {
        grid-template-columns: 1fr;
    }

    #da-search-button {
        width: 100%;
        padding-right: 2rem;
        padding-left: 2rem;
    }
}