/**
 * Woo Support & Downloads Manager – Frontend styles
 *
 * Layout: two-column (.sd-wrap)
 *   .sd-nav     30 % – dark left sidebar navigation
 *   .sd-content 70 % – filter bar, product list, detail views
 *
 * Minimal, modern, no heavy framework.
 * All selectors are prefixed with .sd- to avoid theme conflicts.
 */

/* ── Root / Layout ────────────────────────────────────────────────────── */
.sd-wrap {
	display: flex;
	min-height: 520px;
	border: 1px solid #dde1e7;
	border-radius: 8px;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #374151;
	box-sizing: border-box;
}

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

/* ── Left navigation ──────────────────────────────────────────────────── */
.sd-nav {
	width: 28%;
	min-width: 160px;
	background: #1e2d3d;
	flex-shrink: 0;
}

.sd-nav-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 18px 20px;
	color: #8b9bb0;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	border-left: 3px solid transparent;
	user-select: none;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
	outline: none;
}

.sd-nav-item:hover {
	background: rgba(255, 255, 255, 0.06);
	color: #e2e8f0;
}

.sd-nav-item.is-active {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	border-left-color: #3b82f6;
}

.sd-nav-item:focus-visible {
	outline: 2px solid #3b82f6;
	outline-offset: -2px;
}

.sd-nav-icon {
	font-size: 18px;
	line-height: 1;
}

.sd-nav-label {
	line-height: 1.3;
}

/* ── Right content area ───────────────────────────────────────────────── */
.sd-content {
	flex: 1;
	min-width: 0;
	overflow: auto;
}

.sd-section {
	padding: 24px;
	min-height: 100%;
}

/* ── Section header ────────────────────────────────────────────────────── */
.sd-section-header {
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 1px solid #e9ecef;
}

.sd-section-header h2 {
	font-size: 20px;
	font-weight: 700;
	color: #111827;
	margin: 0 0 4px;
	padding: 0;
	border: 0;
}

.sd-section-header p {
	color: #6b7280;
	margin: 0;
	font-size: 13px;
}

/* ── Filter bar ────────────────────────────────────────────────────────── */
.sd-filter-bar {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 20px;
}

.sd-cat-chain {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	flex: 1;
}

.sd-cat-select {
	padding: 8px 12px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13px;
	color: #374151;
	background: #fff;
	cursor: pointer;
	min-width: 150px;
	max-width: 220px;
	transition: border-color 0.15s, box-shadow 0.15s;
	-webkit-appearance: auto;
	appearance: auto;
}

.sd-cat-select:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Search box */
.sd-search-box {
	position: relative;
	flex-shrink: 0;
	width: 240px;
}

.sd-search-input {
	width: 100%;
	padding: 8px 36px 8px 12px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13px;
	color: #374151;
	background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.sd-search-input:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Search spinner */
.sd-search-spinner {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	border: 2px solid #d1d5db;
	border-top-color: #3b82f6;
	border-radius: 50%;
	display: none;
}

.sd-search-spinner.is-spinning {
	display: block;
	animation: sd-spin 0.6s linear infinite;
}

/* ── Product list ──────────────────────────────────────────────────────── */
.sd-product-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	overflow: hidden;
}

.sd-product-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 16px;
	border-bottom: 1px solid #f3f4f6;
	cursor: pointer;
	transition: background 0.12s;
	outline: none;
}

.sd-product-row:last-child {
	border-bottom: none;
}

.sd-product-row:hover,
.sd-product-row:focus-visible {
	background: #f8fafc;
}

.sd-product-row:focus-visible {
	outline: 2px solid #3b82f6;
	outline-offset: -2px;
}

.sd-sku-badge {
	display: inline-block;
	padding: 2px 8px;
	background: #eff6ff;
	color: #1d4ed8;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.3px;
	white-space: nowrap;
	flex-shrink: 0;
}

.sd-product-name {
	flex: 1;
	color: #374151;
	font-size: 13px;
}

.sd-row-arrow {
	color: #9ca3af;
	font-size: 18px;
	flex-shrink: 0;
	line-height: 1;
}

/* Load more */
.sd-load-more-btn {
	display: block;
	width: 100%;
	margin-top: 12px;
	padding: 10px;
	background: #f9fafb;
	border: 1px dashed #d1d5db;
	border-radius: 6px;
	color: #3b82f6;
	cursor: pointer;
	font-size: 13px;
	text-align: center;
	transition: background 0.15s, border-color 0.15s;
}

