/**
 * Document Manager — front-end styles
 * Clean, minimal, unbranded. Scoped under .docmgr to avoid theme bleed.
 * Tokenized so a host site can override a handful of variables if desired.
 */

.docmgr {
	--docmgr-radius: 14px;
	--docmgr-radius-sm: 10px;
	--docmgr-gap: 16px;
	--docmgr-border: #e5e7eb;        /* slate-200 — light grey border */
	--docmgr-border-hover: #d1d5db;  /* slate-300 */
	--docmgr-bg: #ffffff;            /* card background */
	--docmgr-bg-subtle: #f8fafc;     /* slate-50 — icon chip / hover fill */
	--docmgr-text: #0f172a;          /* slate-900 — near-black, not pure black */
	--docmgr-text-muted: #64748b;    /* slate-500 — counts, dates, excerpts */
	--docmgr-accent: #2563eb;        /* blue-600 — icons, hover arrow */
	--docmgr-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
	--docmgr-shadow-hover: 0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 6px rgba(16, 24, 40, 0.06);
	--docmgr-grid-cols: 0; /* 0 = auto-fill */

	box-sizing: border-box;
	color: var(--docmgr-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}

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

/* ------------------------------------------------------------------ *
 * Types grid
 * ------------------------------------------------------------------ */
.docmgr-types-grid {
	display: grid;
	gap: var(--docmgr-gap);
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* Honor an explicit columns="N" override at wider widths. */
@media (min-width: 760px) {
	.docmgr-types-grid[style*="--docmgr-grid-cols"] {
		grid-template-columns: repeat(var(--docmgr-grid-cols), minmax(0, 1fr));
	}
}

.docmgr-card {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px 18px;
	background: var(--docmgr-bg);
	border: 1px solid var(--docmgr-border);
	border-radius: var(--docmgr-radius);
	box-shadow: var(--docmgr-shadow);
	text-decoration: none;
	color: inherit;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.docmgr-card:hover,
.docmgr-card:focus-visible {
	transform: translateY(-2px);
	border-color: var(--docmgr-border-hover);
	box-shadow: var(--docmgr-shadow-hover);
	outline: none;
}

.docmgr-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex: 0 0 auto;
	border-radius: var(--docmgr-radius-sm);
	background: var(--docmgr-bg-subtle);
	color: var(--docmgr-accent);
}

.docmgr-card__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1 1 auto;
}

.docmgr-card__title {
	font-weight: 600;
	font-size: 1rem;
	letter-spacing: -0.01em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.docmgr-card__count {
	font-size: 0.82rem;
	color: var(--docmgr-text-muted);
	margin-top: 2px;
}

.docmgr-card__arrow {
	flex: 0 0 auto;
	color: var(--docmgr-text-muted);
	opacity: 0;
	transform: translateX(-4px);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.docmgr-card:hover .docmgr-card__arrow,
.docmgr-card:focus-visible .docmgr-card__arrow {
	opacity: 1;
	transform: translateX(0);
	color: var(--docmgr-accent);
}

/* ------------------------------------------------------------------ *
 * Types list
 * ------------------------------------------------------------------ */
.docmgr-types-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--docmgr-border);
	border-radius: var(--docmgr-radius);
	overflow: hidden;
	background: var(--docmgr-bg);
	box-shadow: var(--docmgr-shadow);
}

.docmgr-types-list__item + .docmgr-types-list__item {
	border-top: 1px solid var(--docmgr-border);
}

.docmgr-types-list__item a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px;
	text-decoration: none;
	color: inherit;
	transition: background 0.12s ease, padding-left 0.12s ease;
}

.docmgr-types-list__item a:hover,
.docmgr-types-list__item a:focus-visible {
	background: var(--docmgr-bg-subtle);
	padding-left: 22px;
	outline: none;
}

.docmgr-types-list__name {
	font-weight: 500;
	letter-spacing: -0.01em;
}

.docmgr-types-list__count {
	flex: 0 0 auto;
	min-width: 24px;
	text-align: center;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--docmgr-text-muted);
	background: var(--docmgr-bg-subtle);
	border-radius: 999px;
	padding: 2px 9px;
}

/* ------------------------------------------------------------------ *
 * Documents list
 * ------------------------------------------------------------------ */
.docmgr-documents__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.docmgr-doc__link {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 16px 18px;
	background: var(--docmgr-bg);
	border: 1px solid var(--docmgr-border);
	border-radius: var(--docmgr-radius);
	box-shadow: var(--docmgr-shadow);
	text-decoration: none;
	color: inherit;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.docmgr-doc__link:hover,
.docmgr-doc__link:focus-visible {
	transform: translateY(-2px);
	border-color: var(--docmgr-border-hover);
	box-shadow: var(--docmgr-shadow-hover);
	outline: none;
}

.docmgr-doc__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	flex: 0 0 auto;
	border-radius: var(--docmgr-radius-sm);
	background: var(--docmgr-bg-subtle);
	color: var(--docmgr-accent);
}

.docmgr-doc__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1 1 auto;
}

.docmgr-doc__title {
	font-weight: 600;
	font-size: 1rem;
	letter-spacing: -0.01em;
}

.docmgr-doc__excerpt {
	font-size: 0.86rem;
	color: var(--docmgr-text-muted);
	margin-top: 2px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.docmgr-doc__meta {
	margin-top: 6px;
	font-size: 0.78rem;
	color: var(--docmgr-text-muted);
}

.docmgr-doc__action {
	flex: 0 0 auto;
	color: var(--docmgr-text-muted);
	transition: color 0.15s ease, transform 0.15s ease;
}

.docmgr-doc__link:hover .docmgr-doc__action,
.docmgr-doc__link:focus-visible .docmgr-doc__action {
	color: var(--docmgr-accent);
	transform: translateY(-1px);
}

/* ------------------------------------------------------------------ *
 * Empty state
 * ------------------------------------------------------------------ */
.docmgr-empty {
	padding: 28px 20px;
	text-align: center;
	color: var(--docmgr-text-muted);
	background: var(--docmgr-bg-subtle);
	border: 1px dashed var(--docmgr-border);
	border-radius: var(--docmgr-radius);
	font-size: 0.92rem;
}

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */
@media (max-width: 600px) {
	.docmgr-types-grid {
		grid-template-columns: 1fr;
	}
	.docmgr-card,
	.docmgr-doc__link {
		padding: 14px;
	}
	.docmgr-card__arrow {
		opacity: 1;
		transform: none;
	}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.docmgr * {
		transition: none !important;
	}
}
