/* Estudiar en Andalucía · v0.8.2
   Ajustes UX: imágenes, selects buscables, competencias e importaciones. */

/* ---------- Imágenes de tarjetas ---------- */
.area-visual,
.area-card-media,
.study-area-card-media,
.home-area-card-media {
    width: 100% !important;
    height: 132px !important;
    min-height: 132px !important;
    overflow: hidden !important;
    position: relative !important;
    background: #eef2f0;
    border-radius: inherit inherit 0 0;
}
.area-visual img,
.area-card-media img,
.study-area-card-media img,
.home-area-card-media img,
.area-card > img,
.study-area-card > img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center !important;
}
/* El color de provincia se utiliza como acento, nunca como capa sobre la foto. */
.area-visual::after,
.area-card-media::after,
.study-area-card-media::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 4px;
    background: var(--accent);
    pointer-events: none;
}

.news-card-media,
.article-card-media,
.latest-news-image,
.news-card .image,
.article-card .image {
    width: 100% !important;
    height: 150px !important;
    overflow: hidden !important;
    background: #f1f4f3;
    border-radius: 12px;
}
.news-card-media img,
.article-card-media img,
.latest-news-image img,
.news-card .image img,
.article-card .image img,
.news-card > a > img,
.article-card > a > img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center !important;
}
/* Fallback para la home actual: solo actúa sobre imágenes dentro de las rejillas de áreas/noticias. */
.areas-grid img,
.area-grid img,
.latest-news-grid img,
.news-grid img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* ---------- Select buscable estilo Select2 ---------- */
.smart-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
}
.smart-select {
    position: relative;
    width: 100%;
    font: inherit;
    z-index: 2;
}
.smart-select.is-open { z-index: 80; }
.smart-select-control {
    min-height: 44px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    padding: 7px 38px 7px 11px;
    border: 1px solid #d7dfdc;
    border-radius: 10px;
    background: #fff;
    color: #16211e;
    cursor: pointer;
    text-align: left;
    position: relative;
    box-sizing: border-box;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.smart-select-control:hover { border-color: #b9c8c3; }
.smart-select.is-open .smart-select-control,
.smart-select-control:focus-visible {
    outline: 0;
    border-color: var(--accent, #147460);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #147460) 12%, transparent);
}
.smart-select-control::after {
    content: "expand_more";
    font-family: "Material Symbols Rounded";
    font-size: 21px;
    line-height: 1;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #687672;
    transition: transform .15s ease;
}
.smart-select.is-open .smart-select-control::after { transform: translateY(-50%) rotate(180deg); }
.smart-select-value { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart-select-placeholder { color: #87928f; }
.smart-select-panel {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: calc(100% + 5px);
    border: 1px solid #d7dfdc;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(25, 42, 37, .16);
    overflow: hidden;
}
.smart-select.is-open .smart-select-panel { display: block; }
.smart-select-search-wrap { padding: 9px; border-bottom: 1px solid #edf1ef; background: #fafcfb; }
.smart-select-search {
    width: 100% !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 8px 11px 8px 36px !important;
    border: 1px solid #d7dfdc !important;
    border-radius: 9px !important;
    background: #fff !important;
    box-sizing: border-box;
}
.smart-select-search-wrap { position: relative; }
.smart-select-search-wrap::before {
    content: "search";
    font-family: "Material Symbols Rounded";
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #6f7c78;
    font-size: 19px;
    pointer-events: none;
}
.smart-select-options { max-height: 300px; overflow: auto; padding: 5px; overscroll-behavior: contain; }
.smart-select-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #23312d;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.smart-select-option:hover,
.smart-select-option.is-highlighted { background: #eff5f3; }
.smart-select-option.is-selected { background: color-mix(in srgb, var(--accent, #147460) 9%, #fff); color: var(--accent, #147460); font-weight: 750; }
.smart-select-option.is-disabled { opacity: .45; cursor: default; }
.smart-select-option .material-symbols-rounded { font-size: 18px; }
.smart-select-empty { padding: 16px 12px; color: #77837f; font-size: 12px; text-align: center; }
.smart-select-hint { padding: 8px 11px; color: #87928f; font-size: 10px; border-top: 1px solid #edf1ef; background: #fafcfb; }
.smart-select-chips { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; flex: 1; }
.smart-select-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 5px 7px 5px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent, #147460) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--accent, #147460) 18%, #e2e8e6);
    color: #29423b;
    font-size: 11px;
    font-weight: 750;
}
.smart-select-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart-select-chip-remove {
    border: 0;
    background: transparent;
    padding: 0;
    display: grid;
    place-items: center;
    color: #60706b;
    cursor: pointer;
}
.smart-select-chip-remove .material-symbols-rounded { font-size: 15px; }
.smart-select-chip-remove:hover { color: #9a302b; }

/* ---------- Profesiones: subcampo Competencias ---------- */
.competency-editor { margin-top: 7px; border: 1px solid #e0e7e4; border-radius: 14px; overflow: hidden; background: #fbfcfc; }
.competency-editor-head { display: grid; grid-template-columns: minmax(180px,1fr) 150px 38px; gap: 10px; padding: 9px 11px; background: #f1f5f3; color: #687672; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.competency-editor-rows { display: flex; flex-direction: column; }
.competency-row { display: grid; grid-template-columns: minmax(180px,1fr) 150px 38px; gap: 10px; align-items: center; padding: 9px 11px; border-top: 1px solid #e7ecea; }
.competency-row:first-child { border-top: 0; }
.competency-row input,
.competency-row select { width: 100%; min-height: 39px; margin: 0; }
.competency-remove { width: 34px; height: 34px; border: 0; border-radius: 8px; background: #fff0ee; color: #94362f; cursor: pointer; display: grid; place-items: center; }
.competency-remove:hover { background: #94362f; color: #fff; }
.competency-editor-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 11px; border-top: 1px solid #e7ecea; background: #f8faf9; }
.competency-editor-footer small { color: #7a8783; }
.competency-add { border: 0; border-radius: 9px; background: #e9f3ef; color: #17614f; padding: 8px 11px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.competency-add:hover { background: #d8ebe4; }
.competency-add .material-symbols-rounded { font-size: 17px; }

/* ---------- Importaciones: jerarquía, espaciado y QEDU ---------- */
.import-manual-card,
.import-automation-block,
.import-history { margin-bottom: 28px !important; }
.import-source-groups { gap: 26px !important; }
.import-source-group { margin: 0 !important; border-radius: 18px !important; overflow: hidden; }
.import-group-title { padding: 17px 20px !important; }
.import-source-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
    gap: 16px !important;
    padding: 16px !important;
    background: #f7f9f8;
}
.source-card-v2 {
    margin: 0 !important;
    padding: 18px !important;
    border: 1px solid #dde5e2 !important;
    border-radius: 15px !important;
    background: #fff !important;
    box-shadow: 0 5px 18px rgba(23, 39, 34, .035);
}
.source-card-v2 + .source-card-v2 { margin-top: 0 !important; }
.source-card-actions-v2 { margin-top: 16px !important; padding-top: 15px !important; gap: 14px !important; flex-wrap: wrap; }
.source-settings-form {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 8px 9px !important;
    background: #f7faf9 !important;
    border: 1px solid #e1e8e5 !important;
    border-radius: 11px !important;
}
.source-settings-form .icon-button {
    opacity: 1 !important;
    visibility: visible !important;
    background: #fff !important;
    color: var(--accent, #147460) !important;
    border: 1px solid #cbd8d4 !important;
    box-shadow: none !important;
}
.source-settings-form .icon-button:hover,
.source-settings-form .icon-button:focus-visible {
    background: var(--accent, #147460) !important;
    color: #fff !important;
    border-color: var(--accent, #147460) !important;
    opacity: 1 !important;
}
.import-query-form-v2 { margin-top: 16px !important; }
.import-query-main { gap: 18px !important; padding: 20px !important; }
.import-query-footer { margin-top: 0 !important; }
[data-qedu-file] { display: none !important; }
[data-qedu-file].is-qedu-active { display: block !important; }

@media (max-width: 900px) {
    .import-source-list { grid-template-columns: 1fr !important; }
}
@media (max-width: 680px) {
    .area-visual,.area-card-media,.study-area-card-media,.home-area-card-media { height: 150px !important; }
    .news-card-media,.article-card-media,.latest-news-image,.news-card .image,.article-card .image { height: 170px !important; }
    .smart-select-panel { position: fixed; left: 12px; right: 12px; top: 18vh; max-height: 68vh; }
    .smart-select-options { max-height: 48vh; }
    .competency-editor-head { display: none; }
    .competency-row { grid-template-columns: 1fr 105px 36px; padding: 9px; gap: 7px; }
    .competency-editor-footer { align-items: flex-start; flex-direction: column; }
    .import-source-list { padding: 10px !important; }
    .source-card-actions-v2 { align-items: stretch !important; flex-direction: column !important; }
}
