/* ─── Save-Share Active: Hide media player and text region ────────────────
   Applied when body has class .thx-ec-save-share-active
   (set by JS when the save-share panel tab is selected)               */

/* Hide all direct content children except the THX_EC panels */
body.thx-ec-save-share-active .thx-ec-mp,
body.thx-ec-save-share-active .thx-ec-text-block,
body.thx-ec-save-share-active .wp-block-audio,
body.thx-ec-save-share-active .wp-block-video {
    display: none !important;
}

/* The dynamic stage (where excerpt renders) should expand to full width */
body.thx-ec-save-share-active #thx-ec-dynamic-stage {
    width: 100%;
}

/* ─── Excerpt Module Styles ─────────────────────────────────────────── */

/* thx-ec-pt-excerpt.css – Excerpt module styles */



.thx-ec-excerpt-app {
    padding: 12px 16px;
}

.thx-ec-excerpt-header {
    margin-bottom: 12px;
}

.thx-ec-excerpt-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

/* List - 4 Column Grid */
.thx-ec-excerpt-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 8px 0;
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .thx-ec-excerpt-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .thx-ec-excerpt-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .thx-ec-excerpt-list {
        grid-template-columns: 1fr;
    }
}

/* Card - Vertical Layout for Grid */
.thx-ec-excerpt-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    padding: 10px;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    height: 100%;
}

.thx-ec-excerpt-card:hover {
    transform: translateY(-4px);
    border-color: #e2e8f0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
}

/* Header/Thumbnail Area - Top Image */
.thx-ec-excerpt-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.thx-ec-excerpt-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thx-ec-excerpt-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Content Area */
.thx-ec-excerpt-content {
    flex: 1;
    min-width: 0;
    /* Allow text truncate */
    display: flex;
    flex-direction: column;
}

.thx-ec-excerpt-header {
    margin-bottom: 6px;
}

.thx-ec-excerpt-view-link {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.thx-ec-excerpt-view-link:hover {
    color: #6366f1;
}

.thx-ec-excerpt-source {
    font-size: 10px;
    color: #94a3b8;
    display: flex;
    align-items: center;
}

.thx-ec-excerpt-doc-link {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thx-ec-excerpt-doc-link:hover {
    color: #475569;
    text-decoration: underline;
}

.thx-ec-excerpt-text {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    font-style: italic;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
    /* Force height for 2 lines */
}

/* Edit Form — visible when card is-editing */
.thx-ec-excerpt-card.is-editing .thx-ec-excerpt-edit-form {
    display: block;
}

.thx-ec-excerpt-card.is-editing .thx-ec-excerpt-text,
.thx-ec-excerpt-card.is-editing .thx-ec-excerpt-actions,
.thx-ec-excerpt-card.is-editing .thx-ec-excerpt-media {
    display: none;
}

/* Actions - Compact Row */
.thx-ec-excerpt-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    padding-top: 8px;
}

.thx-ec-excerpt-btn-edit,
.thx-ec-excerpt-btn-toggle,
.thx-ec-excerpt-btn-copy,
.thx-ec-excerpt-btn-delete {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    background: #f1f5f9;
    color: #64748b;
    line-height: 1;
}

.thx-ec-excerpt-btn-copy {
    background: #eef2ff;
    color: #6366f1;
    padding: 6px 14px;
}

.thx-ec-excerpt-btn-copy:hover {
    background: #6366f1;
    color: #fff;
}

.thx-ec-excerpt-btn-copy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
    color: #94a3b8;
}

.thx-ec-excerpt-btn-delete {
    margin-left: auto;
    background: transparent;
    color: #94a3b8;
    padding: 6px 8px;
}

.thx-ec-excerpt-btn-delete:hover {
    color: #ef4444;
}

.thx-ec-excerpt-btn-edit:hover,
.thx-ec-excerpt-btn-toggle:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Pagination Styles */
.thx-ec-pagination-container {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.thx-ec-pagination {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 6px;
    align-items: center;
}

.thx-ec-pagination li {
    display: inline-flex;
}

.thx-ec-pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    color: #64748b;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.thx-ec-pagination li.active a {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.thx-ec-pagination a:hover:not(.active) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.thx-ec-pagination-dots {
    color: #94a3b8;
    padding: 0 4px;
}

/* Empty state */
.thx-ec-excerpt-empty {
    grid-column: 1 / -1;
    color: #94a3b8;
    font-size: 15px;
    text-align: center;
    padding: 48px 0;
}

/* ─── Rich Text Note Editor ────────────────────────────────────────────── */

/* Contenteditable Note Area */
.thx-ec-excerpt-note[contenteditable] {
    min-height: 180px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
    background: #fff;
    outline: none;
    cursor: text;
    word-break: break-word;
}

.thx-ec-excerpt-note[contenteditable]:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

.thx-ec-excerpt-note[contenteditable]:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    pointer-events: none;
}

/* Toolbar */
.thx-ec-note-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px 10px 0 0;
    flex-wrap: wrap;
}

.thx-ec-note-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    transition: all 0.15s;
    position: relative;
    padding: 0;
}

.thx-ec-note-tb-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.thx-ec-note-tb-btn:active {
    background: #cbd5e1;
}

.thx-ec-note-tb-sep {
    width: 1px;
    height: 18px;
    background: #e2e8f0;
    margin: 0 4px;
}

/* Color Indicator (small bar under A / bg icon) */
.thx-ec-color-indicator {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 3px;
    border-radius: 2px;
}

/* Color Picker Wrapper */
.thx-ec-note-color-picker {
    position: relative;
    display: inline-flex;
}

/* Color Dropdown */
.thx-ec-note-color-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    width: 130px;
}

.thx-ec-note-color-picker:not(.is-open) .thx-ec-note-color-dropdown {
    display: none;
}

.thx-ec-note-color-picker.is-open .thx-ec-note-color-dropdown {
    display: grid;
}

/* Color Swatch */
.thx-ec-note-color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.thx-ec-note-color-swatch:hover {
    transform: scale(1.2);
    border-color: #94a3b8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Edit form adjustments for rich editor */
.thx-ec-excerpt-edit-form {
    display: none;
    margin-top: 8px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px dashed #cbd5e1;
}

.thx-ec-excerpt-edit-form label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 6px;
    margin-top: 10px;
}

.thx-ec-excerpt-edit-form label:first-child {
    margin-top: 0;
}

.thx-ec-excerpt-input-title {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    background: #fff;
    outline: none;
    box-sizing: border-box;
}

.thx-ec-excerpt-input-title:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

.thx-ec-excerpt-edit-actions {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thx-ec-excerpt-btn-done {
    padding: 6px 16px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.thx-ec-excerpt-btn-done:hover {
    background: #4f46e5;
}

.thx-ec-excerpt-save-status {
    font-size: 11px;
    color: #94a3b8;
}

.thx-ec-excerpt-save-status.is-saving {
    color: #f59e0b;
}

/* ─── Note display on public page ──────────────────────────────────────── */
.thx-ec-note-box span[style] {
    /* Ensure inline styles from rich editor render properly on public page */
    display: inline;
}
