/* =========================================================
   Novedades ilimitadas — público + Modo Editor
   ========================================================= */

/* ---------- Público ---------- */
.news-card {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.news-card-media {
    width: 100%;
    height: 220px;
    min-height: 220px;
    overflow: hidden;
    background: var(--color-surface-2);
}

.news-card-media > img,
.news-card-media > .news-placeholder {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.news-card-media > img {
    display: block;
    object-fit: cover;
    object-position:
        var(--news-focus-x, 50%)
        var(--news-focus-y, 50%);
    transform: scale(var(--news-scale, 1));
    transform-origin:
        var(--news-focus-x, 50%)
        var(--news-focus-y, 50%);
}

.news-card-media > .news-placeholder {
    aspect-ratio: auto;
}

.news-card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.news-read-more {
    margin-top: auto;
    padding-top: 18px;
}

.news-pagination,
.news-pagination-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.news-pagination {
    margin-top: 28px;
    flex-wrap: wrap;
}

.news-pagination-pages {
    flex-wrap: wrap;
}

.news-page-button {
    min-width: 40px;
    min-height: 40px;
    padding: 0 11px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--color-line);
    border-radius: 12px;
    color: var(--color-text);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
    text-decoration: none;
    transition:
        transform var(--transition),
        border-color var(--transition),
        background var(--transition),
        color var(--transition);
}

.news-page-button:hover,
.news-page-button:focus-visible {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-line));
    background: var(--color-surface-2);
}

.news-page-button.is-active {
    color: #fff;
    border-color: var(--color-primary);
    background: var(--color-primary);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--color-primary) 24%, transparent);
}

.news-page-button.is-disabled {
    opacity: 0.42;
    box-shadow: none;
}

.news-page-arrow {
    font-size: 20px;
}

.news-page-ellipsis {
    min-width: 20px;
    color: var(--color-muted);
    text-align: center;
    font-weight: 850;
}

.news-modal-media {
    position: relative;
    width: 100%;
    max-height: 430px;
    aspect-ratio: 19 / 10;
    overflow: hidden;
    border-radius: 20px;
    background: var(--color-surface-2);
}

.news-modal-media .news-modal-image {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    object-fit: cover;
    object-position:
        var(--news-focus-x, 50%)
        var(--news-focus-y, 50%);
    transform: scale(var(--news-scale, 1));
    transform-origin:
        var(--news-focus-x, 50%)
        var(--news-focus-y, 50%);
}

.news-modal-link-overlay {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 2;
    margin: 0;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(20, 14, 27, 0.82);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.news-modal-link-overlay:hover,
.news-modal-link-overlay:focus-visible {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.65);
    background: rgba(20, 14, 27, 0.94);
}

.news-modal-link-top {
    margin-top: 18px;
}

@media (max-width: 980px) {
    .news-card-media {
        height: 210px;
        min-height: 210px;
    }
}

@media (max-width: 620px) {
    .news-card-media {
        height: 220px;
        min-height: 220px;
    }

    .news-pagination {
        gap: 6px;
    }

    .news-pagination-pages {
        gap: 5px;
    }

    .news-page-button {
        min-width: 36px;
        min-height: 36px;
        padding: 0 9px;
    }

    .news-modal-link-overlay {
        right: 10px;
        bottom: 10px;
        min-height: 42px;
        padding: 10px 14px;
        font-size: 12px;
    }
}

/* ---------- Editor: formulario permanente ---------- */
.editor-phase6-news-form {
    gap: 18px;
    scroll-margin-top: 18px;
}

.editor-phase6-news-form-heading {
    align-items: flex-start;
}

.editor-phase6-form-context {
    max-width: 620px;
    margin: 7px 0 0;
    color: var(--color-muted);
    font-size: 11px;
    line-height: 1.5;
}

.editor-phase6-featured-check {
    padding: 13px 14px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    border: 1px solid var(--color-line);
    border-radius: 14px;
    background: var(--color-surface-2);
    cursor: pointer;
}

.editor-phase6-featured-check input {
    margin-top: 2px;
}

.editor-phase6-featured-check span,
.editor-phase6-featured-check strong,
.editor-phase6-featured-check small {
    display: block;
}

