/* Dressing Room
-------------------------------------------------------------------------- */
.dr-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.dr-header-actions {
	display: flex;
	gap: 0.5rem;
	flex-shrink: 0;
}

.dr-equip-btn {
	flex-shrink: 0;
}

/* Layout: customization panel | main stage
-------------------------------------------------------------------------- */
.dr-layout {
	display: flex;
	gap: 2rem;
	align-items: start;
	margin-top: 1rem;
}

.dr-main {
	flex: 1;
	min-width: 0;
}

/* Customization panel
-------------------------------------------------------------------------- */
.dr-panel {
	flex-shrink: 0;
	width: 240px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 1rem;
	background: var(--bg-secondary);
	border: 1px solid var(--border-color);
	border-radius: 8px;
}

.dr-panel-title {
	margin: 0;
	font-size: 1rem;
	color: var(--text-color-header);
}

.dr-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.dr-field-label {
	font-size: 0.85rem;
	color: var(--text-muted);
}

.dr-select {
	width: 100%;
}

/* animation select paired with its controls-toggle cog */
.dr-anim-row {
	display: flex;
	align-items: stretch;
	gap: 4px;
}

.dr-anim-row .dr-select {
	flex: 1 1 auto;
	min-width: 0;
}

.dr-anim-settings {
	flex: 0 0 auto;
	width: 2rem;
	padding: 0;
	background-color: var(--bg-secondary);
	background-image: url(/static/images/interface/nav-button-cog.webp);
	background-repeat: no-repeat;
	background-position: center;
	background-size: 16px 16px;
	border: 1px solid var(--border-color);
	border-radius: 4px;
	cursor: pointer;
}

.dr-anim-settings:hover {
	border-color: var(--border-hover);
}

.dr-anim-settings.active {
	background-color: var(--primary-color);
	border-color: var(--primary-color);
}

/* prev/next arrows flanking a customization control */
.dr-choice-row {
	display: flex;
	align-items: stretch;
	gap: 4px;
}

.dr-choice-row .dr-select,
.dr-choice-row .dr-color-field {
	flex: 1 1 auto;
	min-width: 0;
}

.dr-choice-arrow {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	padding: 0;
	background-color: var(--bg-secondary);
	border: 1px solid var(--border-color);
	border-radius: 4px;
	color: var(--text-color-normal);
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
}

.dr-choice-arrow:hover {
	border-color: var(--border-hover);
}

/* Color option: dropdown-style box that opens a swatch popup */
.dr-color-field {
	position: relative;
}

.dr-color-box {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	width: 100%;
	min-height: 2rem;
	padding: 0.4rem 0.6rem;
	border: 1px solid var(--border-color);
	border-radius: 4px;
	background-color: var(--bg-secondary);
	cursor: pointer;
	box-sizing: border-box;
}

.dr-color-box:hover {
	border-color: var(--border-hover);
}

/* native colour input overlaid invisibly over the box; anchors the browser picker to it */
.dr-solid-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: none;
	opacity: 0;
	cursor: pointer;
}

/* down caret, kept visible over any swatch color */
.dr-color-caret {
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid rgba(0, 0, 0, 0.6);
	filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.4));
}

