/* ═══════════════════════════════════════════════════════
   Layout Picker
   ═══════════════════════════════════════════════════════ */
.spg-layout-picker {
	display:               grid;
	grid-template-columns: repeat( 5, 1fr );
	gap:                   6px;
	margin-bottom:         4px;
}

.spg-layout-btn {
	display:         flex;
	flex-direction:  column;
	align-items:     center;
	gap:             5px;
	padding:         8px 4px;
	border:          1.5px solid #ddd;
	border-radius:   5px;
	background:      #fff;
	cursor:          pointer;
	color:           #555;
	transition:      border-color 0.15s, background 0.15s, color 0.15s;
	line-height:     1;
}

.spg-layout-btn:hover {
	border-color: #007cba;
	color:        #007cba;
}

.spg-layout-btn.is-active {
	border-color: #007cba;
	background:   #007cba;
	color:        #fff;
}

.spg-layout-icon {
	width:   26px;
	height:  26px;
	display: flex;
	align-items:     center;
	justify-content: center;
}

.spg-layout-icon svg {
	width:  100%;
	height: 100%;
}

.spg-layout-label {
	font-size:      9px;
	font-weight:    600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════
   Editor wrapper
   ═══════════════════════════════════════════════════════ */
.spg-gallery-editor {
	padding:       12px;
	background:    #f8f8f8;
	border:        1.5px dashed #ccc;
	border-radius: 5px;
}

/* ═══════════════════════════════════════════════════════
   Common item styles in editor
   ═══════════════════════════════════════════════════════ */
.spg-gallery-grid .spg-gallery-item {
	margin:        0;
	overflow:      hidden;
	border-radius: var( --spg-radius, 6px );
	background:    #e0e0e0;
	position:      relative;
}

.spg-gallery-grid .spg-gallery-item img {
	width:       100%;
	display:     block;
	height:      var( --spg-height, 140px );
	object-fit:  cover;
}

/* ── Remove button ─────────────────────────────────────── */
.spg-remove-btn {
	position:        absolute;
	top:             5px;
	right:           5px;
	background:      rgba( 0, 0, 0, 0.62 );
	color:           #fff;
	border:          none;
	border-radius:   50%;
	width:           24px;
	height:          24px;
	font-size:       16px;
	line-height:     1;
	cursor:          pointer;
	display:         flex;
	align-items:     center;
	justify-content: center;
	opacity:         0;
	transition:      opacity 0.15s ease;
	padding:         0;
	z-index:         2;
}

.spg-gallery-item:hover .spg-remove-btn { opacity: 1; }

/* ── Caption previews ──────────────────────────────────── */
.spg-caption--overlay {
	position:   absolute;
	bottom:     0;
	left:       0;
	right:      0;
	margin:     0;
	padding:    6px 8px;
	background: rgba( 0, 0, 0, 0.55 );
	color:      #fff;
	font-size:  0.72em;
	text-align: center;
}

.spg-caption--below {
	padding:    4px 6px;
	font-size:  0.72em;
	color:      #555;
	margin:     0;
	text-align: center;
	background: #efefef;
}

/* ═══════════════════════════════════════════════════════
   1. GRID editor
   ═══════════════════════════════════════════════════════ */
.spg-gallery-grid--grid {
	display:               grid;
	grid-template-columns: repeat( var( --spg-columns, 3 ), 1fr );
	gap:                   var( --spg-gap, 12px );
	margin-bottom:         12px;
}

/* ═══════════════════════════════════════════════════════
   2. MASONRY editor (CSS columns approximation)
   ═══════════════════════════════════════════════════════ */
.spg-gallery-grid--masonry {
	columns:       var( --spg-columns, 3 );
	column-gap:    var( --spg-gap, 12px );
	margin-bottom: 12px;
}

.spg-gallery-grid--masonry .spg-gallery-item {
	break-inside:  avoid;
	margin-bottom: var( --spg-gap, 12px );
}

.spg-gallery-grid--masonry .spg-gallery-item img {
	height:     auto !important;
	max-height: 280px;
	object-fit: cover;
}

/* ═══════════════════════════════════════════════════════
   3. JUSTIFIED editor (flexbox approximation)
   ═══════════════════════════════════════════════════════ */
.spg-gallery-grid--justified {
	display:       flex;
	flex-wrap:     wrap;
	gap:           var( --spg-gap, 12px );
	align-items:   flex-start;
	margin-bottom: 12px;
}

.spg-gallery-grid--justified .spg-gallery-item {
	flex:      1 1 auto;
	min-width: 80px;
	max-width: 280px;
}

.spg-gallery-grid--justified .spg-gallery-item img {
	width:      100%;
	height:     var( --spg-height, 140px );
	object-fit: cover;
}

/* ═══════════════════════════════════════════════════════
   4. MOSAIC editor
   ═══════════════════════════════════════════════════════ */
.spg-gallery-grid--mosaic {
	display:               grid;
	grid-template-columns: repeat( var( --spg-columns, 3 ), 1fr );
	grid-auto-rows:        var( --spg-height, 140px );
	gap:                   var( --spg-gap, 12px );
	margin-bottom:         12px;
}

.spg-gallery-grid--mosaic .spg-gallery-item img {
	height:     100% !important;
	object-fit: cover;
}

.spg-gallery-grid--mosaic .spg-gallery-item:first-child {
	grid-column: span 2;
	grid-row:    span 2;
}


/* ═══════════════════════════════════════════════════════
   Toolbar & Placeholder
   ═══════════════════════════════════════════════════════ */
.spg-toolbar {
	display:     flex;
	gap:         8px;
	align-items: center;
	flex-wrap:   wrap;
	margin-top:  8px;
}

.spg-placeholder {
	text-align:    center;
	padding:       48px 16px;
	color:         #bbb;
	margin-bottom: 12px;
}

.spg-placeholder .dashicons {
	font-size: 56px;
	width:     56px;
	height:    56px;
	display:   block;
	margin:    0 auto 10px;
	color:     #d0d0d0;
}

.spg-placeholder p {
	margin:    0;
	font-size: 0.9em;
}
