/*
 * Contentosapp Studio Admin — Content Hub styles.
 * Extracted from costudio-admin.css for tab-specific loading.
 */

.fos-hub-card__inner {
    margin-bottom: 12px;
}

/* ── Central: Header Layers ────────────────────────────────────────────── */

/* Layer 1: Pre-header (Gray background) */
.fos-hub-preheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--fos-bg-soft);
    border-bottom: 1px solid var(--fos-border);
    gap: 16px;
}

.fos-hub-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fos-hub-tab {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border-radius: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--fos-text-sub);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.fos-hub-tab:hover {
    color: var(--fos-primary);
    background: rgba(108, 71, 255, 0.05);
}

.fos-hub-tab.is-active {
    background: #fff;
    color: var(--fos-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.fos-hub-preheader__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Layer 2: Filter Bar (White/Clean) */
.fos-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--fos-border);
    gap: 12px;
    flex-wrap: wrap;
}

.fos-filter-bar__search-wrap {
    position: relative;
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

.fos-filter-bar__search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--fos-text-dim);
    pointer-events: none;
}

.fos-hub-card .fos-filter-bar .fos-filter-bar__search {
    width: 100%;
    padding: 6px 12px 6px 36px;
    border-radius: 8px;
    border: 1px solid var(--fos-border-input);
    background: #fff;
    font-size: 12px;
    line-height: 1.5;
    transition: all 0.15s ease;
    height: 32px;
    min-height: 30px;
    box-sizing: border-box;
}

.fos-hub-card .fos-filter-bar .fos-filter-bar__search:focus {
    border-color: var(--fos-primary);
    box-shadow: 0 0 0 3px var(--fos-primary-faint);
    background: #fff;
}

.fos-filter-bar__filters {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fos-hub-card .fos-filter-bar .fos-filter-bar__select {
    padding: 6px 30px 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--fos-border-input);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px 6px;
    appearance: none;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 500;
    color: var(--fos-text-sub);
    cursor: pointer;
    min-width: 150px;
    max-width: 180px;
    transition: all 0.15s ease;
    height: 32px;
    min-height: 30px;
    box-sizing: border-box;
}

.fos-hub-card .fos-filter-bar .fos-filter-bar__select:focus {
    border-color: var(--fos-primary);
    box-shadow: 0 0 0 3px var(--fos-primary-faint);
}

.fos-filter-bar__spacer {
    display: none;
}

@keyframes fos-tab-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fos-tab-panel.is-active,
.fos-central-tab-panel.is-active {
    animation: fos-tab-fade-in 0.18s ease forwards;
}

/* Toolbar CTA → Nova Produção tab (costudio-content-hub.html .btn-sm.ghost-primary) */
.cts-btn.fos-btn-ghost-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(108, 71, 255, 0.35);
    background: var(--fos-primary-light);
    color: var(--fos-primary);
    text-decoration: none;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    box-sizing: border-box;
    box-shadow: none;
}

.cts-btn.fos-btn-ghost-primary:hover,
.cts-btn.fos-btn-ghost-primary:focus {
    background: var(--fos-primary);
    color: #fff;
    border-color: var(--fos-primary);
    box-shadow: none;
    text-decoration: none;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ── Central table (AJAX-rendered HTML) ─────────────────────────────────────── */

.fos-central-table {
    width: 100%;
    border-collapse: collapse;
}

/* ── Checkbox column ─────────────────────────────────────────────────────── */
.fos-central-table .fos-col-check {
    width: 36px;
    padding: 10px 0 10px 16px !important;
    /* override :first-child rule */
    text-align: center;
}

.fos-central-table .fos-row-checkbox,
.fos-central-table .fos-select-all-rows {
    /* Reset native — !important to override wp-admin/forms.css */
    -webkit-appearance: none !important;
    appearance: none !important;

    /* Geometry */
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    vertical-align: middle;
    position: relative;
    cursor: pointer;

    /* Default look */
    background: var(--fos-surface);
    border: 1.5px solid var(--fos-border-input);
    border-radius: 4px;
    transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

.fos-central-table .fos-row-checkbox:hover,
.fos-central-table .fos-select-all-rows:hover {
    border-color: var(--fos-primary);
    background: var(--fos-primary-faint);
}

.fos-central-table .fos-row-checkbox:focus-visible,
.fos-central-table .fos-select-all-rows:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 71, 255, 0.15);
}

