/* SMF Gallery Pro - Modern CSS (SMF 2.1 only)
 * Version 11.0
 */

/* ============================================
   Thumbnail Grid
   ============================================ */
.gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 12px;
	padding: 12px;
}

/* When admin sets images_per_row, honor it via CSS custom property */
.gallery-grid[style*="--gallery-cols"] {
	grid-template-columns: repeat(var(--gallery-cols), 1fr);
}

/* ============================================
   Gallery Card (ShowImageItem output)
   ============================================ */
.gallery-card {
	background: #fdfdfd;
	border: 1px solid #ddd;
	border-radius: 6px;
	padding: 10px;
	text-align: center;
	transition: box-shadow 0.2s ease;
	overflow: hidden;
}

.gallery-card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.gallery-card img {
	max-width: 100%;
	height: auto;
	border-radius: 4px;
}

.gallery-card-title {
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	margin-bottom: 4px;
}

.gallery-card-title a {
	text-decoration: none;
}

.gallery-card-meta {
	font-size: 0.85em;
	color: #666;
	line-height: 1.4;
	margin-top: 6px;
}

.gallery-card-actions {
	margin-top: 6px;
	font-size: 0.8em;
}

.gallery-card-actions a {
	margin: 0 2px;
}

/* ============================================
   Sort/Filter Toolbar
   ============================================ */
.gallery-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px;
	gap: 8px;
	background: #f0f4f7;
	border: 1px solid #ddd;
	border-radius: 6px 6px 0 0;
}

.gallery-toolbar select,
.gallery-toolbar input[type="submit"] {
	margin: 0 2px;
}

.gallery-toolbar-left {
	display: flex;
	align-items: center;
	gap: 4px;
}

.gallery-toolbar-right {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
}

/* ============================================
   Category List
   ============================================ */
.gallery-cat-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.gallery-cat-row {
	display: flex;
	align-items: stretch;
	background: #fdfdfd;
	border: 1px solid #eee;
	border-radius: 4px;
	min-height: 80px;
}

.gallery-cat-icon {
	flex: 0 0 80px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f0f4f7;
	padding: 8px;
}

.gallery-cat-icon img {
	max-width: 64px;
	max-height: 64px;
	border-radius: 4px;
}

.gallery-cat-info {
	flex: 1;
	min-width: 0;
	padding: 8px 12px;
}

