/* LLD Build Planner - Dark D2 Theme */
#lld-planner {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	color: #c9b88b;
	background: #1a1a2e;
	border: 2px solid #3d3522;
	border-radius: 4px;
	padding: 16px;
	margin: 8px 0;
}

/* Header */
.lld-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid #3d3522;
	margin-bottom: 16px;
}
.lld-header h2 {
	margin: 0;
	color: #d4a843;
	font-size: 1.3em;
}
.lld-header-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.lld-header-controls label {
	font-weight: bold;
	color: #8b7d5e;
}
.lld-header-controls select {
	background: #0f0f1a;
	color: #c9b88b;
	border: 1px solid #3d3522;
	padding: 4px 8px;
	border-radius: 3px;
}

/* Buttons */
.lld-btn {
	background: #2a2a3e;
	color: #c9b88b;
	border: 1px solid #3d3522;
	padding: 5px 12px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 0.85em;
}
.lld-btn:hover { background: #3a3a52; }
.lld-btn-save { border-color: #3a6b3a; }
.lld-btn-save:hover { background: #2a4a2a; }
.lld-btn-share { border-color: #3a5a8b; }
.lld-btn-share:hover { background: #2a3a5a; }
.lld-btn-danger { border-color: #8b3a3a; }
.lld-btn-danger:hover { background: #5a2222; }

/* Main Layout */
.lld-main {
	display: grid;
	grid-template-columns: 240px 1fr 280px;
	gap: 16px;
}
@media (max-width: 960px) {
	.lld-main { grid-template-columns: 1fr; }
}

/* Panels */
.lld-panel {
	background: #12122a;
	border: 1px solid #2a2a3e;
	border-radius: 4px;
	padding: 12px;
}
.lld-panel h3 {
	margin: 0 0 10px 0;
	color: #d4a843;
	font-size: 1em;
	border-bottom: 1px solid #2a2a3e;
	padding-bottom: 6px;
}

/* Stats Panel */
.lld-stat-points-remaining {
	text-align: center;
	margin-bottom: 10px;
	color: #8b7d5e;
	font-weight: bold;
}
.lld-stat-points-remaining span { color: #5cb85c; font-size: 1.2em; }
.lld-stat-row {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}
.lld-stat-label {
	width: 80px;
	font-weight: bold;
	color: #8b7d5e;
}
.lld-stat-btn {
	width: 24px;
	height: 24px;
	background: #2a2a3e;
	color: #c9b88b;
	border: 1px solid #3d3522;
	border-radius: 3px;
	cursor: pointer;
	font-weight: bold;
	line-height: 1;
	padding: 0;
}
.lld-stat-btn:hover { background: #3a3a52; }
.lld-stat-value {
	width: 36px;
	text-align: center;
	font-weight: bold;
	color: #fff;
}
.lld-stat-total {
	color: #5cb85c;
	font-size: 0.85em;
	min-width: 36px;
}

/* Calculated Stats */
.lld-calc-stats { margin-top: 8px; }
.lld-calc-row {
	display: flex;
	justify-content: space-between;
	padding: 3px 0;
	border-bottom: 1px solid #1a1a2e;
}
.lld-calc-row span:last-child { color: #fff; font-weight: bold; }

/* Equipment Grid */
.lld-equipment-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin-bottom: 16px;
}
.lld-equip-slot {
	background: #0f0f1a;
	border: 1px solid #3d3522;
	border-radius: 3px;
	min-height: 60px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: border-color 0.2s;
	padding: 4px;
	position: relative;
}
.lld-equip-slot:hover { border-color: #d4a843; }
.lld-equip-slot.equipped { border-color: #5cb85c; }
.lld-slot-label {
	font-size: 0.75em;
	color: #5a5a6e;
	text-transform: uppercase;
}
.lld-equip-slot .lld-item-name {
	font-size: 0.8em;
	color: #c9b88b;
	text-align: center;
	word-break: break-word;
}
.lld-equip-slot .lld-item-clear {
	position: absolute;
	top: 2px;
	right: 4px;
	color: #8b3a3a;
	cursor: pointer;
	font-size: 0.8em;
	display: none;
}
.lld-equip-slot.equipped .lld-item-clear { display: block; }

/* Item Dropdown */
.lld-item-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 100;
	background: #0f0f1a;
	border: 1px solid #3d3522;
	border-radius: 3px;
	max-height: 200px;
	overflow-y: auto;
	min-width: 180px;
	display: none;
}
.lld-item-dropdown.open { display: block; }
.lld-item-option {
	padding: 4px 8px;
	cursor: pointer;
	font-size: 0.8em;
	border-bottom: 1px solid #1a1a2e;
}
.lld-item-option:hover { background: #2a2a3e; }
.lld-item-option .lld-item-stats {
	font-size: 0.75em;
	color: #5cb85c;
}

/* Charm Inventory */
.lld-inventory-hint {
	font-size: 0.72em;
	color: #5a5a6e;
	margin-bottom: 8px;
	font-style: italic;
}
.lld-inventory-container {
	display: flex;
	gap: 16px;
	align-items: flex-start;
}

/* Grid: positioned container for cells and charm overlays */
.lld-inventory-grid {
	position: relative;
	background: #06060e;
	border: 2px solid #3d3522;
	border-radius: 3px;
	flex-shrink: 0;
	box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
}
.lld-inventory-grid.lld-place-mode {
	cursor: crosshair;
}

/* Individual grid cells (positioned absolutely) */
.lld-inv-cell {
	position: absolute;
	background: #0d0d1c;
	border: 1px solid #1c1c30;
	border-radius: 2px;
	transition: background 0.1s, border-color 0.1s;
}
.lld-inv-cell:hover {
	border-color: #2a2a44;
}

/* Drag highlight states */
.lld-inv-cell.lld-drag-valid {
	background: rgba(92, 184, 92, 0.2);
	border-color: #5cb85c;
}
.lld-inv-cell.lld-drag-invalid {
	background: rgba(184, 60, 60, 0.2);
	border-color: #b83c3c;
}

/* Placed charm blocks (positioned absolutely over the grid) */
.lld-charm-block {
	position: absolute;
	border-radius: 3px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 2;
	transition: box-shadow 0.15s, transform 0.1s;
	text-align: center;
	overflow: hidden;
	user-select: none;
}
.lld-charm-block:hover {
	box-shadow: 0 0 8px rgba(212, 168, 67, 0.5);
	transform: scale(1.03);
	z-index: 3;
}

.lld-charm-block-icon {
	font-size: 1.1em;
	line-height: 1;
	margin-bottom: 1px;
}
.lld-charm-block-label {
	font-size: 0.6em;
	font-weight: bold;
	line-height: 1.1;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding: 0 2px;
}

/* Small Charm (1x1) */
.lld-charm-small {
	background: linear-gradient(135deg, #1a3a2a 0%, #0f2a1a 100%);
	border: 1px solid #2a5a3a;
	color: #8fd4a0;
}
.lld-charm-small:hover { border-color: #4a8a5a; }

/* Large Charm (1x2) */
.lld-charm-large {
	background: linear-gradient(135deg, #1a2a3a 0%, #0f1a2a 100%);
	border: 1px solid #2a4a6a;
	color: #8fb4d4;
}
.lld-charm-large:hover { border-color: #4a7aaa; }

/* Grand Charm (1x3) */
.lld-charm-grand {
	background: linear-gradient(135deg, #3a2a1a 0%, #2a1a0f 100%);
	border: 1px solid #6a4a2a;
	color: #d4b48f;
}
.lld-charm-grand:hover { border-color: #aa7a4a; }

/* Unique Charm (any other size) */
.lld-charm-unique {
	background: linear-gradient(135deg, #3a1a3a 0%, #2a0f2a 100%);
	border: 1px solid #6a2a6a;
	color: #d48fd4;
}
.lld-charm-unique:hover { border-color: #aa4aaa; }

/* Click-to-place hover preview */
.lld-charm-preview {
	position: absolute;
	border-radius: 3px;
	z-index: 1;
}
.lld-preview-valid {
	background: rgba(92, 184, 92, 0.15);
	border: 2px dashed #5cb85c;
}
.lld-preview-invalid {
	background: rgba(184, 60, 60, 0.15);
	border: 2px dashed #b83c3c;
}

/* Charm Palette */
.lld-charm-palette {
	flex: 1;
	min-width: 160px;
	max-width: 220px;
}
.lld-charm-palette h4 {
	margin: 0 0 8px 0;
	color: #8b7d5e;
	font-size: 0.85em;
}
.lld-charm-list {
	display: flex;
	flex-direction: column;
	gap: 3px;
	max-height: 260px;
	overflow-y: auto;
	padding-right: 4px;
}
.lld-charm-group-header {
	font-size: 0.7em;
	color: #5a5a6e;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	padding: 6px 0 2px 0;
	border-bottom: 1px solid #1a1a2e;
	margin-bottom: 2px;
}
.lld-charm-group-header:first-child {
	padding-top: 0;
}
.lld-charm-item {
	display: flex;
	align-items: center;
	gap: 6px;
	background: #0f0f1a;
	border: 1px solid #1c1c30;
	padding: 5px 8px;
	font-size: 0.78em;
	border-radius: 3px;
	cursor: grab;
	color: #c9b88b;
	transition: border-color 0.15s, background 0.15s;
	user-select: none;
}
.lld-charm-item:hover {
	border-color: #3d3522;
	background: #14142a;
}
.lld-charm-item.lld-charm-selected {
	border-color: #d4a843;
	background: #1a1a30;
	box-shadow: 0 0 6px rgba(212, 168, 67, 0.3);
}
.lld-charm-item-icon {
	font-size: 1.1em;
	flex-shrink: 0;
}
.lld-charm-item-text {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.lld-charm-item-stats {
	font-size: 0.85em;
	color: #5cb85c;
	flex-shrink: 0;
	white-space: nowrap;
}

/* Palette color coding */
.lld-charm-small-palette .lld-charm-item-icon { color: #8fd4a0; }
.lld-charm-large-palette .lld-charm-item-icon { color: #8fb4d4; }
.lld-charm-grand-palette .lld-charm-item-icon { color: #d4b48f; }
.lld-charm-unique-palette .lld-charm-item-icon { color: #d48fd4; }

/* Skills Panel */
.lld-skill-points-remaining {
	text-align: center;
	margin-bottom: 10px;
	color: #8b7d5e;
	font-weight: bold;
}
.lld-skill-points-remaining span { color: #5cb85c; font-size: 1.2em; }
.lld-skill-tabs {
	display: flex;
	gap: 4px;
	margin-bottom: 10px;
}
.lld-skill-tab {
	flex: 1;
	background: #0f0f1a;
	border: 1px solid #2a2a3e;
	color: #8b7d5e;
	padding: 4px 8px;
	text-align: center;
	cursor: pointer;
	font-size: 0.8em;
	border-radius: 3px 3px 0 0;
}
.lld-skill-tab.active {
	background: #2a2a3e;
	color: #d4a843;
	border-bottom-color: #2a2a3e;
}
.lld-skill-tree {
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-height: 400px;
	overflow-y: auto;
}
.lld-skill-row {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px;
	background: #0f0f1a;
	border-radius: 3px;
}
.lld-skill-row.disabled { opacity: 0.4; }
.lld-skill-name {
	flex: 1;
	font-size: 0.85em;
	color: #c9b88b;
}
.lld-skill-name .lld-skill-req {
	font-size: 0.8em;
	color: #5a5a6e;
}
.lld-skill-controls {
	display: flex;
	align-items: center;
	gap: 4px;
}
.lld-skill-btn {
	width: 22px;
	height: 22px;
	background: #2a2a3e;
	color: #c9b88b;
	border: 1px solid #3d3522;
	border-radius: 3px;
	cursor: pointer;
	font-weight: bold;
	font-size: 0.8em;
	line-height: 1;
	padding: 0;
}
.lld-skill-btn:hover { background: #3a3a52; }
.lld-skill-btn:disabled { opacity: 0.3; cursor: default; }
.lld-skill-points {
	width: 24px;
	text-align: center;
	font-weight: bold;
	color: #fff;
	font-size: 0.85em;
}

/* Modal */
.lld-modal {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.7);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
}
.lld-modal-content {
	background: #1a1a2e;
	border: 2px solid #3d3522;
	border-radius: 6px;
	width: 500px;
	max-width: 90vw;
}
.lld-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 14px;
	border-bottom: 1px solid #3d3522;
}
.lld-modal-header h3 { margin: 0; color: #d4a843; font-size: 1em; }
.lld-modal-close {
	background: none;
	border: none;
	color: #8b7d5e;
	font-size: 1.4em;
	cursor: pointer;
}
.lld-modal-body { padding: 14px; }
.lld-modal-body textarea {
	width: 100%;
	background: #0f0f1a;
	color: #c9b88b;
	border: 1px solid #3d3522;
	border-radius: 3px;
	padding: 8px;
	font-family: monospace;
	font-size: 0.85em;
	resize: vertical;
}
.lld-modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 10px 14px;
	border-top: 1px solid #3d3522;
}

/* Build Info Bar */
.lld-build-info {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 12px;
	background: #12122a;
	border: 1px solid #2a2a3e;
	border-radius: 4px;
	margin-bottom: 12px;
	font-size: 0.9em;
	flex-wrap: wrap;
}
.lld-build-info strong { color: #d4a843; }
.lld-build-author { color: #8b7d5e; font-size: 0.85em; }
.lld-public-toggle {
	display: flex;
	align-items: center;
	gap: 4px;
	color: #8b7d5e;
	font-size: 0.85em;
	cursor: pointer;
}
.lld-public-toggle input { cursor: pointer; }

/* Builds List (in modal) */
.lld-builds-list {
	max-height: 350px;
	overflow-y: auto;
}
.lld-builds-list-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px;
	border-bottom: 1px solid #1a1a2e;
}
.lld-builds-list-item:hover { background: #1a1a3e; }
.lld-builds-list-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.lld-builds-list-info strong { color: #c9b88b; font-size: 0.9em; }
.lld-builds-meta { color: #5a5a6e; font-size: 0.8em; }
.lld-builds-list-actions {
	display: flex;
	gap: 4px;
}
.lld-input {
	background: #0f0f1a;
	color: #c9b88b;
	border: 1px solid #3d3522;
	border-radius: 3px;
	padding: 6px;
}
