/**
 * BSP Entity Viewer Styles
 * Quake Live Tools
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    overflow: hidden;
}

code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Main Layout */
.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Panel Headers */
.panel-header {
    padding: 20px;
    border-bottom: 1px solid #e1e4e8;
    background: #fff;
}

.panel-header h1,
.panel-header h2 {
    margin-bottom: 4px;
    font-weight: 600;
    color: #24292e;
}

.panel-header h1 {
    font-size: 1.5rem;
}

.panel-header h2 {
    font-size: 1.25rem;
}

.subtitle {
    font-size: 0.875rem;
    color: #6a737d;
}

/* Left Panel: Entity List */
.entity-panel {
    width: 420px;
    background: #fff;
    border-right: 1px solid #e1e4e8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Upload Zone */
.upload-zone {
    margin: 20px;
    padding: 40px 20px;
    border: 2px dashed #d1d5da;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #0366d6;
    background: #f1f8ff;
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    color: #6a737d;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 1rem;
    font-weight: 500;
    color: #24292e;
    margin-bottom: 4px;
}

.upload-subtext {
    font-size: 0.875rem;
    color: #6a737d;
    margin-bottom: 12px;
}

.upload-hint {
    font-size: 0.75rem;
    color: #959da5;
}

/* Map Info */
.map-info {
    padding: 20px;
    border-bottom: 1px solid #e1e4e8;
    background: #f6f8fa;
}

.map-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #24292e;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.75rem;
    color: #6a737d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1rem;
    color: #24292e;
    font-weight: 600;
}

/* Entity Container */
.entity-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Entity Categories */
.entity-category {
    margin-bottom: 20px;
}

.category-header {
    background: #f6f8fa;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #24292e;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.category-header:hover {
    background: #e1e4e8;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.category-count {
    background: #e1e4e8;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.entity-list {
    margin-top: 8px;
}

/* Entity Items */
.entity-item {
    padding: 12px;
    margin: 6px 0;
    border-left: 3px solid #0366d6;
    background: #fafbfc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.entity-item:hover {
    background: #f1f8ff;
    transform: translateX(4px);
}

.entity-item.selected {
    background: #f1f8ff;
    border-left-color: #0366d6;
    box-shadow: 0 2px 4px rgba(3, 102, 214, 0.1);
}

.entity-classname {
    font-weight: 600;
    color: #24292e;
    margin-bottom: 6px;
    font-size: 0.875rem;
}

.entity-props {
    font-size: 0.75rem;
    color: #6a737d;
    line-height: 1.5;
}

.entity-props div {
    margin: 2px 0;
}

/* Color coding for categories */
.entity-item.spawns {
    border-left-color: #4A90E2;
}

.entity-item.weapons {
    border-left-color: #E74C3C;
}

.entity-item.items {
    border-left-color: #2ECC71;
}

.entity-item.powerups {
    border-left-color: #F39C12;
}

.entity-item.triggers {
    border-left-color: #95A5A6;
}

.entity-item.lights {
    border-left-color: #F1C40F;
}

.entity-item.other {
    border-left-color: #7F8C8D;
}

/* Right Panel: Map Visualization */
.map-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

.canvas-container {
    flex: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f6f8fa;
}

#map-canvas {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    max-height: 100%;
}

/* Instructions */
.instructions {
    padding: 40px;
    max-width: 600px;
    margin: 0 auto;
}

.instructions h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: #24292e;
}

.instructions ol {
    margin-left: 20px;
    margin-bottom: 24px;
}

.instructions li {
    margin: 8px 0;
    color: #586069;
}

.instructions .note {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 12px;
    font-size: 0.875rem;
    color: #856404;
}

.instructions .note strong {
    color: #856404;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 300px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e1e4e8;
    border-top-color: #0366d6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-message {
    font-size: 1rem;
    color: #24292e;
    font-weight: 500;
}

/* Scrollbar Styling */
.entity-container::-webkit-scrollbar {
    width: 8px;
}

.entity-container::-webkit-scrollbar-track {
    background: #f6f8fa;
}

.entity-container::-webkit-scrollbar-thumb {
    background: #d1d5da;
    border-radius: 4px;
}

.entity-container::-webkit-scrollbar-thumb:hover {
    background: #959da5;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }

    .entity-panel {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #e1e4e8;
    }

    .map-panel {
        flex: 1;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6a737d;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.875rem;
}