.editor-phase6-featured-check strong {
    color: var(--color-text);
    font-size: 12px;
}

.editor-phase6-featured-check small {
    margin-top: 3px;
    color: var(--color-muted);
    font-size: 10px;
    line-height: 1.4;
}

.editor-phase6-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.editor-phase6-form-actions-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}


/* ---------- Editor: encuadre dual de imagen ---------- */
.editor-phase6-crop-editor {
    padding: 14px;
    display: grid;
    gap: 13px;
    border: 1px solid var(--color-line);
    border-radius: 16px;
    background: var(--color-surface-2);
}

.editor-phase6-crop-editor[hidden] {
    display: none !important;
}

.editor-phase6-crop-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.editor-phase6-crop-heading strong,
.editor-phase6-crop-heading small {
    display: block;
}

.editor-phase6-crop-heading strong {
    color: var(--color-text);
    font-size: 13px;
}

.editor-phase6-crop-heading small {
    margin-top: 4px;
    max-width: 560px;
    color: var(--color-muted);
    font-size: 10px;
    line-height: 1.45;
}

.editor-phase6-crop-tabs {
    flex: 0 0 auto;
    padding: 3px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid var(--color-line);
    border-radius: 11px;
    background: var(--color-surface);
}

.editor-phase6-crop-tabs button {
    min-height: 32px;
    padding: 0 11px;
    border: 0;
    border-radius: 8px;
    color: var(--color-muted);
    background: transparent;
    font: inherit;
    font-size: 10px;
    font-weight: 850;
    cursor: pointer;
}

.editor-phase6-crop-tabs button.is-active {
    color: #fff;
    background: var(--color-primary);
}

.editor-phase6-crop-stage {
    position: relative;
    width: min(100%, 760px);
    overflow: hidden;
    justify-self: start;
    border: 1px solid color-mix(in srgb, var(--color-primary) 48%, var(--color-line));
    border-radius: 15px;
    background: #09070d;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.editor-phase6-crop-stage.is-card {
    width: min(100%, 280px);
    aspect-ratio: 280 / 220;
}

.editor-phase6-crop-stage.is-modal {
    width: min(100%, 760px);
    aspect-ratio: 19 / 10;
}

.editor-phase6-crop-stage.is-dragging {
    cursor: grabbing;
}

.editor-phase6-crop-stage > img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position:
        var(--news-focus-x, 50%)
        var(--news-focus-y, 50%);
    transform: scale(var(--news-scale, 1));
    transform-origin:
        var(--news-focus-x, 50%)
        var(--news-focus-y, 50%);
    pointer-events: none;
}

.editor-phase6-crop-stage > img[hidden] {
    display: none !important;
}

.editor-phase6-crop-hint {
    position: absolute;
    z-index: 2;
    right: 10px;
    bottom: 10px;
    left: 10px;
    padding: 7px 9px;
    border-radius: 9px;
    color: #fff;
    background: rgba(18, 12, 25, 0.76);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
    pointer-events: none;
}

.editor-phase6-crop-controls {
    width: min(100%, 760px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 0.8fr) auto;
    align-items: center;
    gap: 12px;
}

.editor-phase6-crop-controls strong,
.editor-phase6-crop-controls small {
    display: block;
}

.editor-phase6-crop-controls strong {
    font-size: 11px;
}

.editor-phase6-crop-controls small {
    margin-top: 2px;
    color: var(--color-muted);
    font-size: 9px;
    line-height: 1.4;
}

.editor-phase6-crop-zoom-control {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(90px, 1fr) 42px;
    align-items: center;
    gap: 8px;
    color: var(--color-muted);
    font-size: 10px;
    font-weight: 800;
}

.editor-phase6-crop-zoom-control input[type="range"] {
    width: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
}

.editor-phase6-crop-zoom-control output {
    color: var(--color-text);
    text-align: right;
}

.editor-phase6-crop-reset {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 10px;
}

@container dj-editor-main (max-width: 720px) {
    .editor-phase6-crop-heading,
    .editor-phase6-crop-controls {
        grid-template-columns: 1fr;
    }

    .editor-phase6-crop-heading {
        display: grid;
    }

    .editor-phase6-crop-tabs {
        width: 100%;
    }

    .editor-phase6-crop-tabs button {
        flex: 1 1 0;
    }

    .editor-phase6-crop-controls {
        width: 100%;
    }
}

