.gf-wrap,
.gf-wrap *,
.gf-wrap *::before,
.gf-wrap *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

.gf-wrap {
	--gf-accent: #E32227;
	--gf-radius: 14px;
	--gf-title-fs: 15px;
	--gf-text-fs: 12.5px;
	--gf-columns: 2;
	--gf-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--gf-ink: #17171a;
	--gf-muted: #8a8a90;
	--gf-border: #ececef;

	width: 100%;
	font-family: var(--gf-font);
	color: var(--gf-ink);
}

.gf-wrap svg { display: inline-block; overflow: visible; }
.gf-wrap img { max-width: 100%; display: block; }
.gf-wrap a { text-decoration: none; color: inherit; }

/* ---------- Barra de ferramentas ---------- */
.gf-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 14px;
	margin-bottom: 24px;
}

.gf-heading {
	display: flex;
	align-items: center;
	gap: 10px;
}

.gf-heading-icon { color: var(--gf-accent); flex-shrink: 0; }

.gf-heading-text {
	font-size: 20px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.gf-toolbar-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

/* Pesquisa */
.gf-search {
	position: relative;
	display: flex;
	align-items: center;
}

.gf-search svg {
	position: absolute;
	left: 12px;
	color: var(--gf-muted);
	pointer-events: none;
}

.gf-search-input {
	padding: 9px 14px 9px 34px;
	border-radius: 999px;
	border: 1px solid var(--gf-border);
	font-size: 13px;
	font-family: var(--gf-font);
	min-width: 220px;
	outline: none;
	transition: border-color .2s ease, box-shadow .2s ease;
}

.gf-search-input:focus {
	border-color: var(--gf-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--gf-accent) 14%, transparent);
}

/* Alternador de vista */
.gf-view-toggle {
	display: flex;
	border: 1px solid var(--gf-border);
	border-radius: 8px;
	overflow: hidden;
}

.gf-view-btn {
	width: 36px;
	height: 34px;
	border: 0;
	background: #fff;
	color: var(--gf-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background .2s ease, color .2s ease;
}

.gf-view-btn + .gf-view-btn { border-left: 1px solid var(--gf-border); }

.gf-view-btn:hover { color: var(--gf-accent); }

.gf-view-btn.is-active {
	background: var(--gf-accent);
	color: #fff;
}

/* ---------- Grelha de ficheiros ---------- */
.gf-files-grid {
	display: grid;
	grid-template-columns: repeat(var(--gf-columns), 1fr);
	gap: 22px;
}

.gf-no-results {
	padding: 40px 20px;
	text-align: center;
	color: var(--gf-muted);
	background: #fafafa;
	border: 1px dashed var(--gf-border);
	border-radius: var(--gf-radius);
}

/* ---------- Cartão (vista de grelha) ---------- */
.gf-card {
	background: #fff;
	border: 1px solid var(--gf-border);
	border-radius: var(--gf-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	opacity: 0;
	transform: translateY(14px);
	box-shadow: 0 4px 16px rgba(20,20,25,0.06);
	transition: opacity .5s ease, transform .5s ease, box-shadow .25s ease, border-color .25s ease;
}

.gf-card.gf-in-view { opacity: 1; transform: translateY(0); }

.gf-card:hover {
	box-shadow: 0 8px 22px rgba(20,20,25,0.09);
	border-color: color-mix(in srgb, var(--gf-accent) 30%, var(--gf-border));
}

.gf-card-visual {
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	background: color-mix(in srgb, var(--gf-accent) 6%, #fff);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	padding: 10px;
}

.gf-cover-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform .5s cubic-bezier(.22,1,.36,1);
}

.gf-card:hover .gf-cover-img { transform: scale(1.03); }

.gf-file-icon-wrap {
	position: relative;
	width: 64px;
	height: 76px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--gf-accent);
}

.gf-file-icon-wrap svg { position: relative; z-index: 1; }

.gf-file-badge {
	position: absolute;
	bottom: -6px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--gf-accent);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .03em;
	padding: 3px 8px;
	border-radius: 4px;
	z-index: 2;
	white-space: nowrap;
}

.gf-card-body {
	padding: 16px 18px 10px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	text-align: center;
}

.gf-card-title {
	font-size: var(--gf-title-fs);
	font-weight: 600;
	color: var(--gf-ink);
	line-height: 1.4;
}

.gf-card-meta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: var(--gf-text-fs);
	color: var(--gf-muted);
}

.gf-card-size::after {
	content: '';
	display: inline-block;
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: var(--gf-muted);
	margin-left: 8px;
	vertical-align: middle;
}

.gf-card-footer {
	padding: 12px 18px 18px;
	margin-top: auto;
	border-top: 1px solid var(--gf-border);
	display: flex;
	justify-content: center;
}

.gf-download-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: 1px solid var(--gf-accent);
	background: var(--gf-accent);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	padding: 9px 20px;
	border-radius: 999px;
	transition: filter .2s ease, transform .2s ease;
}

.gf-download-btn:hover {
	filter: brightness(1.08);
	transform: translateY(-1px);
}

/* ---------- Vista de lista ---------- */
.gf-view-list .gf-files-grid {
	grid-template-columns: 1fr;
	gap: 0;
	border: 1px solid var(--gf-border);
	border-radius: var(--gf-radius);
	overflow: hidden;
}

.gf-view-list .gf-card {
	flex-direction: row;
	align-items: center;
	border: 0;
	border-bottom: 1px solid var(--gf-border);
	border-radius: 0;
}

.gf-view-list .gf-card:last-child { border-bottom: 0; }

.gf-view-list .gf-card:hover { box-shadow: none; background: #fafafa; }

.gf-view-list .gf-card-visual {
	width: 60px;
	height: 60px;
	aspect-ratio: auto;
	flex-shrink: 0;
	border-radius: 10px;
	margin: 12px 0 12px 16px;
}

.gf-view-list .gf-file-icon-wrap { width: 40px; height: 48px; }
.gf-view-list .gf-file-icon-wrap svg { width: 24px; height: 24px; }
.gf-view-list .gf-file-badge { font-size: 8px; padding: 2px 6px; bottom: -4px; }

.gf-view-list .gf-card-body {
	flex: 1;
	text-align: left;
	padding: 12px 16px;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.gf-view-list .gf-card-meta { justify-content: flex-end; flex-shrink: 0; }

.gf-view-list .gf-card-footer {
	border-top: 0;
	padding: 12px 16px 12px 0;
	margin-top: 0;
	width: auto;
}

.gf-view-list .gf-download-btn { padding: 8px 16px; }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
	.gf-files-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
	.gf-files-grid { grid-template-columns: 1fr; }
	.gf-toolbar { flex-direction: column; align-items: stretch; }
	.gf-toolbar-right { justify-content: space-between; }
	.gf-search-input { min-width: 0; width: 100%; }

	.gf-view-list .gf-card { flex-direction: column; align-items: stretch; text-align: center; }
	.gf-view-list .gf-card-visual { margin: 16px auto 0; width: 70px; height: 70px; }
	.gf-view-list .gf-card-body { flex-direction: column; text-align: center; }
	.gf-view-list .gf-card-meta { justify-content: center; }
	.gf-view-list .gf-card-footer { justify-content: center; padding: 0 16px 16px; }
}
