/* Graph2plan Wizard 風格佈局 */

/* 根容器 */
.wizard-container {
    display: flex;
    height: 100vh;
    background: #f5f5f5;
    font-family: 'Open Sans', sans-serif;
}

/* 左側步驟導覽 */
.step-nav {
    width: 220px;
    min-width: 220px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.step-nav-title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.step-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.step-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.step-item.active {
    background: rgba(0, 114, 203, 0.2);
    color: #fff;
    border-left-color: #0072cb;
}

.step-item.completed {
    color: rgba(255, 255, 255, 0.8);
}

.step-item.disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.step-item.active .step-number {
    background: #0072cb;
    color: #fff;
}

.step-item.completed .step-number {
    background: #5d9043;
    color: #fff;
}

.step-item.completed .step-number::after {
    content: '✓';
}

.step-item.completed .step-number span {
    display: none;
}

.step-label {
    font-size: 14px;
    font-weight: 500;
}

/* 右側內容區 */
.step-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 頂部圖例列 */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    gap: 25px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #a7a39d;
}

/* 步驟內容 */
.step-content {
    flex: 1;
    padding: 25px;
    display: none;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.step-content.active {
    display: flex;
}

.step-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    /* 為滾動條留出空間 */
}

.step-content-title {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.step-content-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 25px;
}

/* Step 1 特殊佈局：填滿高度 */
#step1.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#step1 .upload-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 卡片樣式 */
.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title img {
    width: 20px;
    height: 20px;
}

/* 按鈕樣式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: #0072cb;
    color: #fff;
}

.btn-success {
    background: #5d9043;
    color: #fff;
}

.btn-secondary {
    background: #699cbb;
    color: #fff;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* 上傳區域 */
.upload-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.upload-zone:hover {
    border-color: #0072cb;
    background: rgba(0, 114, 203, 0.05);
}

.upload-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 16px;
    color: #666;
}

/* 圖形顯示區 */
.graph-area {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.graph-box {
    border: 2px solid #d2d2d2;
    border-radius: 12px;
    background: #fff;
    position: relative;
    flex: 1;
    min-width: 300px;
    height: calc(100vh - 340px);
    min-height: 400px;
    overflow: hidden !important;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 強制建立包含上下文，確保絕對定位的子元素被裁剪 */
    contain: paint;
}

/* Step 2 專用：讓 graph-box 在 flex 之下自動填滿 */
#step2 .graph-box {
    height: 100%;
}

/* 為所有 graph-box 內的 SVG 容器建立裁剪邊界 */
#predictbox,
#rightbox,
#leftbox {
    /* 確保容器本身建立裁剪上下文 */
    isolation: isolate;
}

/* 限制 SVG 元素的可見區域 */
#predictbox svg,
#rightbox svg,
#leftbox svg {
    /* 移除強制的 inset 裁切，允許 JS 動態設定的 polygon clip-path 生效 */
    max-width: calc(100% - 4px);
    max-height: calc(100% - 4px);
}

.graph-box-title {
    position: absolute;
    top: 12px;
    left: 15px;
    font-size: 13px;
    color: #666;
    font-weight: 500;
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 1000;
}

/* 檢索結果列表 */
.results-panel {
    width: 200px;
    min-width: 200px;
    border: 2px solid #d2d2d2;
    border-radius: 12px;
    background: #fff;
    overflow-y: auto;
    max-height: 516px;
}

.placeholder-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #999;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 100;
    pointer-events: none;
}

.results-title {
    padding: 15px;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

/* Results 項目卡片 - 超小型化方案 */
#hsList li {
    flex: 0 0 200px !important;
    width: 200px !important;
    height: 200px !important;
    min-width: 200px !important;
    max-width: 200px !important;
    padding: 0 !important;
    margin: 4px !important;
    list-style: none !important;
}

#hsList .api-text {
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 4px;
    overflow: hidden;
}

#hsList .api-text:hover {
    background: #e8e8e8;
}

#hsList .pngls,
#hsList button.api-title {
    background: #fff !important;
    border: 1px solid #ddd !important;
    padding: 2px !important;
    cursor: pointer;
    width: 100% !important;
    height: 100% !important;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    /* 極小文字 */
}

#hsList img {
    width: 200px !important;
    /* 配合卡片大小 */
    height: 200px !important;
    object-fit: contain;
    display: block;
}

/* 下一步按鈕 */
.next-step-btn {
    margin-top: 20px;
    text-align: right;
}

/* 篩選器區域 */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

/* Add Node 區域 */
.add-node-bar {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 15px;
}

.add-node-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.add-node-item:hover {
    background: #e9e9e9;
}

.node-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #a7a39d;
}

/* 操作按鈕組 */
.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* 響應式 */
@media (max-width: 1200px) {
    .graph-box {
        width: 400px;
        height: 400px;
    }
}