/**
 * Gado Custom Plugins – Front-end Styles
 *
 * Grid system, card component, filters, pagination,
 * lightbox overlay, and responsive breakpoints.
 *
 * @package Gado_Custom_Plugins
 */

/* ==================================================================
 *  CSS Custom Properties (easy theming)
 * ================================================================*/
:root {
	--gado-primary:       #2563eb;
	--gado-primary-hover: #1d4ed8;
	--gado-accent:        #FFC300;
	--gado-accent-dark:   #e6af00;
	--gado-text:          #1e293b;
	--gado-text-light:    #64748b;
	--gado-bg:            #ffffff;
	--gado-surface:       #f8fafc;
	--gado-border:        #e2e8f0;
	--gado-radius:        8px;
	--gado-radius-sm:     5px;
	--gado-shadow:        0 1px 4px rgba(0, 0, 0, 0.08);
	--gado-shadow-hover:  0 8px 24px rgba(0, 0, 0, 0.12);
	--gado-gap:           24px;
}

/* ==================================================================
 *  ARCHIVE PAGE WRAPPER
 * ================================================================*/
.gado-archive-page {
	max-width: 1400px;
	margin: 0 auto;
	padding: 20px;
}

/* ==================================================================
 *  GRID
 * ================================================================*/
.gado-grid {
	display: grid;
	gap: var(--gado-gap);
}

.gado-cols-1 { grid-template-columns: 1fr; }
.gado-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gado-cols-3 { grid-template-columns: repeat(3, 1fr); }
.gado-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* List view – single column with horizontal cards */
.gado-view-list {
	grid-template-columns: 1fr !important;
}

.gado-view-list .gado-card {
	display: flex;
	flex-direction: row;
}

.gado-view-list .gado-card__thumb {
	flex: 0 0 260px;
	max-height: 200px;
	aspect-ratio: unset;
}

.gado-view-list .gado-card__thumb .gado-card__img,
.gado-view-list .gado-card__thumb .gado-card__img-placeholder {
	height: 100%;
}

/* ==================================================================
 *  CARD
 * ================================================================*/
.gado-card {
	display: flex;
	flex-direction: column;
	background: var(--gado-bg);
	border: 1px solid var(--gado-border);
	border-radius: var(--gado-radius);
	overflow: hidden;
	box-shadow: var(--gado-shadow);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gado-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--gado-shadow-hover);
}

/* ── Thumbnail ── */
.gado-card__thumb {
	display: block;
	overflow: hidden;
	aspect-ratio: 16 / 10;
	position: relative;  /* needed for badge overlay */
	background: var(--gado-surface);
}

.gado-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.gado-card:hover .gado-card__img {
	transform: scale(1.05);
}

/* Placeholder shown when no featured image */
.gado-card__img-placeholder {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
	display: flex;
	align-items: center;
	justify-content: center;
}

.gado-card__img-placeholder::after {
	content: '';
	display: block;
	width: 48px;
	height: 48px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z'/%3E%3Cpath d='M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5L11.6 6.9a.5.5 0 0 0-.7.1l-3.4 4.7-1.3-1.6a.5.5 0 0 0-.8.1L1 13.667V3a1 1 0 0 1 1-1h12z'/%3E%3C/svg%3E") center/contain no-repeat;
	opacity: 0.6;
}

/* Category badge on thumbnail */
.gado-card__badge {
	position: absolute;
	bottom: 10px;
	left: 10px;
	display: inline-block;
	padding: 3px 10px;
	background: rgba(0, 0, 0, 0.58);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-radius: 30px;
	line-height: 1.4;
	white-space: nowrap;
	max-width: calc(100% - 20px);
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Body ── */
.gado-card__body {
	padding: 16px 20px 20px;
	display: flex;
	flex-direction: column;
	flex: 1;
}

/* ── Meta row ── */
.gado-card__meta {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 0.8rem;
	color: var(--gado-text-light);
	margin-bottom: 8px;
}

.gado-icon {
	flex-shrink: 0;
	opacity: 0.65;
	vertical-align: middle;
}

/* ── Title ── */
.gado-card__title {
	margin: 0 0 10px;
	font-size: 1.05rem;
	line-height: 1.4;
	text-transform: none !important;  /* override theme capitalize */
}

.gado-card__title a {
	color: var(--gado-text);
	text-decoration: none;
	text-transform: none !important;
}

.gado-card__title a:hover {
	color: var(--gado-primary);
}

/* ── Excerpt ── */
.gado-card__excerpt {
	font-size: 0.9rem;
	color: var(--gado-text-light);
	margin-bottom: 16px;
	flex: 1;
	line-height: 1.6;
}

.gado-card__excerpt p {
	margin: 0;
	text-transform: none !important;  /* override theme capitalize */
}

/* ── Read More ── */
.gado-card__more {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--gado-primary);
	text-decoration: none;
	padding: 6px 14px 6px 0;
	border-bottom: 2px solid transparent;
	transition: color 0.15s, border-color 0.15s;
}

