/*
 * TPMT Downloads — Frontend Styles
 * Layout variants: list, table, accordion, tabbed, cards
 * The base .tnb-downloads list styles remain in tpmt-news.css.
 */

/* ═══════════════════════════════════════════════════════
   TABLE layout
═══════════════════════════════════════════════════════ */

/* Toolbar: per-page left, search+chips right */
.tnb-dlt-toolbar {
 display: flex;
 flex-wrap: wrap;
 align-items: center;
 justify-content: space-between;
 gap: 10px;
 margin-bottom: 14px;
}
.tnb-dlt-toolbar-left {
 display: flex;
 align-items: center;
}
.tnb-dlt-toolbar-right {
 display: flex;
 flex-wrap: wrap;
 align-items: center;
 gap: 10px;
}

.tnb-dlt-perpage-label {
 display: flex;
 align-items: center;
 gap: 6px;
 font-size: .78rem;
 color: #666;
 white-space: nowrap;
}
.tnb-dlt-perpage {
 padding: 6px 10px;
 border: 1px solid #e0e0e0;
 border-radius: 6px;
 font-size: .78rem;
 color: #1e1e1e;
 background: #fff;
 cursor: pointer;
 outline: none;
 transition: border-color .15s;
}
.tnb-dlt-perpage:focus { border-color: #0d0d0d; }

.tnb-dlt-search {
 flex: 1 1 220px;
 min-width: 160px;
 padding: 9px 14px 9px 36px;
 border: 1px solid #e0e0e0;
 border-radius: 6px;
 font-size: .84rem;
 color: #1e1e1e;
 background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 10px center;
 transition: border-color .15s, box-shadow .15s;
 outline: none;
}
.tnb-dlt-search:focus {
 border-color: #0d0d0d;
 box-shadow: 0 0 0 3px rgba(13,13,13,.08);
}

.tnb-dlt-filters {
 display: flex;
 flex-wrap: wrap;
 gap: 6px;
}

.tnb-dlt-chip {
 padding: 5px 12px;
 border: 1.5px solid #e0e0e0;
 border-radius: 20px;
 background: #fff;
 font-size: .72rem;
 font-weight: 700;
 letter-spacing: .06em;
 cursor: pointer;
 transition: background .15s, border-color .15s, color .15s;
 color: #555;
}
.tnb-dlt-chip:hover { border-color: #0d0d0d; color: #0d0d0d; }
.tnb-dlt-chip--active {
 background: #0d0d0d;
 border-color: #0d0d0d;
 color: #fff;
}
/* Coloured active chip uses the file type colour */
.tnb-dlt-chip--active[data-type]:not([data-type="all"]) {
 background: var(--chip-c, #0d0d0d);
 border-color: var(--chip-c, #0d0d0d);
}

/* Scrollable table wrapper */
.tnb-dlt-wrap {
 overflow-x: auto;
 border-radius: 8px;
 border: 1px solid #ebebeb;
 box-shadow: 0 2px 12px rgba(0,0,0,.05);
}

.tnb-dlt {
 width: 100%;
 border-collapse: collapse;
 font-size: .84rem;
 background: #fff;
}

.tnb-dlt-th {
 padding: 13px 16px;
 text-align: left;
 font-size: .7rem;
 font-weight: 700;
 letter-spacing: .1em;
 text-transform: uppercase;
 color: #888;
 background: #fafafa;
 border-bottom: 1px solid #ebebeb;
 white-space: nowrap;
 cursor: pointer;
 user-select: none;
 transition: color .15s;
}
.tnb-dlt-th:hover { color: #0d0d0d; }

.tnb-sort-icon {
 display: inline-block;
 width: 8px;
 margin-left: 4px;
 vertical-align: middle;
 opacity: .4;
}
.tnb-sort-icon::after { content: '⇅'; }
.tnb-dlt-th[data-dir="asc"]  .tnb-sort-icon { opacity: 1; }
.tnb-dlt-th[data-dir="asc"]  .tnb-sort-icon::after { content: '↑'; }
.tnb-dlt-th[data-dir="desc"] .tnb-sort-icon { opacity: 1; }
.tnb-dlt-th[data-dir="desc"] .tnb-sort-icon::after { content: '↓'; }

.tnb-dlt-row { transition: background .12s; }
.tnb-dlt-row:hover { background: #f8f8f8; }
.tnb-dlt-row[hidden] { display: none; }

.tnb-dlt-cell {
 padding: 12px 16px;
 border-bottom: 1px solid #f0f0f0;
 vertical-align: middle;
}
.tnb-dlt-cell--name {
 display: flex;
 align-items: center;
 gap: 10px;
 font-weight: 500;
}
.tnb-dlt-cell--meta {
 color: #888;
 font-size: .78rem;
 white-space: nowrap;
}
.tnb-dlt-cell--dl { white-space: nowrap; }

.tnb-dlt-badge {
 display: inline-block;
 padding: 2px 7px;
 border-radius: 4px;
 font-size: .64rem;
 font-weight: 700;
 letter-spacing: .06em;
 color: #fff;
 flex-shrink: 0;
 white-space: nowrap;
}

.tnb-dlt-empty {
 text-align: center;
 padding: 28px;
 color: #999;
 font-size: .85rem;
}

/* Table footer: info text + pager */
.tnb-dlt-footer {
 display: flex;
 align-items: center;
 justify-content: space-between;
 flex-wrap: wrap;
 gap: 10px;
 padding: 12px 4px 4px;
}
.tnb-dlt-info {
 font-size: .75rem;
 color: #999;
}
.tnb-dlt-pager {
 display: flex;
 align-items: center;
 gap: 4px;
}
.tnb-dlt-page-btn {
 min-width: 32px;
 height: 32px;
 padding: 0 8px;
 border: 1px solid #e0e0e0;
 border-radius: 6px;
 background: #fff;
 font-size: .78rem;
 color: #444;
 cursor: pointer;
 transition: background .12s, border-color .12s, color .12s;
}
.tnb-dlt-page-btn:hover:not(:disabled) { border-color: #0d0d0d; color: #0d0d0d; }
.tnb-dlt-page-btn.is-active {
 background: #0d0d0d;
 border-color: #0d0d0d;
 color: #fff;
 font-weight: 700;
}
.tnb-dlt-page-btn:disabled { opacity: .35; cursor: default; }

/* ═══════════════════════════════════════════════════════
   ACCORDION layout
═══════════════════════════════════════════════════════ */
.tnb-dl-accordion {
 border: 1px solid #e8e8e8;
 border-radius: 8px;
 overflow: hidden;
 box-shadow: 0 2px 10px rgba(0,0,0,.04);
}

.tnb-dl-acc-item { border-bottom: 1px solid #e8e8e8; }
.tnb-dl-acc-item:last-child { border-bottom: none; }

.tnb-dl-acc-head {
 display: flex;
 align-items: center;
 justify-content: space-between;
 width: 100%;
 padding: 15px 20px;
 background: #fff;
 border: none;
 cursor: pointer;
 text-align: left;
 transition: background .15s;
}
.tnb-dl-acc-head:hover { background: #fafafa; }
.tnb-dl-acc-item.is-open .tnb-dl-acc-head { background: #f6f6f6; }

.tnb-dl-acc-label {
 font-size: .82rem;
 font-weight: 700;
 letter-spacing: .06em;
 text-transform: uppercase;
 color: #1e1e1e;
}
.tnb-dl-acc-count {
 font-weight: 400;
 color: #888;
 font-size: .85em;
 letter-spacing: 0;
}

.tnb-dl-acc-chevron {
 width: 18px;
 height: 18px;
 border-radius: 50%;
 border: 1.5px solid #ccc;
 display: flex;
 align-items: center;
 justify-content: center;
 flex-shrink: 0;
 transition: transform .25s, border-color .15s;
}
.tnb-dl-acc-chevron::after {
 content: '';
 display: block;
 width: 5px;
 height: 5px;
 border-right: 1.5px solid #666;
 border-bottom: 1.5px solid #666;
 transform: rotate(45deg) translateY(-2px);
}
.tnb-dl-acc-item.is-open .tnb-dl-acc-chevron { transform: rotate(180deg); border-color: #0d0d0d; }
.tnb-dl-acc-item.is-open .tnb-dl-acc-chevron::after { border-color: #0d0d0d; }

.tnb-dl-acc-body {
 overflow: hidden;
 max-height: 0;
 transition: max-height .3s ease;
}
.tnb-dl-acc-item.is-open .tnb-dl-acc-body { max-height: 2000px; }
.tnb-dl-acc-body .tnb-downloads { padding: 12px 16px 16px; border-top: 1px solid #f0f0f0; }
.tnb-dl-acc-body .tnb-dl-item { border-radius: 6px; }

/* ═══════════════════════════════════════════════════════
   TABBED layout
═══════════════════════════════════════════════════════ */
.tnb-dl-tabbed {}

.tnb-dl-tab-nav {
 display: flex;
 flex-wrap: wrap;
 gap: 0;
 border-bottom: 2px solid #e8e8e8;
 margin-bottom: 0;
}

.tnb-dl-tab {
 padding: 11px 20px;
 border: none;
 background: none;
 font-size: .78rem;
 font-weight: 600;
 color: #888;
 cursor: pointer;
 border-bottom: 2px solid transparent;
 margin-bottom: -2px;
 white-space: nowrap;
 transition: color .15s, border-color .15s;
}
.tnb-dl-tab:hover { color: #0d0d0d; }
.tnb-dl-tab--active {
 color: #0d0d0d;
 border-bottom-color: #0d0d0d;
}

.tnb-dl-tab-count {
 display: inline-block;
 background: #eee;
 border-radius: 10px;
 padding: 1px 7px;
 font-size: .7em;
 font-weight: 700;
 margin-left: 5px;
 vertical-align: middle;
}
.tnb-dl-tab--active .tnb-dl-tab-count { background: #0d0d0d; color: #fff; }

.tnb-dl-tab-panel { padding-top: 16px; }
.tnb-dl-tab-panel[hidden] { display: none; }

/* ═══════════════════════════════════════════════════════
   CARDS layout
═══════════════════════════════════════════════════════ */
.tnb-dl-cards {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
 gap: 16px;
}

.tnb-dl-card {
 display: flex;
 flex-direction: column;
 background: #fff;
 border: 1px solid #e8e8e8;
 border-radius: 10px;
 overflow: hidden;
 transition: box-shadow .2s, transform .2s;
}
.tnb-dl-card:hover {
 box-shadow: 0 8px 28px rgba(0,0,0,.10);
 transform: translateY(-2px);
}

.tnb-dl-card-icon {
 display: flex;
 align-items: center;
 justify-content: center;
 height: 80px;
 font-size: 1.1rem;
 font-weight: 800;
 letter-spacing: .08em;
 color: #fff;
 flex-shrink: 0;
}

.tnb-dl-card-body {
 flex: 1;
 padding: 14px 16px 10px;
}

.tnb-dl-card-name {
 font-size: .85rem;
 font-weight: 600;
 color: #1e1e1e;
 line-height: 1.4;
 margin-bottom: 6px;
 display: -webkit-box;
 -webkit-line-clamp: 2;
 -webkit-box-orient: vertical;
 overflow: hidden;
}

.tnb-dl-card .tnb-dl-meta {
 font-size: .72rem;
 color: #999;
 margin-bottom: 12px;
}

.tnb-dl-card .tnb-dl-btn {
 margin: 0 16px 16px;
 width: calc(100% - 32px);
 justify-content: center;
}

/* ═══════════════════════════════════════════════════════
   Admin card additions (download set cards)
═══════════════════════════════════════════════════════ */
.tnb-dl-set-preview {
 height: 80px;
 background: linear-gradient(135deg, #1e1e1e 0%, #3a3a3a 100%);
 display: flex;
 align-items: center;
 justify-content: center;
}
.tnb-dl-set-icon-big { font-size: 2rem; }

.tnb-dl-set-badges {
 display: flex;
 align-items: center;
 gap: 6px;
 flex-wrap: wrap;
}

.tnb-dl-layout-pill {
 display: inline-block;
 padding: 2px 8px;
 border-radius: 10px;
 background: #f0f0f0;
 color: #555;
 font-size: .66rem;
 font-weight: 700;
 letter-spacing: .06em;
 text-transform: uppercase;
}

/* Admin file preview rows (inside media picker area) */
.tnb-dlf-file-row {
 display: flex;
 align-items: center;
 gap: 10px;
 padding: 7px 10px;
 border-radius: 5px;
 background: #f8f8f8;
 border: 1px solid #eee;
 margin-bottom: 5px;
}
.tnb-dlf-file-remove {
 flex-shrink: 0;
 margin-left: auto;
 width: 20px;
 height: 20px;
 border-radius: 50%;
 background: transparent;
 color: #aaa;
 border: 1px solid #ddd;
 cursor: pointer;
 font-size: 9px;
 display: flex;
 align-items: center;
 justify-content: center;
 padding: 0;
 transition: background .12s, color .12s;
}
.tnb-dlf-file-remove:hover { background: #e63946; color: #fff; border-color: #e63946; }
.tnb-dlf-file-ext {
 flex-shrink: 0;
 padding: 2px 7px;
 border-radius: 4px;
 font-size: .62rem;
 font-weight: 800;
 letter-spacing: .06em;
 color: #fff;
}
.tnb-dlf-file-name {
 flex: 1;
 font-size: .78rem;
 color: #333;
 overflow: hidden;
 text-overflow: ellipsis;
 white-space: nowrap;
}

/* Files picker preview area override */
.tnb-mp-preview--files {
 flex-direction: column;
 align-items: stretch;
 padding: 10px;
 min-height: 100px;
 max-height: 260px;
 overflow-y: auto;
}
.tnb-mp-preview--files.has-files .tnb-mp-placeholder { display: none; }

/* Responsive */
@media (max-width: 600px) {
 .tnb-dlt-toolbar { flex-direction: column; align-items: stretch; }
 .tnb-dlt-toolbar-left, .tnb-dlt-toolbar-right { width: 100%; }
 .tnb-dlt-search { width: 100%; }
 .tnb-dl-cards { grid-template-columns: 1fr 1fr; }
 .tnb-dl-tab-nav { overflow-x: auto; flex-wrap: nowrap; }
}
@media (max-width: 400px) {
 .tnb-dl-cards { grid-template-columns: 1fr; }
}

/* Empty state */
.tnb-dl-empty-notice {
 margin: 16px 0;
 color: #888;
 font-size: .9em;
 text-align: center;
}
