/**
 * Canvas Minimap (鸟瞰图) 样式文件
 * ===========================================
 * 提供画布鸟瞰图组件的详细样式定义
 */

/* 鸟瞰图容器 */
.canvas-minimap {
    width: var(--minimap-width, 200px);
    height: var(--minimap-height, 150px);
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: transparent; /* 设置为透明背景 */
    z-index: 1000;
    overflow: hidden;
    cursor: crosshair;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.canvas-minimap:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* 鸟瞰图画布 */
.minimap-canvas {
    position: absolute;
    top: var(--minimap-padding, 10px);
    left: var(--minimap-padding, 10px);
    background: transparent; /* 画布本身透明，由JS填充 */
    display: block;
}

/* 视口指示器 */
.minimap-viewport {
    position: absolute;
    pointer-events: none;
    box-sizing: border-box;
    border: var(--viewport-border-width, 2px) solid var(--viewport-border-color, #007bff);
    background: var(--viewport-bg-color, rgba(0, 123, 255, 0.3));
    transition: all 0.2s ease;
}

/* 工具栏 */
.minimap-toolbar {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
}

/* 通用按钮样式 */
.minimap-toolbar button {
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    padding: 0;
    border-radius: 4px;
}

/* 切换按钮的具体样式 */
.minimap-toggle-button {
    width: 24px;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.6); /* 亮色模式默认颜色 */
    -webkit-mask-size: 16px 16px;
    mask-size: 16px 16px;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

/* 可见状态下的图标和提示 */
.canvas-minimap.is-visible .minimap-toggle-button {
    -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpath d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"%3E%3C/path%3E%3Cline x1="1" y1="1" x2="23" y2="23"%3E%3C/line%3E%3C/svg%3E');
    mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpath d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"%3E%3C/path%3E%3Cline x1="1" y1="1" x2="23" y2="23"%3E%3C/line%3E%3C/svg%3E');
    content: '隐藏鸟瞰图'; /*  Tooltip via content */
}

/* 隐藏状态下的图标和提示 */
.canvas-minimap:not(.is-visible) .minimap-toggle-button {
    -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpath d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"%3E%3C/path%3E%3Ccircle cx="12" cy="12" r="3"%3E%3C/circle%3E%3C/svg%3E');
    mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpath d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"%3E%3C/path%3E%3Ccircle cx="12" cy="12" r="3"%3E%3C/circle%3E%3C/svg%3E');
    content: '显示鸟瞰图'; /* Tooltip via content */
}

.minimap-toggle-button:hover {
    background-color: rgba(0, 0, 0, 0.8); /* 亮色模式悬停颜色 */
}

.minimap-toolbar button:active {
    transform: scale(0.95);
}

/* 暗色模式下的切换按钮 */
[data-theme="dark"] .minimap-toggle-button {
    background-color: rgba(255, 255, 255, 0.7); /* 暗色模式图标颜色 */
}

[data-theme="dark"] .minimap-toggle-button:hover {
    background-color: rgba(255, 255, 255, 0.9); /* 暗色模式悬停颜色 */
}

/* 响应式设计 */
@media (max-width: 768px) {
    .canvas-minimap {
        bottom: 10px;
        right: 10px;
        transform: scale(0.8);
        transform-origin: bottom right;
    }
    
    .minimap-toolbar button {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
}

@media (max-width: 768px) and (pointer: coarse) {
    .canvas-minimap {
        display: none !important;
        pointer-events: none !important;
    }
}

@media (max-height: 600px) {
    .canvas-minimap {
        bottom: 5px;
        right: 5px;
        transform: scale(0.7);
        transform-origin: bottom right;
    }
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
    .canvas-minimap,
    .minimap-viewport,
    .minimap-toolbar button {
        transition: none;
    }
}

/* 打印时隐藏 */
@media print {
    .canvas-minimap {
        display: none;
    }
}

/* 鸟瞰图隐藏状态 */
.canvas-minimap.minimapCanvas-hidden {
    opacity: 0.2;
    transform: scale(0.9);
    pointer-events: none;
}

/* 确保隐藏时切换按钮仍然可以点击 */
.canvas-minimap.minimapCanvas-hidden .minimap-toggle-button {
    pointer-events: auto;
}

/* 鸟瞰图拖拽状态 */
.canvas-minimap.dragging {
    cursor: grabbing;
}

.canvas-minimap.dragging .minimap-viewport {
    opacity: 0.6;
}

@keyframes minimap-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