.gado-card__more:hover {
	color: var(--gado-primary-hover);
	border-bottom-color: var(--gado-primary-hover);
}

.gado-card__more svg {
	transition: transform 0.2s ease;
}

.gado-card__more:hover svg {
	transform: translateX(3px);
}

/* ==================================================================
 *  FILTERS
 * ================================================================*/

/* Single flat row — all fields + buttons inline, labels above */
.gado-filters {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: wrap !important;
	align-items: flex-end !important;
	gap: 12px 14px !important;
	margin-bottom: var(--gado-gap);
	padding: 18px 20px;
	background: var(--gado-surface);
	border: 1px solid var(--gado-border);
	border-radius: var(--gado-radius);
	box-sizing: border-box;
}

/* Each labelled field — stacks label on top of input */
.gado-filter-field {
	display: flex !important;
	flex-direction: column !important;
	gap: 5px;
	min-width: 0;
}

/* Actions group: Filter + Clear buttons stacked in same column */
.gado-filter-actions {
	display: flex !important;
	flex-direction: row !important;
	align-items: flex-end !important;
	gap: 8px;
}

/* Toggle group: pushed right */
.gado-filter-toggle {
	display: flex !important;
	flex-direction: column !important;
	gap: 5px;
	margin-left: auto;
}

/* Invisible spacer keeps buttons baseline-aligned with inputs */
.gado-filter-label--hidden {
	display: block;
	visibility: hidden;
	pointer-events: none;
	user-select: none;
	font-size: 0.72rem;
	line-height: 1.2;
}

/* Labels */
.gado-filter-label {
	display: block !important;
	font-size: 0.72rem !important;
	font-weight: 700 !important;
	letter-spacing: 0.06em !important;
	text-transform: uppercase !important;
	color: var(--gado-text-light) !important;
	margin: 0 !important;
	padding: 0 !important;
	line-height: 1.2;
}

/* Search: icon inset */
.gado-input-icon-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.gado-input-icon-wrap > svg {
	position: absolute;
	left: 10px;
	color: var(--gado-text-light);
	pointer-events: none;
}

.gado-input-icon-wrap > input {
	padding-left: 32px !important;
}

/* All inputs & selects */
.gado-filter-field input[type="text"],
.gado-filter-field input[type="date"],
.gado-filter-field select {
	display: block !important;
	width: 170px !important;
	padding: 8px 12px !important;
	border: 1px solid var(--gado-border) !important;
	border-radius: var(--gado-radius-sm) !important;
	font-size: 0.88rem !important;
	background: #fff !important;
	color: var(--gado-text) !important;
	box-sizing: border-box;
	margin: 0 !important;
	line-height: normal;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.gado-filter-field input:focus,
.gado-filter-field select:focus {
	outline: none !important;
	border-color: var(--gado-primary) !important;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

/* Buttons */
.gado-btn {
	display: inline-flex !important;
	align-items: center !important;
	gap: 6px;
	padding: 9px 20px !important;
	font-size: 0.88rem !important;
	font-weight: 600 !important;
	border: 2px solid var(--gado-primary) !important;
	border-radius: var(--gado-radius-sm) !important;
	cursor: pointer;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
	text-decoration: none !important;
	background: var(--gado-primary) !important;
	color: #fff !important;
	white-space: nowrap;
	line-height: 1 !important;
	box-sizing: border-box;
}

.gado-btn:hover {
	background: var(--gado-primary-hover) !important;
	border-color: var(--gado-primary-hover) !important;
	color: #fff !important;
}

.gado-btn--ghost {
	background: transparent !important;
	border-color: var(--gado-border) !important;
	color: var(--gado-text-light) !important;
}

.gado-btn--ghost:hover {
	background: var(--gado-border) !important;
	color: var(--gado-text) !important;
}

.gado-btn--outline {
	background: transparent !important;
	color: var(--gado-primary) !important;
}

.gado-btn--outline:hover {
	background: var(--gado-primary) !important;
	color: #fff !important;
}

/* View toggle pill */
.gado-view-toggle {
	display: flex !important;
	flex-direction: row !important;
	gap: 2px;
	background: #fff;
	border: 1px solid var(--gado-border);
	border-radius: var(--gado-radius-sm);
	padding: 3px;
}

.gado-view-btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: none !important;
	border-radius: 3px;
	background: transparent !important;
	color: var(--gado-text-light) !important;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	padding: 0 !important;
}

.gado-view-btn:hover {
	background: var(--gado-surface) !important;
	color: var(--gado-text) !important;
}

.gado-view-btn.active {
	background: var(--gado-primary) !important;
	color: #fff !important;
}

/* ==================================================================
 *  PAGINATION
 * ================================================================*/
.gado-pagination {
	display: flex;
	justify-content: center;
	gap: 4px;
	margin-top: var(--gado-gap);
	flex-wrap: wrap;
}

.gado-pagination a,
.gado-pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border: 1px solid var(--gado-border);
	border-radius: 6px;
	font-size: 0.88rem;
	text-decoration: none;
	color: var(--gado-text);
	transition: background 0.15s, color 0.15s;
}

