/* ============================================================
   Athena — AI Image Generation Studio
   Light theme · built on Bootstrap 5 design tokens
   ============================================================ */

:root {
	--bg: var(--bs-body-bg);
	--bg-elev: var(--bs-tertiary-bg);
	--panel: var(--bs-body-bg);
	--panel-2: var(--bs-secondary-bg);
	--border: var(--bs-border-color);
	--text: var(--bs-body-color);
	--muted: var(--bs-secondary-color);
	--accent: #172554;
	--accent-2: #3b0764;
	--accent-rgb: 23, 37, 84;
	--accent-glow: rgba(23, 37, 84, 0.25);
	--success: var(--bs-success);
	--danger: var(--bs-danger);
	--radius: 12px;

	/* Bootstrap primary tokens aligned with branding */
	--bs-primary: #172554;
	--bs-primary-rgb: 23, 37, 84;
	--bs-link-color: #172554;
	--bs-link-color-rgb: 23, 37, 84;
	--bs-link-hover-color: #3b0764;
	--bs-link-hover-color-rgb: 59, 7, 100;
	--bs-focus-ring-color: rgba(23, 37, 84, 0.25);
}

* { box-sizing: border-box; }

body {
	margin: 0;
	font-family: var(--bs-body-font-family);
	background: var(--bg);
	color: var(--text);
}

/* ---------- Bootstrap primary = branding ---------- */
.btn-primary {
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	border-color: transparent;
	box-shadow: 0 0.25rem 0.75rem var(--accent-glow);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
	background: linear-gradient(135deg, var(--accent-2), var(--accent));
	border-color: transparent;
	box-shadow: 0 0.35rem 0.9rem var(--accent-glow);
}
.btn-primary:disabled {
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	border-color: transparent;
	opacity: 0.65;
	box-shadow: none;
}
.btn-primary:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.btn-outline-primary {
	color: var(--accent);
	border-color: var(--accent);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
	color: #fff;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	border-color: transparent;
}
.btn-outline-primary:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.btn-link { color: var(--accent); }
.btn-link:hover { color: var(--accent-2); }

.form-control:focus,
.form-select:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 0.25rem var(--accent-glow);
}

.form-check-input:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 0.25rem var(--accent-glow);
}
.form-check-input:checked {
	background-color: var(--accent);
	border-color: var(--accent);
}
.form-switch .form-check-input:checked {
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* ---------- Auth ---------- */
.auth-body {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background:
		radial-gradient(1200px 600px at 20% -10%, rgba(23, 37, 84, 0.12), transparent 60%),
		radial-gradient(1000px 500px at 100% 110%, rgba(59, 7, 100, 0.10), transparent 60%),
		var(--bg);
	padding: 1rem;
}

.auth-wrap { width: 100%; max-width: 400px; }

.auth-card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 2rem 2rem 1.5rem;
	box-shadow: 0 0.5rem 1.5rem rgba(33, 37, 41, 0.1);
}

.auth-brand { text-align: center; margin-bottom: 1.75rem; }
.auth-logo {
	width: 58px; height: 58px;
	margin: 0 auto 0.75rem;
	display: flex; align-items: center; justify-content: center;
	font-size: 1.6rem; color: #fff;
	border-radius: 16px;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	box-shadow: 0 0.5rem 1.25rem var(--accent-glow);
}
.auth-brand h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.auth-brand p { margin: 0.25rem 0 0; }

/* ---------- App shell ---------- */
.app-body { min-height: 100vh; overflow: hidden; overflow-x: hidden; }

.app-nav {
	min-height: 58px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.4rem 0.75rem;
	padding: 0.4rem 1.25rem;
	background: var(--panel);
	border-bottom: 1px solid var(--border);
	position: sticky; top: 0; z-index: 50;
}
.app-nav-left { display: flex; align-items: center; gap: 0.6rem; }
.brand-dot {
	width: 32px; height: 32px; border-radius: 9px;
	display: flex; align-items: center; justify-content: center;
	font-size: 1rem; color: #fff;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand-name { font-weight: 700; font-size: 1.05rem; }
.brand-name small { font-weight: 400; color: var(--muted); }

.app-nav-right { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }

.balance-chip {
	display: inline-flex; align-items: center; gap: 0.35rem;
	padding: 0.3rem 0.7rem;
	font-size: 0.78rem; font-weight: 600;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--text);
	white-space: nowrap;
}
.balance-chip i { color: var(--accent); }