.gallery-cat-info h4 {
	margin: 0 0 4px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.gallery-cat-info p {
	margin: 0 0 4px;
}

.gallery-cat-stats {
	flex: 0 0 80px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	background: #f8f8f8;
}

.gallery-cat-lastpost {
	flex: 0 0 200px;
	padding: 8px;
	font-size: 0.85em;
	display: flex;
	align-items: center;
}

.gallery-cat-actions {
	flex: 0 0 auto;
	padding: 8px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 0.85em;
}

/* Drag and drop reorder */
.gallery-drag-handle {
	flex: 0 0 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: grab;
	color: #aaa;
	font-size: 1.2em;
	user-select: none;
	border-right: 1px solid #eee;
	background: #f8f9fa;
	transition: color 0.15s, background 0.15s;
}
.gallery-drag-handle:hover {
	color: #555;
	background: #e8ecf0;
}
.gallery-drag-handle:active {
	cursor: grabbing;
}
.gallery-cat-row.gallery-cat-dragging {
	opacity: 0.4;
}
.gallery-cat-drop-indicator {
	height: 3px;
	background: #5ba4cf;
	border-radius: 2px;
	margin: 2px 0;
}

/* ============================================
   View Picture Page
   ============================================ */
.gallery-view-container {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.gallery-view-image {
	text-align: center;
	padding: 16px;
	background: #f8f8f8;
	border: 1px solid #ddd;
	border-radius: 6px;
}

.gallery-view-image img {
	max-width: 100%;
	height: auto;
}

.gallery-view-nav {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 16px;
	padding: 8px;
}

.gallery-view-info dl {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 4px 12px;
	margin: 0;
}

.gallery-view-info dt {
	font-weight: 600;
	white-space: nowrap;
}

.gallery-view-info dd {
	margin: 0;
}

.gallery-mini-thumbs {
	display: flex;
	justify-content: center;
	gap: 8px;
	padding: 8px;
	overflow-x: auto;
}

.gallery-mini-thumbs a img {
	max-height: 60px;
	border-radius: 3px;
	border: 2px solid transparent;
}

.gallery-mini-thumbs a.active img {
	border-color: #5ba4cf;
}

/* ============================================
   Comments
   ============================================ */
.gallery-comment {
	display: flex;
	gap: 12px;
	padding: 12px;
	border-bottom: 1px solid #eee;
}

.gallery-comment-user {
	flex: 0 0 120px;
	text-align: center;
}

.gallery-comment-body {
	flex: 1;
}

.gallery-comment-meta {
	font-size: 0.85em;
	color: #888;
	margin-bottom: 6px;
}

.gallery-comment-actions {
	margin-top: 8px;
	font-size: 0.85em;
}

.gallery-comment.unapproved {
	background: #fff8e1;
	border-left: 3px solid #f0ad4e;
}

/* ============================================
   Forms (dl.settings pattern)
   ============================================ */
.gallery-form dl.settings {
	display: grid;
	grid-template-columns: 200px 1fr;
	gap: 8px 12px;
	align-items: start;
}

.gallery-form dl.settings dt {
	font-weight: 600;
	text-align: right;
	padding-top: 4px;
}

.gallery-form dl.settings dd {
	margin: 0;
}

.gallery-form-submit {
	text-align: center;
	padding: 12px 0;
}

/* ============================================
   EXIF Data
   ============================================ */
.gallery-exif dl {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 2px 12px;
	font-size: 0.9em;
}

.gallery-exif dt {
	font-weight: 600;
	padding: 2px 0;
}

.gallery-exif dd {
	margin: 0;
	padding: 2px 0;
}

/* ============================================
   User Gallery List
   ============================================ */
.gallery-user-row {
	display: flex;
	align-items: center;
	padding: 8px 12px;
	background: #fdfdfd;
	border: 1px solid #eee;
	border-radius: 4px;
	margin-bottom: 2px;
}

.gallery-user-avatar {
	flex: 0 0 60px;
	text-align: center;
}

.gallery-user-info {
	flex: 1;
	padding: 0 12px;
}

.gallery-user-stats {
	flex: 0 0 80px;
	text-align: center;
	font-weight: 600;
}

.gallery-user-latest {
	flex: 0 0 200px;
	font-size: 0.85em;
}

/* ============================================
   Pagination & Load More
   ============================================ */
.gallery-pagination {
	padding: 8px 12px;
}

.gallery-load-more-container {
	text-align: center;
	padding: 15px;
}

/* ============================================
   Admin Bar
   ============================================ */
.gallery-admin-bar {
	padding: 10px 12px;
	text-align: center;
	line-height: 1.8;
}

.gallery-admin-bar a {
	margin: 0 4px;
}

/* ============================================
   Bulk Actions
   ============================================ */
.gallery-bulk-actions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 12px;
	flex-wrap: wrap;
}

/* ============================================
   Bottom Links Bar
   ============================================ */
.gallery-bottom-links {
	text-align: center;
	padding: 10px 0;
}

.gallery-bottom-links a {
	margin: 0 4px;
}

/* ============================================
   Who is Viewing
   ============================================ */
.gallery-who-viewing {
	text-align: center;
	padding: 8px 12px;
	font-size: 0.85em;
}

/* ============================================
   Ad Container
   ============================================ */
.gallery-ad-container {
	text-align: center;
	padding: 10px;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */
@media (max-width: 855px) {
	.gallery-grid {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
		gap: 8px;
	}

	/* Override admin column setting on small screens */
	.gallery-grid[style*="--gallery-cols"] {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	}

	.gallery-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	/* Category rows: two-row layout with icon+info on top, stats+lastpost+actions below */
	.gallery-cat-row {
		flex-wrap: wrap;
	}

	.gallery-cat-icon {
		flex: 0 0 70px;
	}

	.gallery-cat-info {
		flex: 1 1 0;
		min-width: 0;
	}

	.gallery-cat-stats {
		flex: 0 0 auto;
		padding: 6px 12px;
	}

	.gallery-cat-lastpost {
		flex: 1 1 0;
		min-width: 0;
	}

	.gallery-cat-actions {
		flex: 0 0 auto;
	}

	.gallery-form dl.settings {
		grid-template-columns: 1fr;
	}

	.gallery-form dl.settings dt {
		text-align: left;
	}

	.gallery-view-info dl {
		grid-template-columns: 1fr;
	}

	.gallery-comment {
		flex-direction: column;
	}

	.gallery-comment-user {
		flex: 0 0 auto;
	}
}

@media (max-width: 720px) {
	.gallery-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 6px;
		padding: 6px;
	}

	/* Override admin column setting on very small screens */
	.gallery-grid[style*="--gallery-cols"] {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	}

	.gallery-card {
		padding: 6px;
	}

	/* Category rows: fully stacked vertical layout */
	.gallery-cat-row {
		flex-direction: column;
		align-items: stretch;
		min-height: auto;
	}

	.gallery-drag-handle {
		flex: 0 0 auto;
		width: 100%;
		height: 28px;
		border-right: none;
		border-bottom: 1px solid #eee;
	}

	.gallery-cat-icon {
		flex: 0 0 auto;
		width: 100%;
		padding: 10px;
	}

	.gallery-cat-icon img {
		max-width: 48px;
		max-height: 48px;
	}

	.gallery-cat-info {
		flex: 0 0 auto;
		width: 100%;
		padding: 8px 10px;
		text-align: center;
	}

	.gallery-cat-info h4 {
		font-size: 0.95em;
		white-space: normal;
		word-wrap: break-word;
	}

	.gallery-cat-info p {
		font-size: 0.85em;
	}

	.gallery-cat-stats {
		flex: 0 0 auto;
		width: 100%;
		padding: 6px 10px;
		text-align: center;
		background: #f0f4f7;
		border-top: 1px solid #eee;
	}

	.gallery-cat-lastpost {
		flex: 0 0 auto;
		width: 100%;
		padding: 8px 10px;
		justify-content: center;
		text-align: center;
	}

	.gallery-cat-actions {
		flex: 0 0 auto;
		width: 100%;
		flex-direction: row;
		justify-content: center;
		flex-wrap: wrap;
		padding: 8px 10px;
		border-top: 1px solid #eee;
	}

	/* User gallery rows: stack */
	.gallery-user-row {
		flex-direction: column;
		text-align: center;
		padding: 10px;
	}

	.gallery-user-avatar {
		flex: 0 0 auto;
		margin-bottom: 6px;
	}

	.gallery-user-info {
		padding: 4px 0;
	}

	.gallery-user-stats {
		flex: 0 0 auto;
		width: 100%;
		padding: 6px 0;
	}

	.gallery-user-latest {
		flex: 0 0 auto;
		width: 100%;
		text-align: center;
		padding-top: 6px;
		border-top: 1px solid #eee;
	}
}

/* ============================================
   iPhone / Small Phone (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {

	/* --- Thumbnail grid: 2 columns on small phones --- */
	.gallery-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 6px;
		padding: 6px;
	}

	.gallery-grid[style*="--gallery-cols"] {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Tighten up category cards on very small screens */
	.gallery-cat-info {
		padding: 6px 8px;
	}

	.gallery-cat-info h4 {
		font-size: 0.9em;
	}

	.gallery-cat-lastpost {
		font-size: 0.8em;
		padding: 6px 8px;
	}

	/* --- Mini thumbs: smaller on phones --- */
	.gallery-mini-thumbs a img {
		max-height: 44px;
	}

	/* --- Bulk actions: stack --- */
	.gallery-bulk-actions {
		flex-direction: column;
	}
}

/* ============================================
   Drop Zone Upload
   ============================================ */
.gallery-drop-zone {
	border: 2px dashed #ccc;
	border-radius: 6px;
	padding: 24px 16px;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
	background: #f8f9fa;
	margin-bottom: 4px;
}
.gallery-drop-zone:hover,
.gallery-drop-zone.dragover {
	border-color: #5ba4cf;
	background: #edf4fa;
}
.gallery-drop-zone input[type="file"] {
	display: none;
}
.gallery-drop-zone .drop-icon {
	font-size: 2em;
	color: #aaa;
	display: block;
	margin-bottom: 6px;
}
.gallery-drop-zone .drop-text {
	color: #888;
	font-size: 0.9em;
}
.gallery-drop-zone .drop-text a {
	color: #5ba4cf;
	text-decoration: underline;
	cursor: pointer;
}
.gallery-drop-zone .drop-preview {
	margin-top: 10px;
	font-size: 0.85em;
	color: #555;
}
.gallery-drop-zone .drop-preview img {
	max-width: 120px;
	max-height: 120px;
	border-radius: 4px;
	margin-top: 6px;
	display: block;
	margin-left: auto;
	margin-right: auto;
}