/*
 * Custom Download Listing — Frontend v1.0
 * Clean table layout, type badges, search, download button.
 */

.cdl-wrap {
	font-family : 'Segoe UI', system-ui, -apple-system, sans-serif;
	width       : 100%;
	box-sizing  : border-box;
	color       : #1e293b;
}

.cdl-wrap *, .cdl-wrap *::before, .cdl-wrap *::after { box-sizing: border-box; }

/* ── Empty ───────────────────────────────────────────── */
.cdl-empty {
	color      : #94a3b8;
	font-style : italic;
	padding    : 1.5rem 0;
}

/* ── Toolbar ─────────────────────────────────────────── */
.cdl-toolbar {
	display         : flex;
	align-items     : center;
	justify-content : space-between;
	gap             : 12px;
	margin-bottom   : 14px;
	flex-wrap       : wrap;
}

.cdl-search-box {
	position    : relative;
	flex        : 1;
	max-width   : 340px;
}

.cdl-search-box svg {
	position    : absolute;
	left        : 11px;
	top         : 50%;
	transform   : translateY(-50%);
	width       : 16px;
	height      : 16px;
	color       : #94a3b8;
	pointer-events: none;
}

.cdl-search {
	width         : 100%;
	height        : 38px;
	border        : 1px solid #e2e8f0;
	border-radius : 8px;
	padding       : 0 12px 0 36px;
	font-size     : .875rem;
	color         : #1e293b;
	background    : #fff;
	outline       : none;
	transition    : border-color .2s, box-shadow .2s;
}

.cdl-search:focus {
	border-color : #0073aa;
	box-shadow   : 0 0 0 3px rgba(0,115,170,.12);
}

.cdl-file-count {
	font-size   : .8rem;
	color       : #94a3b8;
	white-space : nowrap;
}

/* ── Table wrapper ───────────────────────────────────── */
.cdl-table-wrap {
	overflow-x    : auto;
	border        : 1px solid #e2e8f0;
	border-radius : 12px;
	box-shadow    : 0 1px 6px rgba(0,0,0,.05);
}

.cdl-table {
	width           : 100%;
	border-collapse : collapse;
	font-size       : .875rem;
	min-width       : 540px;
}

/* ── Table head ──────────────────────────────────────── */
.cdl-table thead tr {
	background : #0f172a;
}

.cdl-table th {
	padding       : 13px 16px;
	font-size     : .72rem;
	font-weight   : 700;
	color         : #94a3b8;
	text-transform: uppercase;
	letter-spacing: .07em;
	text-align    : left;
	white-space   : nowrap;
	border        : none;
}

.cdl-th-num    { width: 48px; text-align: center; }
.cdl-th-action { text-align: center; }
.cdl-th-count  { text-align: center; }

/* ── Table body rows ─────────────────────────────────── */
.cdl-table tbody tr {
	background    : #fff;
	border-bottom : 1px solid #f1f5f9;
	transition    : background .15s;
}

.cdl-table tbody tr:last-child { border-bottom: none; }

.cdl-table tbody tr:nth-child(even) { background: #f8faff; }

.cdl-table tbody tr:hover { background: #f0f7ff !important; }

.cdl-table td {
	padding    : 14px 16px;
	vertical-align: middle;
	border     : none;
	color      : #334155;
}

.cdl-num {
	text-align  : center;
	color       : #94a3b8;
	font-size   : .78rem;
	font-weight : 600;
}

/* ── File title ──────────────────────────────────────── */
.cdl-file-name {
	font-weight : 600;
	color       : #0f172a;
	font-size   : .9rem;
}

/* ── Description ─────────────────────────────────────── */
.cdl-td-desc {
	color     : #64748b;
	font-size : .84rem;
	max-width : 260px;
}

/* ── Type badge ──────────────────────────────────────── */
.cdl-type-badge {
	display       : inline-block;
	padding       : 3px 10px;
	border-radius : 100px;
	font-size     : .72rem;
	font-weight   : 700;
	letter-spacing: .04em;
	white-space   : nowrap;
}

/* ── Category pill ───────────────────────────────────── */
.cdl-cat-pill {
	display       : inline-block;
	background    : #f0f7ff;
	border        : 1px solid #bfdbfe;
	color         : #1d4ed8;
	border-radius : 100px;
	padding       : 2px 9px;
	font-size     : .72rem;
	font-weight   : 600;
	white-space   : nowrap;
}

.cdl-dash { color: #cbd5e1; }

/* ── Meta (version + size) ───────────────────────────── */
.cdl-td-meta {
	white-space : nowrap;
}

.cdl-ver {
	display       : inline-block;
	background    : #f8faff;
	border        : 1px solid #e0eaff;
	color         : #475569;
	border-radius : 5px;
	padding       : 2px 7px;
	font-size     : .72rem;
	font-family   : 'Cascadia Code', Consolas, monospace;
	margin-bottom : 3px;
}

.cdl-size {
	display    : block;
	font-size  : .72rem;
	color      : #94a3b8;
	margin-top : 2px;
}

/* ── Download count ──────────────────────────────────── */
.cdl-td-count { text-align: center; }

.cdl-count-val {
	display     : inline-flex;
	align-items : center;
	gap         : 4px;
	font-size   : .84rem;
	font-weight : 600;
	color       : #475569;
}

.cdl-count-val svg {
	width   : 14px;
	height  : 14px;
	color   : #94a3b8;
	flex-shrink: 0;
}

/* ── Download button ─────────────────────────────────── */
.cdl-td-action { text-align: center; }

.cdl-dl-btn {
	display         : inline-flex;
	align-items     : center;
	justify-content : center;
	background      : #0073aa;
	color           : #fff !important;
	border-radius   : 7px;
	padding         : 6px 8px;
	text-decoration : none !important;
	white-space     : nowrap;
	transition      : background .18s, transform .18s, box-shadow .18s;
	box-shadow      : 0 1px 4px rgba(0,115,170,.22);
	line-height     : 1;
}

.cdl-dl-btn:hover {
	background : #005d8c;
	transform  : translateY(-1px);
	box-shadow : 0 3px 8px rgba(0,115,170,.32);
}

.cdl-dl-btn svg {
	width      : 16px;
	height     : 16px;
	flex-shrink: 0;
	display    : block;
}

/* Hide the text label — icon only */
.cdl-dl-btn span { display: none; }

.cdl-dl-btn.cdl-downloading {
	opacity : .7;
	pointer-events: none;
}

.cdl-unavailable {
	color     : #cbd5e1;
	font-size : .8rem;
	font-style: italic;
}

/* ── No results ──────────────────────────────────────── */
.cdl-no-results {
	color      : #94a3b8;
	font-style : italic;
	padding    : 1rem 0;
	font-size  : .875rem;
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 600px) {
	.cdl-toolbar { flex-direction: column; align-items: flex-start; }
	.cdl-search-box { max-width: 100%; width: 100%; }
	.cdl-th-desc, .cdl-td-desc, .cdl-th-meta, .cdl-td-meta { display: none; }
}