.user-chip { display: flex; align-items: center; gap: 0.55rem; padding: 0.25rem 0.75rem 0.25rem 0.4rem; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; }
.user-avatar {
	width: 30px; height: 30px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 0.8rem; color: #fff;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.user-meta { display: flex; flex-direction: column; line-height: 1.1; }
.user-name { font-size: 0.82rem; font-weight: 600; }
.user-role { font-size: 0.68rem; color: var(--muted); text-transform: capitalize; }

/* ---------- Main split layout ---------- */
.app-main { display: flex; height: calc(100vh - 58px); }

.tools-panel {
	width: 380px; max-width: 100%;
	flex-shrink: 0;
	border-right: 1px solid var(--border);
	background: var(--panel);
}
.tools-scroll { height: 100%; overflow-y: auto; padding: 1.1rem; }

.gallery-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Mobile-only overlay button, anchored to the drawer's right edge.
   Closed: the drawer is off-screen → the button sticks out at the left border edge ("Tools").
   Open: it tucks inside the drawer's right edge ("Gallery").
   Because it lives inside .tools-panel it moves in sync with the drawer animation.
   Slim vertical layout: icon on top, label rotated (vertical text). */
.tools-toggle {
	display: none;
	position: absolute;
	top: 50%;
	left: 100%;
	transform: translateY(-50%);
	width: 34px;
	height: auto;
	min-height: 112px;
	padding: 0.55rem 0.1rem;
	gap: 0.4rem;
	z-index: 5;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 0 12px 12px 0;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	color: #fff;
	font-weight: 600;
	line-height: 1;
	box-shadow: 0 4px 14px var(--accent-glow), inset 0 0 0 1px rgba(255, 255, 255, 0.22);
	cursor: pointer;
	transition: left 0.25s ease, background 0.15s, box-shadow 0.15s;
}
.tools-toggle:hover { filter: brightness(1.1); box-shadow: 0 5px 18px var(--accent-glow); }
.tools-toggle i { font-size: 0.95rem; font-style: normal; }
.tools-toggle span {
	font-style: italic;
	font-size: 0.72rem;
	letter-spacing: 0.02em;
	writing-mode: vertical-rl;
	text-orientation: mixed;
}

/* ---------- Form controls (Bootstrap defaults) ---------- */
.field-block { margin-bottom: 1.15rem; }
.field-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; display: block; }

textarea.form-control { resize: vertical; min-height: 110px; }

.char-count { font-size: 0.72rem; color: var(--muted); }

.input-group-text { color: var(--muted); }

/* ---------- Input image thumbnails (max 4) ---------- */
.input-thumb-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.5rem;
	max-width: 260px;
}
.input-thumb-slot {
	position: relative;
	aspect-ratio: 1 / 1;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: var(--panel-2);
	overflow: hidden;
	display: flex; align-items: center; justify-content: center;
	padding: 0;
}
.input-thumb-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.input-thumb-remove {
	position: absolute; top: 4px; right: 4px;
	width: 20px; height: 20px; padding: 0;
	border-radius: 50%; border: none;
	background: rgba(33, 37, 41, 0.65); color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-size: 0.75rem; line-height: 1;
}
.input-thumb-remove:hover { background: var(--danger); }
.input-thumb-add {
	border: 1.5px dashed var(--border);
	background: var(--bg);
	color: var(--muted);
	font-size: 1.4rem;
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.input-thumb-add:hover { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb), 0.05); }
.input-thumb-grid.dragover .input-thumb-add { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.08); }
.input-hint { margin-top: 0.4rem; }
.input-hint .link { color: var(--accent); text-decoration: underline; }

