/* Global Styles */
:root {
    --bg-dark: #1e1e1e;
    --bg-darker: #121212;
    --bg-light: #2d2d2d;
    --primary: #ce422b;
    /* Rust Logo Red/Orange */
    --primary-hover: #e0533b;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --border: #444;
    --success: #66bb6a;
    --danger: #ef5350;
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-darker);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background-color: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.search-container input {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.category-filter {
    display: flex;
    gap: 5px;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 5px;
}

.filter-btn {
    background: var(--bg-light);
    border: none;
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.85rem;
}

.filter-btn.active,
.filter-btn:hover {
    background-color: var(--primary);
    color: white;
}

.item-list {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    align-content: start;
}

.item-card {
    background-color: var(--bg-light);
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 5px;
    text-align: center;
    cursor: grab;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.item-card:hover {
    border-color: var(--primary);
    background-color: #383838;
}

.item-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 5px;
}

.item-card span {
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Main Editor Area */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-darker);
    overflow: hidden;
}

.top-bar {
    padding: 1rem;
    background-color: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.kit-settings {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 120px;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-group input {
    background-color: var(--bg-light);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px;
    border-radius: 4px;
}

/* Rust Inventory Layout */
.kit-content-rust {
    display: flex;
    gap: 20px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    height: 100%;
    overflow: hidden;
    justify-content: center;
}

.rust-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Left Column: Character & Wear */
.left-col {
    width: 300px;
}

.character-preview {
    flex: 1;
    background-color: #1a1a1a;
    /* Placeholder bg */
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-image: url('https://files.facepunch.com/rust/item/hazmatsuit_512.png');
    /* Temp bg */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.char-placeholder {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.1);
    font-weight: bold;
    text-transform: uppercase;
}

.wear-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wear-grid {
    display: flex;
    /* Or grid */
    gap: 5px;
    justify-content: center;
}

/* Right Column: Inventory */
/* .right-col { width: auto; } removed */

.inventory-container,
.belt-container {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 2px;
}

.rust-header {
    color: #ccc;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rust-grid {
    display: grid;
    gap: 5px;
}

.main-grid {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.belt-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Slot Styling */
.inv-slot {
    width: 60px;
    /* Rust slots are roughly square */
    height: 60px;
    background-color: rgba(60, 60, 60, 0.6);
    border: 1px solid #222;
    position: relative;
    cursor: pointer;
    transition: background-color 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inv-slot:hover {
    background-color: rgba(100, 100, 100, 0.5);
    border-color: #555;
}

.inv-slot.drag-over {
    background-color: rgba(206, 66, 43, 0.3);
    border-color: var(--primary);
}

.inv-slot.occupied {
    background-color: rgba(40, 40, 40, 0.8);
}

.slot-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    pointer-events: none;
}

.slot-amount {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 11px;
    color: #eee;
    text-shadow: 1px 1px 0 #000;
    pointer-events: none;
    font-weight: bold;
}

.slot-name {
    display: none;
    /* Tooltip maybe? */
}

/* Controls inside slot (hidden by default, maybe show on click/hover) */
/* For now, we might need a separate "Selected Item" panel to edit details */

/* Context menu placeholder removed */

.btn-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 5px;
    font-size: 1.2rem;
}

.btn-remove:hover {
    color: #d32f2f;
}

/* Bottom Bar */
.bottom-bar {
    height: 200px;
    background-color: var(--bg-dark);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.actions {
    padding: 10px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn.primary {
    background-color: var(--primary);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-hover);
}

.btn.secondary {
    background-color: #555;
    color: white;
}

.btn.secondary:hover {
    background-color: #666;
}

.btn.danger {
    background-color: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn.danger:hover {
    background-color: rgba(239, 83, 80, 0.1);
}

.json-preview {
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: #0d0d0d;
}

.json-preview pre {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px;
    overflow: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    color: #a5d6a7;
    white-space: pre-wrap;
}

/* Utilities */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}