@container dj-editor-main (max-width: 520px) {
    .editor-phase6-crop-stage.is-card,
    .editor-phase6-crop-stage.is-modal {
        width: 100%;
    }
}


/* ---------- Editor: filtros ---------- */
.editor-phase6-list-heading {
    align-items: center;
    flex-wrap: wrap;
}

.editor-phase6-list-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.editor-phase6-new-button {
    flex: 0 0 auto;
}

.editor-phase6-tools {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
}

.editor-phase6-filter-search {
    grid-column: span 4;
}

.editor-phase6-filter-tag {
    grid-column: span 3;
}

.editor-phase6-filter-featured {
    grid-column: span 2;
}

.editor-phase6-filter-date {
    grid-column: span 3;
}

.editor-phase6-filter-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.editor-phase6-tools .editor-field,
.editor-phase6-tools .editor-field > *,
.editor-phase6-tag-tools .editor-field,
.editor-phase6-tag-tools .editor-field > * {
    min-width: 0;
}

.editor-phase6-tools input,
.editor-phase6-tools select,
.editor-phase6-tag-tools input {
    width: 100%;
}

/* ---------- Editor: tabla ---------- */
.editor-phase6-table-wrap {
    width: 100%;
    overflow-x: hidden;
}

.editor-phase6-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.editor-phase6-col-thumb {
    width: 74px;
}

.editor-phase6-col-title {
    width: auto;
}

.editor-phase6-col-tag {
    width: 18%;
}

.editor-phase6-col-date {
    width: 20%;
}

.editor-phase6-col-featured {
    width: 58px;
}

.editor-phase6-col-action {
    width: 64px;
}

.editor-phase6-table th,
.editor-phase6-table td {
    min-width: 0;
}

.editor-phase6-table td {
    overflow-wrap: anywhere;
}

.editor-phase6-title-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.editor-phase6-table-thumb {
    width: 58px;
    height: 44px;
    display: block;
    overflow: hidden;
    border: 1px solid var(--color-line);
    border-radius: 9px;
    object-fit: cover;
    object-position: center top;
    background: var(--color-surface-2);
}

.editor-phase6-table-thumb-empty {
    display: grid;
    place-items: center;
    color: var(--color-muted);
    font-size: 11px;
}

.editor-phase6-featured-mark {
    display: inline-grid;
    min-width: 24px;
    place-items: center;
    color: var(--color-muted);
    font-size: 15px;
}

.editor-phase6-featured-mark.is-featured {
    color: #b7791f;
}

.editor-phase6-mobile-meta {
    display: none !important;
    margin-top: 4px !important;
    color: var(--color-muted) !important;
    font-size: 9px !important;
    line-height: 1.35;
}

.editor-phase6-empty-table {
    padding: 18px;
    color: var(--color-muted);
    text-align: center;
}

.editor-phase6-list-card .editor-tour-table tbody tr.is-selected td {
    background: color-mix(in srgb, var(--color-primary) 7%, var(--color-surface));
}

.editor-phase6-list-card .editor-tour-actions-column,
.editor-phase6-list-card .editor-tour-row-actions {
    width: 64px;
}

/* ---------- Editor: autocomplete y etiquetas ---------- */
.editor-phase6-tag-field {
    position: relative;
    min-width: 0;
}

.editor-phase6-suggestions {
    position: absolute;
    z-index: 30;
    top: calc(100% - 2px);
    right: 0;
    left: 0;
    max-height: 230px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--color-line);
    border-radius: 12px;
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.editor-phase6-suggestions[hidden] {
    display: none !important;
}

.editor-phase6-suggestion {
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    display: block;
    border: 0;
    border-radius: 8px;
    color: var(--color-text);
    background: transparent;
    font: inherit;
    font-size: 11px;
    font-weight: 750;
    text-align: left;
    cursor: pointer;
}

.editor-phase6-suggestion:hover,
.editor-phase6-suggestion:focus-visible {
    outline: none;
    background: var(--color-surface-2);
}

.editor-phase6-tag-catalog {
    gap: 14px;
}