/* ---------- Ratio: horizontal scroll + angka rasio ---------- */
.ratio-scroll {
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: var(--border) transparent;
	padding-bottom: 0.25rem;
}
.ratio-scroll::-webkit-scrollbar { height: 5px; }
.ratio-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.ratio-scroll::-webkit-scrollbar-track { background: transparent; }
.ratio-grid { display: flex; flex-wrap: nowrap; gap: 0.5rem; width: max-content; }
.ratio-btn {
	flex: 0 0 auto;
	display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
	min-width: 68px;
	padding: 0.6rem 0.5rem;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 10px;
	color: var(--muted);
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ratio-btn:hover { border-color: var(--accent); color: var(--text); }
.ratio-btn.active { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); color: var(--accent); }
.ratio-box { display: block; height: 26px; background: currentColor; opacity: 0.35; border-radius: 4px; }
.ratio-btn.active .ratio-box { opacity: 1; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.ratio-label { font-size: 0.8rem; font-weight: 600; line-height: 1.2; }
.ratio-caption { font-size: 0.65rem; line-height: 1; opacity: 0.85; }

/* ---------- Resolution: chips (per-model supported set) ---------- */
.res-scroll {
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: var(--border) transparent;
	padding-bottom: 0.25rem;
}
.res-scroll::-webkit-scrollbar { height: 5px; }
.res-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.res-scroll::-webkit-scrollbar-track { background: transparent; }
.res-grid { display: flex; flex-wrap: nowrap; gap: 0.5rem; width: max-content; }
.res-btn {
	flex: 0 0 auto;
	min-width: 56px;
	padding: 0.45rem 0.9rem;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--muted);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.res-btn:hover { border-color: var(--accent); color: var(--text); }
.res-btn.active { border-color: var(--accent); background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

.ratio-1-1  { width: 28px; }
.ratio-3-4  { width: 21px; }
.ratio-9-16 { width: 16px; }
.ratio-16-9 { width: 50px; }
.ratio-4-3  { width: 37px; }
.ratio-3-2  { width: 42px; }
.ratio-2-3  { width: 19px; }
.ratio-4-5  { width: 22px; }

/* ---------- Batch stepper ---------- */
.batch-stepper { display: flex; align-items: stretch; gap: 0.5rem; }
.batch-value {
	flex: 1;
	display: flex; align-items: center; justify-content: center; gap: 0.4rem;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 10px;
	font-size: 1.2rem; font-weight: 700;
}
.batch-value small { font-size: 0.7rem; font-weight: 400; color: var(--muted); }

/* ---------- Generate button ---------- */
.btn-generate {
	width: 100%;
	padding: 0.8rem;
	font-weight: 600;
	border: none;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	box-shadow: 0 0.5rem 1.25rem var(--accent-glow);
	transition: transform 0.1s, box-shadow 0.2s;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.btn-generate:hover { transform: translateY(-1px); box-shadow: 0 0.75rem 1.5rem var(--accent-glow); }
.btn-generate:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }
.generate-est {
	margin-left: auto;
	padding: 0.15rem 0.55rem;
	font-size: 0.72rem; font-weight: 600;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.2);
	opacity: 0.95;
	white-space: nowrap;
}

/* ---------- Gallery ---------- */
.gallery-toolbar {
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--border);
	background: var(--bg-elev);
	display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.gallery-title { display: flex; align-items: baseline; gap: 0.6rem; }
.gallery-title h2 { font-size: 1.1rem; margin: 0; }
.gallery-count { font-size: 0.78rem; color: var(--muted); }

.gallery-filters { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.gallery-filters .form-select { width: auto; }
.search-box { position: relative; }
.search-box i { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.8rem; }
.search-box input { padding-left: 1.8rem; width: 190px; }

.gallery-scroll { flex: 1; overflow-y: auto; padding: 1.25rem; }

.gallery-grid {
	/* Masonry via CSS grid, row-major: cards keep DOM order (newest → oldest,
	   left → right) while each card's --span packs the auto-rows by aspect
	   ratio. Span is computed in JS (applyMasonry) from the column width. */
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: 4px;
	gap: 1rem;
}

.gallery-card {
	position: relative;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--panel);
	border: 1px solid var(--border);
	cursor: pointer;
	grid-row-end: span var(--span, 12);
	transition: transform 0.15s, box-shadow 0.15s;
}
.gallery-card:hover { transform: translateY(-3px); box-shadow: 0 0.75rem 2rem rgba(33, 37, 41, 0.15); }
.gallery-card .card-img-wrap { width: 100%; height: 100%; position: relative; background: var(--panel-2); overflow: hidden; }
.gallery-card .card-img-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; }
.gallery-card .card-overlay {
	position: absolute; inset: 0;
	background: linear-gradient(to top, rgba(33, 37, 41, 0.6), rgba(33, 37, 41, 0.15) 45%, rgba(33, 37, 41, 0.25));
	opacity: 0; transition: opacity 0.15s;
	display: flex; flex-direction: column; justify-content: space-between;
	padding: 0.5rem; gap: 0.4rem;
}
.gallery-card:hover .card-overlay { opacity: 1; }
.card-badges { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.4rem; }
.card-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.4rem; }
.card-btn-group { display: flex; gap: 0.4rem; }
.card-badge {
	display: inline-flex; align-items: center; gap: 0.3rem;
	background: rgba(33, 37, 41, 0.72);
	color: #fff; font-size: 0.66rem; line-height: 1.2;
	padding: 0.22rem 0.5rem; border-radius: 6px;
	max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-badge.badge-model { max-width: calc(100% - 3.2rem); }
.card-overlay .btn { border-radius: 50%; width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; }
.badge-soft { font-size: 0.66rem; padding: 0.2rem 0.5rem; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }

.gallery-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 4rem 1rem;
	color: var(--muted);
}
.gallery-empty i { font-size: 3rem; display: block; margin-bottom: 0.75rem; opacity: 0.5; }
.gallery-empty p { font-size: 1.1rem; margin: 0; color: var(--text); }
.gallery-empty span { font-size: 0.85rem; }