/* Checked — solid primary + white checkmark */
/* !important needed to override wp-admin/forms.css input[type="checkbox"]:checked rules */
.fos-central-table .fos-row-checkbox:checked,
.fos-central-table .fos-select-all-rows:checked {
    background-color: var(--fos-primary) !important;
    border-color: var(--fos-primary) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8l3.5 3.5 6.5-6.5' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 11px 11px !important;
}

/* WP admin injects blue check via input[type=checkbox]:checked::before.
   Disable it here so our white SVG checkmark remains the only icon. */
.fos-central-table .fos-row-checkbox:checked::before,
.fos-central-table .fos-select-all-rows:checked::before,
.fos-central-table .fos-select-all-rows:indeterminate::before {
    content: none !important;
}

/* Indeterminate — solid primary + white minus */
.fos-central-table .fos-select-all-rows:indeterminate {
    background-color: var(--fos-primary) !important;
    border-color: var(--fos-primary) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' stroke='%23fff' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 11px 11px !important;
}

/* Subtle row highlight when selected */
.fos-central-table tbody tr:has(.fos-row-checkbox:checked) {
    background: var(--fos-primary-faint);
}

.fos-central-table tbody tr:has(.fos-row-checkbox:checked):hover {
    background: rgba(108, 71, 255, 0.08);
}

/* CSV button selection counter */
#fos-export-csv-btn .fos-csv-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--fos-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    margin-left: 4px;
}

.fos-central-table thead th:first-child,
.fos-central-table tbody td:first-child {
    padding: 10px 20px;
}

.fos-central-table thead th:last-child,
.fos-central-table tbody td:last-child {
    padding-right: 20px;
}

.fos-central-table thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fos-text-dim);
    font-weight: 600;
    text-align: start;
    background: var(--fos-bg-soft);
    border-bottom: 1px solid #f3f4f6;
}

.fos-central-table tbody td {
    padding: 14px 20px 14px 0px;
    border-bottom: 1px solid transparent;
    vertical-align: middle;
    font-size: 13px;
    color: var(--fos-text);
}

.fos-central-table tbody tr:last-child td {
    border-bottom: none;
}

.fos-central-table tbody tr:hover {
    background: rgba(108, 71, 255, 0.04);
}

.fos-central-priority--empty {
    color: var(--fos-text-dim);
    font-size: 13px;
}

/* WP pagination override (uses Core variable) */
.fos-central-table+div .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    padding: 0 10px;
    border-radius: var(--fos-radius-sm);
    border: 1px solid var(--fos-border);
    font-size: 13px;
    font-weight: 500;
    color: var(--fos-text-sub);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.fos-central-table+div .page-numbers.current,
.fos-central-table+div .page-numbers:hover {
    background: var(--fos-primary);
    color: #fff;
    border-color: var(--fos-primary);
}

/* Content Hub — main card (table variant: no internal padding, full-bleed rows) */
.fos-hub-card--table {
    margin-top: 12px;
}

.fos-hub-card__inner {
    background: #fff;
    border: 1px solid var(--fos-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
    overflow: hidden;
}

/* M9: Empty state do Content Hub — melhorado com ícone, título e CTA */
.fos-central-empty {
    text-align: center;
    padding: 56px 24px;
    color: var(--fos-text-dim);
}

.fos-central-empty__icon {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.75;
}

.fos-central-empty__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--fos-text-sub);
    margin: 0 0 8px;
}

.fos-central-empty__desc {
    font-size: 13px;
    color: var(--fos-text-dim);
    margin: 0 0 20px;
    line-height: 1.5;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

.fos-central-empty__cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--fos-radius-sm);
    background: var(--fos-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--fos-transition);
    box-shadow: 0 2px 8px rgba(108, 71, 255, 0.25);
}

.fos-central-empty__cta:hover {
    background: var(--fos-primary-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 71, 255, 0.35);
    text-decoration: none;
}

.fos-central-pagination {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 4px;
}

