* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    padding: 20px;
    border-bottom: 2px solid #e94560;
}

.header h1 {
    font-size: 24px;
    color: #e94560;
    margin-bottom: 5px;
}

.header p {
    color: #aaa;
    font-size: 14px;
}

.container {
    display: grid;
    grid-template-columns: 350px 1fr;
    height: calc(100vh - 85px);
}

/* Sidebar */
.sidebar {
    background: #16213e;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-input-area {
    padding: 20px;
    border-bottom: 1px solid #333;
}

.file-drop {
    border: 2px dashed #444;
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-drop:hover {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.1);
}

.file-drop.dragover {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.2);
}

.file-drop-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.file-drop h3 {
    color: #e94560;
    margin-bottom: 5px;
}

.file-drop p {
    color: #888;
    font-size: 13px;
}

#file-input {
    display: none;
}

/* Stats */
.stats-panel {
    padding: 15px 20px;
    background: #0f3460;
    border-bottom: 1px solid #333;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-item {
    background: #16213e;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #e94560;
}

.stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

/* Resource list */
.resource-list-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.resource-tabs {
    display: flex;
    background: #0f3460;
    border-bottom: 1px solid #333;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    color: #e94560;
    background: #16213e;
    border-bottom: 2px solid #e94560;
}

.resource-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.resource-item {
    padding: 10px 12px;
    background: #0f3460;
    border-radius: 5px;
    margin-bottom: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.resource-item:hover {
    background: #1a4a7a;
}

.resource-item.selected {
    background: #e94560;
}

.resource-name {
    font-size: 13px;
    font-weight: 500;
}

.resource-info {
    font-size: 11px;
    color: #888;
}

.resource-item.selected .resource-info {
    color: rgba(255, 255, 255, 0.7);
}

/* Main content */
.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    background: #0f3460;
    border-bottom: 1px solid #333;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 8px 16px;
    background: #16213e;
    border: 1px solid #333;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-btn:hover {
    background: #1a4a7a;
    border-color: #e94560;
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-btn.primary {
    background: #e94560;
    border-color: #e94560;
}

.toolbar-btn.primary:hover {
    background: #d63d56;
}

.toolbar-separator {
    width: 1px;
    background: #333;
    margin: 0 5px;
}

/* Viewer */
.viewer-container {
    flex: 1;
    position: relative;
    background: #111;
    overflow: hidden;
}

#viewer-canvas {
    width: 100%;
    height: 100%;
}

.viewer-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 12px;
}

.viewer-info h4 {
    color: #e94560;
    margin-bottom: 5px;
}

.viewer-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 11px;
    color: #888;
}

/* Progress */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.progress-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.progress-box {
    background: #16213e;
    padding: 30px 50px;
    border-radius: 10px;
    text-align: center;
    min-width: 300px;
}

.progress-box h3 {
    margin-bottom: 15px;
    color: #e94560;
}

.progress-bar {
    height: 10px;
    background: #0f3460;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #e94560;
    width: 0%;
    transition: width 0.2s;
}

.progress-text {
    font-size: 13px;
    color: #888;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #555;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state h3 {
    margin-bottom: 10px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #16213e;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Texture preview */
.texture-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px;
    overflow-y: auto;
    height: 100%;
    align-content: flex-start;
}

.texture-card {
    background: #16213e;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    width: 128px;
}

.texture-card:hover {
    transform: scale(1.05);
}

.texture-card canvas {
    width: 128px;
    height: 128px;
    object-fit: contain;
    background: #0f3460;
}

.texture-card-info {
    padding: 8px;
    font-size: 11px;
}

.texture-card-name {
    color: #e94560;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.texture-card-size {
    color: #888;
}

/* World blocks grid */
.world-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 5px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.world-block {
    aspect-ratio: 1;
    background: #0f3460;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.world-block:hover {
    background: #1a4a7a;
}

.world-block.valid {
    background: #1a4a7a;
    color: #fff;
}

.world-block.selected {
    background: #e94560;
}