.gado-pagination a:hover {
	background: var(--gado-primary);
	border-color: var(--gado-primary);
	color: #fff;
}

.gado-pagination .current {
	background: var(--gado-primary);
	border-color: var(--gado-primary);
	color: #fff;
	font-weight: 600;
}

/* ==================================================================
 *  CARDS CONTAINER
 * ================================================================*/
.gado-cards-container {
	background: var(--gado-surface);
	border: 1px solid var(--gado-border);
	border-radius: var(--gado-radius);
	padding: 24px;
}

/* ==================================================================
 *  GALLERY (Training lightbox grid)
 * ================================================================*/
.gado-gallery {
	display: grid;
	gap: 8px;
}

.gado-gallery.gado-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gado-gallery.gado-cols-3 { grid-template-columns: repeat(3, 1fr); }
.gado-gallery.gado-cols-4 { grid-template-columns: repeat(4, 1fr); }

.gado-gallery-link {
	display: block;
	overflow: hidden;
	border-radius: var(--gado-radius);
	aspect-ratio: 1 / 1;
}

.gado-gallery-link img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.gado-gallery-link:hover img {
	transform: scale(1.06);
}

/* ── Lightbox overlay ──────────────────────────────────────── */
.gado-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.88);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gado-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.gado-lightbox__img {
	max-width: 90vw;
	max-height: 85vh;
	border-radius: 4px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.gado-lightbox__close {
	position: absolute;
	top: 16px;
	right: 20px;
	width: 44px;
	height: 44px;
	border: none;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 28px;
	line-height: 1;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s;
}

.gado-lightbox__close:hover {
	background: rgba(255, 255, 255, 0.3);
}

.gado-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border: none;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 24px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s;
}

.gado-lightbox__nav:hover {
	background: rgba(255, 255, 255, 0.3);
}

.gado-lightbox__prev { left: 16px; }
.gado-lightbox__next { right: 16px; }

/* ==================================================================
 *  NO RESULTS
 * ================================================================*/
.gado-no-results {
	padding: 40px 20px;
	text-align: center;
	color: var(--gado-text-light);
	font-size: 1rem;
}

/* ==================================================================
 *  RESPONSIVE
 * ================================================================*/
@media (max-width: 991px) {
	.gado-cols-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
	.gado-cols-3,
	.gado-cols-4 {
		grid-template-columns: repeat(2, 1fr);
	}

	.gado-view-list .gado-card {
		flex-direction: column;
	}

	.gado-view-list .gado-card__thumb {
		flex: none;
		max-height: none;
	}

	/* 2-column grid of fields on mobile — compact, not a tall stack */
	.gado-filters {
		display: grid !important;
		grid-template-columns: repeat(2, 1fr) !important;
		align-items: end !important;
		gap: 10px 12px !important;
	}

	.gado-filter-field input[type="text"],
	.gado-filter-field input[type="date"],
	.gado-filter-field select {
		width: 100% !important;
	}

	/* Filter + Clear buttons span both columns */
	.gado-filter-actions {
		grid-column: 1 / -1;
		flex-direction: row !important;
	}

	/* View toggle: push to second column, aligned right */
	.gado-filter-toggle {
		grid-column: 2 / 3;
		margin-left: auto;
		align-items: flex-end;
	}

	.gado-cards-container {
		padding: 16px;
	}
}

@media (max-width: 479px) {
	.gado-cols-2,
	.gado-cols-3,
	.gado-cols-4 {
		grid-template-columns: 1fr;
	}

	.gado-gallery.gado-cols-2,
	.gado-gallery.gado-cols-3,
	.gado-gallery.gado-cols-4 {
		grid-template-columns: repeat(2, 1fr);
	}
}