.fos-central-row-num {
    color: var(--fos-text-dim);
    font-weight: 600;
    font-size: 12px;
}

.fos-central-cell-title {
    font-weight: 700;
    color: var(--fos-text);
}

/* M7b: Contraste melhorado — text-dim (#6b7280) ainda aprovado mas monospace
   precisa de peso visual extra para compensar a fonte menor */
.fos-central-cell-kw {
    font-size: 11px;
    color: var(--fos-text-sub);
    margin-top: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.fos-central-cell-site {
    font-size: 11px;
    font-weight: 600;
    color: var(--fos-text-sub);
    letter-spacing: 0.03em;
    border-radius: 9px;
    padding: 3px 10px;
}

.fos-central-cell-date {
    font-size: 12px;
    color: var(--fos-text-sub);
}

.fos-central-row-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Status badges — M7: padding unificado 3px 9px (alinhado com .fos-priority-badge) */
.fos-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.fos-status-badge--planned {
    background: #fef3c7;
    color: #92400e;
}

.fos-status-badge--running {
    background: var(--fos-primary-faint);
    color: var(--fos-primary);
}

.fos-status-badge--running::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fos-primary);
    animation: fos-pulse-dot 1.5s ease-in-out infinite;
}

@keyframes fos-pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.fos-status-badge--done {
    background: #e6faf4;
    color: #065f46;
}

.fos-status-badge--draft {
    background: #f8f8f9;
    color: var(--fos-text-sub);
    border: 1px solid var(--fos-border);
}

.fos-status-badge--error {
    background: #fef2f2;
    color: #991b1b;
}

.fos-filter-bar__status {
    min-width: 128px;
}

.fos-filter-bar__priority {
    min-width: 120px;
}

/* M7: Priority badges — padding uniformizado com status badge (3px 9px) */
.fos-priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
}

.fos-priority-badge--high {
    background: #fef2f2;
    color: #b91c1c;
}

.fos-priority-badge--medium {
    background: var(--fos-primary-light, #f3f0ff);
    color: var(--fos-primary, #6c47ff);
}

.fos-priority-badge--low {
    background: #f8f8f9;
    color: var(--fos-text-dim, #6b7280);
}

/* ── Bulk Actions Bar ──────────────────────────────────────────────────────── */

.fos-bulk-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--fos-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, visibility 0.3s;
    pointer-events: none;
}

.fos-bulk-bar.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.fos-bulk-bar__count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--fos-text);
    font-size: 13px;
    padding-right: 16px;
    border-right: 1px solid var(--fos-border);
}

.fos-bulk-bar__count-badge {
    background: var(--fos-primary);
    color: white;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-size: 12px;
}

.fos-bulk-bar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fos-bulk-bar select.cts-input {
    height: 32px;
    padding: 0 30px 0 12px;
    border: 1px solid var(--fos-border);
    border-radius: 6px;
    background-color: #fff;
    color: var(--fos-text);
    font-size: 13px;
    font-weight: 500;
    line-height: normal;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.fos-bulk-bar select.cts-input:hover {
    border-color: var(--fos-text-light, #9ca3af);
}

.fos-bulk-bar select.cts-input:focus {
    outline: none;
    border-color: var(--fos-primary);
    box-shadow: 0 0 0 3px rgba(108, 71, 255, 0.15);
}

.fos-bulk-bar .cts-input,
.fos-bulk-bar .cts-btn {
    margin: 0 !important;
    /* Override potential inherited margins */
}

/* ── Status Pills (unified table) ──────────────────────────────────────────── */

.fos-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    line-height: 1.4;
}

.fos-status-pill--planned {
    background: #fef3c7;
    color: #92400e;
}

.fos-status-pill--queued {
    background: #e0e7ff;
    color: #3730a3;
}

.fos-status-pill--producing {
    background: var(--fos-primary-faint);
    color: var(--fos-primary);
}

.fos-status-pill--published {
    background: #e6faf4;
    color: #065f46;
}

.fos-status-pill--draft {
    background: #f8f8f9;
    color: var(--fos-text-sub);
    border: 1px solid var(--fos-border);
}

.fos-status-pill--error {
    background: #fef2f2;
    color: #991b1b;
}

.fos-status-pill--cancelled {
    background: #F1F5F9;
    color: #64748B;
}

.fos-status-pill--paused {
    background: #FFEDD5;
    color: #9A3412;
}

/* ── Progress bar (producing rows) ────────────────────────────────────────── */

.fos-central-progress {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 90px;
}

.fos-central-progress__bar {
    height: 5px;
    border-radius: 3px;
    background: #e5e7eb;
    overflow: hidden;
}

.fos-central-progress__fill {
    height: 100%;
    border-radius: 3px;
    background: var(--fos-primary);
    transition: width 0.4s ease;
}

.fos-central-progress__label {
    font-size: 10px;
    color: var(--fos-text-dim);
    white-space: nowrap;
}

.fos-central-progress--empty {
    color: var(--fos-text-dim);
    font-size: 13px;
}

/* ── Updated time cell ────────────────────────────────────────────────────── */

.fos-central-cell-updated {
    font-size: 12px;
    color: var(--fos-text-dim);
    white-space: nowrap;
}

.fos-central-cell-site--empty {
    color: var(--fos-text-dim);
}

/* ── Unified table footer ─────────────────────────────────────────────────── */

.fos-central-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--fos-bg-soft);
    border-radius: 10px;
    margin-top: 12px;
}