/* Skeleton */
.skeleton-card { border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--border); grid-row-end: span var(--span, 12); }
.skeleton-img { width: 100%; height: 100%; background: linear-gradient(90deg, var(--panel-2) 25%, #f1f3f5 50%, var(--panel-2) 75%); background-size: 400% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Generation progress card: shimmer only on the photo, no prompt footer */
.gallery-card.progress-card { cursor: default; }
.gallery-card.progress-card:hover { transform: none; box-shadow: none; }
.progress-card .card-img-wrap { overflow: hidden; }
.progress-placeholder {
	height: 100%;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
	background: linear-gradient(90deg, var(--panel-2) 25%, #f1f3f5 50%, var(--panel-2) 75%);
	background-size: 400% 100%;
	animation: shimmer 1.4s infinite;
	color: var(--muted);
}
.progress-placeholder i { font-size: 2.3rem; color: var(--accent); animation: pulse-icon 1.4s ease-in-out infinite; }
.progress-placeholder-text { font-size: 0.8rem; letter-spacing: 0.02em; }
.progress-placeholder-sub { font-size: 0.68rem; opacity: 0.75; letter-spacing: 0.02em; }
@keyframes pulse-icon { 0%, 100% { opacity: 0.4; transform: scale(0.92); } 50% { opacity: 1; transform: scale(1.06); } }

/* ---------- Modal ---------- */
.app-modal { background: var(--panel); border: 1px solid var(--border); color: var(--text); }
.app-modal .modal-header { border-color: var(--border); }
.app-modal .modal-footer { border-color: var(--border); }

/* Lightbox: 8:4 split — image preview col-8, details col-4 */
.lightbox-body { display: flex; gap: 1.25rem; padding: 1.25rem; }
.lightbox-nav {
	position: absolute; top: 50%; transform: translateY(-50%);
	z-index: 5; width: 40px; height: 40px; padding: 0;
	border: 1px solid var(--border); border-radius: 50%;
	background: rgba(33, 37, 41, 0.55); color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-size: 1.05rem; line-height: 1;
	transition: background 0.15s, opacity 0.15s;
}
.lightbox-nav:hover { background: rgba(33, 37, 41, 0.85); }
.lightbox-prev { left: 0.5rem; }
.lightbox-next { right: 0.5rem; }
.lightbox-nav[hidden] { display: none; }
.lightbox-preview {
	flex: 0 0 calc(66.6667% - 0.625rem); /* col-8 (minus half the gap) */
	min-width: 0;
	position: relative; /* arrows anchor to the photo area */
	display: flex; align-items: center; justify-content: center;
	background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
	overflow: hidden; max-height: 72vh;
}
.lightbox-preview img { max-width: 100%; max-height: 72vh; object-fit: contain; display: block; }
.lightbox-meta {
	flex: 0 0 calc(33.3333% - 0.625rem); /* col-4 (minus half the gap) */
	min-width: 0; overflow-y: auto; max-height: 72vh;
}
.meta-section { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.meta-section:first-child { padding-top: 0; }
.meta-section:last-child { border-bottom: 0; padding-bottom: 0; }
.section-title {
	display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
	color: var(--muted); margin-bottom: 0.5rem;
}
.meta-section p { margin: 0; font-size: 0.85rem; color: var(--text); word-break: break-word; }
.meta-section .meta-prompt-text { line-height: 1.5; }
.meta-section .created-by i { color: var(--accent); }

/* Prompt: read-more clamp + copy button */
.prompt-block .prompt-clamped {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.prompt-block.expanded .prompt-clamped {
	display: block;
	-webkit-line-clamp: unset;
}
.prompt-actions {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: 0.6rem;
}
.prompt-actions .btn { font-size: 0.72rem; padding: 0.2rem 0.55rem; }
.source-thumb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
	gap: 0.5rem;
	max-width: 280px;
}
.source-thumb-slot {
	position: relative;
	aspect-ratio: 1 / 1;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: var(--panel-2);
	overflow: hidden;
}
.source-thumb-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.source-thumb-overlay {
	position: absolute; inset: 0;
	display: flex; align-items: center; justify-content: center;
	background: rgba(33, 37, 41, 0.5);
	opacity: 0; transition: opacity 0.15s;
	padding: 0.25rem;
}
.source-thumb-slot:hover .source-thumb-overlay { opacity: 1; }
.source-thumb-overlay .use-as-input {
	font-size: 0.6rem; padding: 0.25rem 0.4rem; line-height: 1; white-space: nowrap;
}
@media (max-width: 768px) {
	.lightbox-body { flex-direction: column; }
	.lightbox-preview { flex-basis: auto; }
	.lightbox-meta { flex-basis: auto; width: 100%; max-height: none; }
}

/* ---------- Toasts ---------- */
.toast { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #ced4da; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #adb5bd; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Responsive ---------- */
/* Layout 1 kolom (menumpuk) HANYA pada resolusi mobile standar (< md / 768px).
   Tablet (≥768px) tetap menampilkan 2 sisi: tools panel + galeri. */
@media (max-width: 767.98px) {
	/* Mobile: gallery fills the viewport below the navbar; the tools panel
	   becomes a FULL-WIDTH drawer that slides in from the left (default: closed),
	   shown/hidden via the edge toggle button. */
	.app-main { display: block; height: calc(100vh - 58px); }

	.tools-panel {
		position: fixed;
		top: 58px; bottom: 0; left: 0;
		width: 100%;
		z-index: 1045;
		transform: translateX(-100%);
		transition: transform 0.25s ease;
		border-right: none;
		box-shadow: 0 0.5rem 1.5rem rgba(33, 37, 41, 0.25);
	}
	.app-main.tools-open .tools-panel { transform: translateX(0); }
	.tools-scroll { height: 100%; overflow-y: auto; }

	.gallery-panel { height: calc(100vh - 58px); min-height: 0; }
	.gallery-toolbar { flex-direction: column; align-items: stretch; }
	.gallery-grid { grid-template-columns: repeat(2, 1fr); }

	/* Overlay toggle rides the drawer: closed → sticks out at the left border edge;
	   open → tucked inside the drawer's right edge */
	.tools-toggle { display: flex; }
	.app-main.tools-open .tools-toggle {
		left: calc(100% - 34px);
		border-radius: 12px 0 0 12px;
	}
}

/* Tablet (md–lg): tetap 2 sisi, galeri masonry minimal 2 kolom */
@media (min-width: 768px) and (max-width: 1199.98px) {
	.tools-panel { width: 340px; }
	.gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Layar lebar: lebih banyak kolom masonry */
@media (min-width: 1500px) {
	.gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 576px) {
	.gallery-filters { width: 100%; }
	.gallery-filters .form-select { flex: 1 1 auto; min-width: 0; }
	.search-box { flex: 1 1 100%; }
	.search-box input { width: 100%; }
	.ratio-btn { min-width: 60px; padding: 0.5rem 0.3rem; }
}

/* ---------- Navbar mobile (Bootstrap 5 hamburger) ---------- */
.navbar-toggler { color: var(--text); border-color: var(--border); }
.navbar-toggler:focus { box-shadow: 0 0 0 0.25rem var(--accent-glow); }

@media (max-width: 991.98px) {
	.app-nav-right { flex-direction: column; align-items: stretch; }
	.app-nav-right > * { width: 100%; }
	.app-nav-right .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; }
}