.editor-phase6-tag-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.editor-phase6-tag-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
}

.editor-phase6-tag-tools .editor-tour-tool-actions {
    min-width: max-content;
}

.editor-phase6-tag-catalog .editor-tag-cloud {
    max-height: none;
}

.editor-phase6-tag-catalog .editor-tag-catalog-item {
    min-height: 30px;
    padding: 4px 5px 4px 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--color-line);
    border-radius: 999px;
    color: var(--color-primary-strong);
    background: var(--color-surface);
    font-size: 10px;
    font-weight: 800;
}

.editor-phase6-tag-catalog .editor-tag-catalog-item button {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: var(--color-muted);
    background: transparent;
    font: inherit;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.editor-phase6-tag-catalog .editor-tag-catalog-item button:hover,
.editor-phase6-tag-catalog .editor-tag-catalog-item button:focus-visible {
    color: #b42318;
    background: color-mix(in srgb, #b42318 8%, var(--color-surface));
    outline: none;
}

.editor-phase6-tag-pagination {
    margin-top: 2px;
}

/*
 * El ancho relevante es el del panel del Editor, no el viewport completo.
 * Así la distribución se adapta incluso en monitores grandes cuando el
 * sidebar reduce el espacio útil del contenido.
 */
@container dj-editor-main (max-width: 900px) {
    .editor-phase6-filter-search,
    .editor-phase6-filter-tag,
    .editor-phase6-filter-featured,
    .editor-phase6-filter-date {
        grid-column: span 6;
    }

    .editor-phase6-col-tag {
        width: 19%;
    }

    .editor-phase6-col-date {
        width: 22%;
    }
}

@container dj-editor-main (max-width: 720px) {
    .editor-phase6-col-tag,
    .editor-phase6-col-featured,
    .editor-phase6-table th:nth-child(3),
    .editor-phase6-table td:nth-child(3),
    .editor-phase6-table th:nth-child(5),
    .editor-phase6-table td:nth-child(5) {
        display: none;
    }

    .editor-phase6-col-date {
        width: 27%;
    }

    .editor-phase6-mobile-meta {
        display: block !important;
    }
}

@container dj-editor-main (max-width: 560px) {
    .editor-phase6-filter-search,
    .editor-phase6-filter-tag,
    .editor-phase6-filter-featured,
    .editor-phase6-filter-date {
        grid-column: 1 / -1;
    }

    .editor-phase6-filter-actions {
        justify-content: stretch;
    }

    .editor-phase6-filter-actions .editor-icon-button {
        flex: 1 1 0;
        min-height: 42px;
    }

    .editor-phase6-col-date,
    .editor-phase6-table th:nth-child(4),
    .editor-phase6-table td:nth-child(4) {
        display: none;
    }

    .editor-phase6-col-thumb {
        width: 62px;
    }

    .editor-phase6-col-action {
        width: 54px;
    }

    .editor-phase6-table th,
    .editor-phase6-table td {
        padding-right: 8px;
        padding-left: 8px;
    }

    .editor-phase6-table-thumb {
        width: 48px;
        height: 40px;
    }

    .editor-phase6-tag-tools {
        grid-template-columns: 1fr;
    }

    .editor-phase6-tag-tools .editor-tour-tool-actions {
        width: 100%;
        min-width: 0;
    }

    .editor-phase6-tag-tools .editor-icon-button {
        flex: 1 1 0;
    }

    .editor-phase6-tag-heading,
    .editor-phase6-form-actions,
    .editor-phase6-news-form-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .editor-phase6-form-actions-left {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .editor-phase6-form-actions > button,
    .editor-phase6-form-actions-left > button {
        width: 100%;
    }

    .editor-phase6-list-heading-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* Fallback para navegadores sin container queries. */
@media (max-width: 760px) {
    .editor-phase6-tools {
        grid-template-columns: 1fr;
    }

    .editor-phase6-filter-search,
    .editor-phase6-filter-tag,
    .editor-phase6-filter-featured,
    .editor-phase6-filter-date,
    .editor-phase6-filter-actions {
        grid-column: auto;
    }

    .editor-phase6-filter-actions {
        justify-content: stretch;
    }
}