.fos-central-footer__count {
    font-size: 12px;
    color: var(--fos-text-dim);
    font-weight: 500;
}

.fos-central-footer__perpage {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--fos-text-dim);
}

.fos-central-footer__perpage-label {
    font-weight: 500;
}

.fos-central-footer__perpage-select {
    height: 28px;
    padding: 0 24px 0 10px;
    border: 1px solid var(--fos-border) !important;
    border-color: none !important;
    border-radius: var(--fos-radius-sm) !important;
    background-color: #fff;
    font-size: 12px;
    font-weight: 500;
    color: var(--fos-text);
    cursor: pointer;
    line-height: normal;
    font-size: 13px;
}

.fos-central-footer__perpage-select:focus {
    outline: none;
    border-color: var(--fos-primary);
    box-shadow: 0 0 0 3px rgba(108, 71, 255, 0.15);
}

.fos-central-footer .fos-central-pagination {
    margin: 0;
}

@media (max-width: 782px) {
    .fos-kpi-grid--hub {
        grid-template-columns: 1fr;
    }

    .fos-filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .fos-hub-card .fos-filter-bar .fos-filter-bar__search {
        max-width: none;
        width: 100%;
    }

    .fos-filter-bar__search,
    .fos-filter-bar__site,
    .fos-filter-bar__status,
    .fos-filter-bar__priority {
        width: 100%;
        max-width: none;
    }

    .fos-filter-bar__spacer {
        display: none;
    }

    .fos-filter-bar__right {
        margin-left: 0;
        width: 100%;
        flex-wrap: wrap;
    }
}

/* ── Actions column (v3) ─────────────────────────────────────────────────── */
.fos-central-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.fos-central-actions .fos-btn {
    padding: 0;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: #fff;
    border: 1px solid var(--fos-border);
    color: var(--fos-text-sub);
}

.fos-central-actions .fos-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fos-central-actions .fos-btn:hover {
    border-color: var(--fos-primary);
    color: var(--fos-primary);
    background: var(--fos-primary-faint);
}

.fos-btn--danger-text {
    color: var(--fos-text-dim) !important;
}

.fos-btn--danger-text:hover {
    color: var(--fos-danger) !important;
    border-color: var(--fos-danger) !important;
    background: var(--fos-danger-light) !important;
}

.fos-central-cell-title {
    font-weight: 700;
    color: var(--fos-text);
    /* M10: Limite de largura para garantir o respiro das outras colunas */
    max-width: 520px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Sorting ───────────────────────────────────────────────────────────────── */
.fos-central-table thead th {
    padding: 12px 10px !important;
}

.fos-sortable {
    color: var(--fos-text-dim) !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    transition: color 0.2s;
    white-space: nowrap;
}

.fos-sortable:hover {
    color: var(--fos-primary) !important;
}

.fos-sort-icon {
    font-size: 11px;
    font-weight: 800;
    opacity: 0.8;
    margin-left: 2px;
}