.dr-color-popup {
	position: absolute;
	z-index: 50;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	max-height: 240px;
	overflow-y: auto;
	padding: 8px;
	display: grid;
	grid-template-columns: repeat(auto-fill, 24px);
	justify-content: start;
	gap: 6px;
	background: var(--bg-primary);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

.dr-swatch {
	width: 24px;
	height: 24px;
	padding: 0;
	border: 2px solid var(--border-color);
	border-radius: 4px;
	background-color: var(--bg-tertiary, var(--bg-secondary));
	cursor: pointer;
}

.dr-swatch.selected {
	border-color: var(--primary-color);
	box-shadow: 0 0 0 1px var(--primary-color);
}

/* choice with no color (e.g. "None") shows a diagonal strike */
.dr-swatch-none {
	background-image: linear-gradient(45deg, transparent 45%, var(--text-muted) 45%, var(--text-muted) 55%, transparent 55%);
}

/* Stage: left slots | character | right slots
-------------------------------------------------------------------------- */
.dr-stage {
	display: grid;
	grid-template-columns: auto auto auto;
	justify-content: center;
	gap: 1.5rem;
	align-items: center;
}

.dr-column {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* stage matches the game background art dimensions (478x500) */
.dr-character {
	position: relative;
	width: 478px;
	max-width: 100%;
	aspect-ratio: 478 / 500;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	background-color: var(--bg-secondary);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	overflow: hidden;
}

/* transparency checkerboard for the 'None' background */
.dr-character--transparent {
	background-color: #2a2a2a;
	background-image:
		linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
		linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
		linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
	background-size: 24px 24px;
	background-position: 0 0, 0 12px, 12px -12px, -12px 0;
	background-repeat: repeat;
}

.dr-canvas {
	display: block;
	width: 100%;
	height: 100%;
	position: absolute;
	inset: 0;
}

.dr-character-hint {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: var(--text-muted);
	font-size: 0.9rem;
	pointer-events: none;
}

/* on-canvas animation controls, top-left so they clear the loading indicator */
.dr-anim-controls {
	position: absolute;
	top: 10px;
	left: 10px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	background: rgba(0, 0, 0, 0.55);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	backdrop-filter: blur(2px);
	z-index: 10;
}

.dr-anim-play {
	position: relative;
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	padding: 0;
	background: var(--bg-secondary);
	border: 1px solid var(--border-color);
	border-radius: 4px;
	cursor: pointer;
}

.dr-anim-play:hover {
	border-color: var(--border-hover);
}

/* pause glyph: two vertical bars */
.dr-anim-play::before,
.dr-anim-play::after {
	content: '';
	position: absolute;
	top: 50%;
	width: 3px;
	height: 11px;
	background: var(--text-color-normal);
	transform: translateY(-50%);
}

.dr-anim-play::before {
	left: 8px;
}

.dr-anim-play::after {
	right: 8px;
}

/* play glyph: single right-pointing triangle */
.dr-anim-play.paused::before {
	left: 50%;
	width: 0;
	height: 0;
	background: none;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
	border-left: 10px solid var(--text-color-normal);
	transform: translate(-40%, -50%);
}

.dr-anim-play.paused::after {
	display: none;
}

.dr-anim-scrub {
	flex: 0 0 auto;
	width: 130px;
	accent-color: var(--primary-color);
	cursor: pointer;
}

.dr-loading {
	position: absolute;
	bottom: 10px;
	left: 10px;
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--text-muted);
	font-size: 0.85rem;
	pointer-events: none;
}

.dr-loading-spinner {
	width: 16px;
	height: 16px;
	animation: dr-loading-rotate 1s linear infinite;
}

@keyframes dr-loading-rotate {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* Bottom weapon row
-------------------------------------------------------------------------- */
.dr-bottom {
	display: flex;
	justify-content: center;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

/* Mobile equipment list (icon | item name | slot); hidden on desktop
-------------------------------------------------------------------------- */
.dr-slot-list {
	display: none;
	flex-direction: column;
	gap: 0.4rem;
	margin-top: 1.5rem;
}

.dr-slot-row {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 0.75rem;
	padding: 0.35rem 0.5rem;
	border-radius: 6px;
	cursor: pointer;
}

.dr-slot-row:hover {
	background: var(--bg-hover);
}

.dr-slot-row-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.dr-slot-row-empty {
	color: var(--text-muted);
}

.dr-slot-row-slot {
	color: var(--text-muted);
	font-size: 0.85rem;
	white-space: nowrap;
}

/* Slots
-------------------------------------------------------------------------- */
.dr-slot {
	width: 48px;
	height: 48px;
	cursor: pointer;
	flex-shrink: 0;
}

.dr-slot-icon {
	width: 100%;
	height: 100%;
	border-radius: 6px;
	border: 2px solid var(--border-color-icon);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.dr-slot-empty {
	background-image: url(/static/images/slots/atlas.webp);
	background-size: 1700% 100%;
	border-style: solid;
	opacity: 0.85;
}

/* atlas is a 17-tile horizontal strip; position selects the tile */
.dr-slot-head { background-position: 0% 0; }
.dr-slot-neck { background-position: 6.25% 0; }
.dr-slot-shoulder { background-position: 12.5% 0; }
.dr-slot-back { background-position: 25% 0; } /* cloak has no in-game icon; use chest fallback */
.dr-slot-chest { background-position: 25% 0; }
.dr-slot-tabard { background-position: 31.25% 0; }
.dr-slot-shirt { background-position: 37.5% 0; }
.dr-slot-wrist { background-position: 43.75% 0; }
.dr-slot-hands { background-position: 50% 0; }
.dr-slot-waist { background-position: 56.25% 0; }
.dr-slot-legs { background-position: 62.5% 0; }
.dr-slot-feet { background-position: 68.75% 0; }
.dr-slot-finger { background-position: 75% 0; }
.dr-slot-trinket { background-position: 81.25% 0; }
.dr-slot-mainhand { background-position: 87.5% 0; }
.dr-slot-offhand { background-position: 93.75% 0; }
.dr-slot-ranged { background-position: 100% 0; }

.dr-slot.filled:hover .dr-slot-icon {
	transform: scale(1.06);
	box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

.dr-slot:not(.filled):hover .dr-slot-icon {
	border-color: var(--border-hover);
	opacity: 1;
}

/* Context menu
-------------------------------------------------------------------------- */
.dr-context-menu {
	position: fixed;
	z-index: 1000;
	min-width: 150px;
	background: #1a1410;
	border: 1px solid var(--border-color);
	border-radius: 6px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
	padding: 4px;
	display: flex;
	flex-direction: column;
}

.dr-context-item {
	display: block;
	width: 100%;
	padding: 0.5rem 0.75rem;
	background: none;
	border: none;
	border-radius: 4px;
	color: var(--text-color);
	font-size: 0.9rem;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}

.dr-context-item:hover {
	background: var(--bg-hover);
}

.dr-context-remove {
	color: var(--error-color);
}

/* Picker modal
-------------------------------------------------------------------------- */
.dr-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 1100;
	background: rgba(0, 0, 0, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.dr-modal {
	width: 100%;
	max-width: 560px;
	max-height: 80vh;
	display: flex;
	flex-direction: column;
	background: var(--bg-primary);
	border: 1px solid var(--border-color);
	border-radius: 10px;
	box-shadow: 0 0 30px black;
	overflow: hidden;
}

.dr-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--border-color);
}

.dr-modal-header h3 {
	margin: 0;
	color: var(--text-color-header);
}

.dr-modal-close {
	background: none;
	border: none;
	color: var(--text-muted);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.dr-modal-close:hover {
	color: var(--text-color);
}

.dr-modal-search {
	padding: 1rem 1.25rem 0.5rem;
}

.dr-modal-input {
	width: 100%;
	padding: 0.6rem 0.85rem;
	background: var(--bg-tertiary);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	color: var(--text-color);
	font-size: 1rem;
}

.dr-modal-input:focus {
	border-color: var(--border-hover);
}

.dr-filter-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	padding: 0.5rem 1.25rem 0.75rem;
	border-bottom: 1px solid var(--border-color);
}

.dr-chip {
	padding: 0.25rem 0.6rem;
	background: var(--bg-secondary);
	border: 1px solid var(--border-color);
	border-radius: 999px;
	color: var(--text-color);
	font-size: 0.8rem;
	cursor: pointer;
}

.dr-chip:hover {
	background: var(--bg-hover);
}

.dr-chip.active {
	background: var(--primary-color);
	border-color: var(--primary-color);
	color: #000;
}

.dr-results {
	flex: 1;
	overflow-y: auto;
	padding: 0.5rem;
}

.dr-results-msg {
	padding: 1.5rem;
	text-align: center;
	color: var(--text-muted);
}

.dr-result {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	padding: 0.4rem 0.6rem;
	background: none;
	border: none;
	border-radius: 6px;
	color: var(--text-color);
	font-size: 0.95rem;
	text-align: left;
	cursor: pointer;
}

.dr-result:hover {
	background: var(--bg-hover);
}

.dr-result-icon {
	width: 36px;
	height: 36px;
	border-radius: 4px;
	border: 1px solid var(--border-color-icon);
	background-size: cover;
	background-position: center;
	flex-shrink: 0;
}

.dr-result-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.dr-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	padding: 0.75rem;
	border-top: 1px solid var(--border-color);
}

.dr-page-info {
	color: var(--text-muted);
	font-size: 0.9rem;
}

/* Responsive
-------------------------------------------------------------------------- */
@media (max-width: 900px) {
	.dr-header {
		flex-direction: column;
		align-items: stretch;
	}

	.dr-header-actions {
		flex-wrap: wrap;
	}

	.dr-layout {
		flex-direction: column;
	}

	.dr-panel {
		width: 100%;
	}

	/* stage collapses to just the (shrinking) viewer; icons move to the list */
	.dr-stage {
		display: block;
	}

	.dr-character {
		margin: 0 auto;
	}

	.dr-column,
	.dr-bottom {
		display: none;
	}

	.dr-slot-list {
		display: flex;
	}
}
