/* ==================== Tilemap Editor Styles ==================== */

/* Main Panel - 3-Column Layout */
.tilemap-editor-panel {
    display: flex;
    height: 100%;
    background: #1e1e1e;
    color: #e0e0e0;
}

/* ==================== Panel Divider ==================== */
.panel-divider {
    flex-shrink: 0;
    background: #1a1a1a;
    transition: background 0.15s ease;
}

.panel-divider.horizontal {
    width: 4px;
    cursor: col-resize;
}

.panel-divider.vertical {
    height: 4px;
    cursor: row-resize;
}

.panel-divider:hover {
    background: #0078d4;
}

.panel-divider:active {
    background: #005a9e;
}

/* Empty state */
.tilemap-editor-panel .tilemap-editor-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #666;
    text-align: center;
}

.tilemap-editor-panel .tilemap-editor-empty svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.tilemap-editor-panel .tilemap-editor-empty h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #999;
}

.tilemap-editor-panel .tilemap-editor-empty p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

/* ==================== Center Viewport ==================== */
.tilemap-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #1a1a1a;
    position: relative;
}

/* ==================== Viewport Toolbar - 优化样式 ==================== */
.viewport-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 32px;
    padding: 0 6px;
    background: #2d2d30;
    border-bottom: 1px solid #1a1a1a;
    gap: 4px;
    flex-shrink: 0;
}

.viewport-toolbar-left,
.viewport-toolbar-center,
.viewport-toolbar-right {
    display: flex;
    align-items: center;
    gap: 2px;
}

.viewport-toolbar-center {
    flex: 1;
    justify-content: center;
}

.viewport-btn-group {
    display: flex;
    align-items: center;
    gap: 1px;
    background: #252526;
    border-radius: 3px;
    padding: 1px;
}

.viewport-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 24px;
    padding: 0 8px;
    background: transparent;
    border: none;
    border-radius: 2px;
    color: #a0a0a0;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.1s ease;
    white-space: nowrap;
}

.viewport-btn:hover {
    background: #3c3c3c;
    color: #e0e0e0;
}

.viewport-btn.active {
    background: #094771;
    color: #fff;
}

.viewport-btn.icon {
    width: 24px;
    padding: 0;
}

.viewport-btn.snap-btn {
    padding: 0 6px;
    gap: 2px;
    font-size: 10px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.viewport-btn.snap-btn svg {
    width: 11px;
    height: 11px;
}

.viewport-separator {
    width: 1px;
    height: 18px;
    background: #3c3c3c;
    margin: 0 4px;
}

.zoom-display {
    min-width: 36px;
    text-align: center;
    font-size: 11px;
    color: #a0a0a0;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Exit fullscreen button */
.viewport-btn.exit-fullscreen {
    background: linear-gradient(180deg, #e05a50 0%, #c0443a 100%);
    color: #fff;
    padding: 0 10px;
    gap: 4px;
    font-weight: 500;
    border: 1px solid #a03028;
}

.viewport-btn.exit-fullscreen:hover {
    background: linear-gradient(180deg, #f06a60 0%, #d0544a 100%);
    color: #fff;
}

/* ==================== Info Overlay ==================== */
.viewport-info-overlay {
    position: absolute;
    top: 40px;
    left: 8px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 6px 8px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #3c3c3c;
    border-radius: 3px;
    font-size: 11px;
    pointer-events: none;
}

.viewport-info-overlay .info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #888;
    line-height: 1.4;
}

.viewport-info-overlay .info-item strong {
    color: #c0c0c0;
    font-weight: 600;
}

.viewport-info-overlay .info-item.warning {
    color: #e6a700;
}

.viewport-info-overlay .info-item.warning svg {
    flex-shrink: 0;
    color: #e6a700;
}

/* ==================== Canvas Container ==================== */
.viewport-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
    background:
        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: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #222;
}

.tilemap-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.tilemap-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==================== Ruler ==================== */
.viewport-ruler {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    pointer-events: none;
}

.ruler-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ruler-line {
    width: 100px;
    height: 2px;
    background: #555;
    position: relative;
}

.ruler-line::before,
.ruler-line::after {
    content: '';
    position: absolute;
    top: -4px;
    width: 2px;
    height: 10px;
    background: #555;
}

.ruler-line::before {
    left: 0;
}

.ruler-line::after {
    right: 0;
}

.ruler-marker span {
    font-size: 10px;
    color: #555;
}

/* ==================== Watermark ==================== */
.viewport-watermark {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 20px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.08);
    pointer-events: none;
    user-select: none;
    letter-spacing: 1px;
}

/* ==================== Icon Buttons ==================== */
.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: #999;
    cursor: pointer;
    transition: all 0.1s ease;
}

.icon-button:hover {
    background: #3c3c3c;
    color: #e0e0e0;
}

.icon-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.icon-button.small {
    width: 20px;
    height: 20px;
}

.icon-button.danger:hover {
    background: #5a1d1d;
    color: #f48771;
}

/* ==================== Asset Picker Dialog ==================== */
.asset-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.asset-picker-dialog {
    width: 500px;
    max-height: 600px;
    background: #252526;
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.asset-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #3c3c3c;
}

.asset-picker-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}

.asset-picker-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #999;
    cursor: pointer;
}

.asset-picker-close:hover {
    background: #3c3c3c;
    color: #e0e0e0;
}

.asset-picker-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #3c3c3c;
    color: #999;
}

.asset-picker-search input {
    flex: 1;
    border: none;
    background: transparent;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
}

.asset-picker-search input::placeholder {
    color: #666;
}

.asset-picker-content {
    flex: 1;
    overflow-y: auto;
    min-height: 300px;
    max-height: 400px;
}

.asset-picker-tree {
    padding: 8px;
}

.asset-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #e0e0e0;
}

.asset-picker-item:hover {
    background: #2d2d30;
}

.asset-picker-item.selected {
    background: #094771;
}

.asset-picker-item-icon {
    display: flex;
    align-items: center;
    color: #999;
}

.asset-picker-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-picker-loading,
.asset-picker-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 13px;
}

.asset-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #3c3c3c;
}

.asset-picker-selected {
    flex: 1;
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-picker-selected .placeholder {
    font-style: italic;
}

.asset-picker-actions {
    display: flex;
    gap: 8px;
}

.asset-picker-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.asset-picker-actions .btn-cancel {
    background: #3c3c3c;
    color: #e0e0e0;
}

.asset-picker-actions .btn-cancel:hover {
    background: #4c4c4c;
}

.asset-picker-actions .btn-confirm {
    background: #0078d4;
    color: #fff;
}

.asset-picker-actions .btn-confirm:hover:not(:disabled) {
    background: #106ebe;
}

.asset-picker-actions .btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.asset-picker-preview {
    position: fixed;
    z-index: 1001;
    background: #252526;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.asset-picker-preview img {
    display: block;
    max-width: 150px;
    max-height: 150px;
    image-rendering: pixelated;
}

/* ==================== Tileset Canvas ==================== */
.tileset-canvas {
    cursor: crosshair;
    image-rendering: pixelated;
}