.sd-load-more-btn:hover {
	background: #eff6ff;
	border-color: #3b82f6;
}

/* ── Empty state ───────────────────────────────────────────────────────── */
.sd-empty-state {
	text-align: center;
	padding: 40px 20px;
	color: #9ca3af;
	font-size: 14px;
	margin: 0;
}

/* ── Spinner ───────────────────────────────────────────────────────────── */
.sd-spinner {
	display: flex;
	justify-content: center;
	padding: 36px;
}

.sd-spinner span {
	display: block;
	width: 28px;
	height: 28px;
	border: 3px solid #e5e7eb;
	border-top-color: #3b82f6;
	border-radius: 50%;
	animation: sd-spin 0.65s linear infinite;
}

@keyframes sd-spin {
	to { transform: rotate(360deg); }
}

/* ── Detail panels ─────────────────────────────────────────────────────── */
.sd-detail {
	animation: sd-fade-up 0.18s ease both;
}

@keyframes sd-fade-up {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0);   }
}

.sd-back-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: none;
	padding: 0 0 14px;
	color: #3b82f6;
	font-size: 13px;
	cursor: pointer;
	transition: color 0.15s;
}

.sd-back-btn:hover {
	color: #1d4ed8;
}

.sd-detail-title {
	font-size: 17px;
	font-weight: 600;
	color: #111827;
	margin: 0 0 18px;
}

/* ── Video grid ────────────────────────────────────────────────────────── */
.sd-videos-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

.sd-video-card {
	border-radius: 8px;
	overflow: hidden;
	background: #f3f4f6;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* 16:9 ratio wrapper */
.sd-video-ratio {
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
}

.sd-video-ratio iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
}

/* ── Downloads table ───────────────────────────────────────────────────── */
.sd-downloads-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.sd-dl-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.sd-dl-table thead tr {
	background: #f8fafc;
}

.sd-dl-table th {
	padding: 9px 14px;
	text-align: left;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #6b7280;
	border-bottom: 2px solid #e5e7eb;
	white-space: nowrap;
}

.sd-dl-table td {
	padding: 11px 14px;
	border-bottom: 1px solid #f3f4f6;
	color: #374151;
	vertical-align: middle;
}

.sd-dl-table tbody tr:last-child td {
	border-bottom: none;
}

.sd-dl-table tbody tr:hover td {
	background: #f8fafc;
}

/* File type badge */
.sd-type-badge {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	white-space: nowrap;
}

.sd-type-firmware  { background: #fef3c7; color: #92400e; }
.sd-type-driver    { background: #dbeafe; color: #1e40af; }
.sd-type-software  { background: #d1fae5; color: #065f46; }
.sd-type-manual    { background: #f3e8ff; color: #6b21a8; }
.sd-type-datasheet { background: #fee2e2; color: #991b1b; }
.sd-type-other     { background: #f1f5f9; color: #475569; }

/* Download button */
.sd-dl-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 14px;
	background: #3b82f6;
	color: #fff !important;
	border-radius: 5px;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none !important;
	white-space: nowrap;
	transition: background 0.15s;
}

.sd-dl-btn:hover {
	background: #2563eb;
	color: #fff !important;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
	.sd-wrap {
		flex-direction: column;
		border-radius: 6px;
	}

	.sd-nav {
		width: 100%;
		display: flex;
		flex-direction: row;
	}

	.sd-nav-item {
		flex: 1;
		justify-content: center;
		border-left: none;
		border-bottom: 3px solid transparent;
		padding: 14px 10px;
		font-size: 13px;
	}

	.sd-nav-item.is-active {
		border-left: none;
		border-bottom-color: #3b82f6;
	}

	.sd-filter-bar {
		flex-direction: column;
	}

	.sd-search-box {
		width: 100%;
	}

	.sd-videos-grid {
		grid-template-columns: 1fr;
	}
}

@media screen and (max-width: 480px) {
	.sd-section {
		padding: 16px;
	}

	.sd-dl-table th:nth-child(3),
	.sd-dl-table td:nth-child(3) {
		display: none; /* hide Version column on very small screens */
	}
}
