/* ============================================
   構成分析ホワイトボード - ボード専用スタイル
   ============================================ */

/* ----- ボードコンテナ ----- */
#board-container {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f8f9fa;
}

/* ----- ボードツールバー ----- */
#board-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 44px;
}

#board-toolbar .toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 8px;
    border-right: 1px solid #e9ecef;
}

#board-toolbar .toolbar-group:last-child {
    border-right: none;
}

#board-toolbar .tool-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #495057;
    transition: all 0.2s;
}

#board-toolbar .tool-btn:hover {
    background: #e9ecef;
}

#board-toolbar .tool-btn.active {
    background: #4A90D9;
    color: white;
}

/* ★ resize モードボタンがアクティブな時はオレンジ */
#board-toolbar .tool-btn[data-mode="resize"].active {
    background: #FF9800;
    color: white;
}

#board-toolbar .tool-btn svg {
    width: 18px;
    height: 18px;
}

/* ----- バッジ ----- */
#board-toolbar .badge {
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #e9ecef;
    color: #495057;
}

#board-toolbar .badge.stats {
    background: #4A90D9;
    color: white;
}

#board-toolbar .badge.side {
    background: #6c757d;
    color: white;
}

#board-toolbar .badge.side.front {
    background: #4A90D9;
}

#board-toolbar .badge.side.back {
    background: #6f42c1;
}

/* ----- キャンバスラッパー ----- */
#canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: white;
}

#whiteboard-canvas,
#debris-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#whiteboard-canvas {
    cursor: default;
    z-index: 1;
}

#debris-canvas {
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   ★ モード別カーソル
   ============================================ */

/* 選択モード（デフォルト） */
#whiteboard-canvas.select-mode {
    cursor: default;
}

/* 新規ノードモード */
#whiteboard-canvas.draw-node-mode {
    cursor: crosshair;
}

/* 変形モード */
#whiteboard-canvas.resize-mode {
    cursor: default;
}

/* 変形モード: ハンドルホバー時のカーソル（JS側で動的に変更） */
#whiteboard-canvas.resize-mode.ns-resize {
    cursor: ns-resize !important;
}

#whiteboard-canvas.resize-mode.ew-resize {
    cursor: ew-resize !important;
}

/* エッジ作成モード */
#whiteboard-canvas.draw-edge-mode {
    cursor: crosshair;
}

/* 消去モード */
#whiteboard-canvas.erase-mode {
    cursor: not-allowed;
}

/* ============================================
   プロパティパネル
   ============================================ */
#property-panel {
    position: absolute;
    right: 0;
    top: 0;
    width: 300px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.08);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 10;
    border-left: 1px solid #e9ecef;
}

#property-panel.open {
    transform: translateX(0);
}

#property-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

#property-panel .panel-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
}

#property-panel .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #adb5bd;
    transition: color 0.2s;
    line-height: 1;
}

#property-panel .close-btn:hover {
    color: #495057;
}

#property-panel .panel-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* ----- プロパティグループ ----- */
#property-panel .property-group {
    margin-bottom: 16px;
}

#property-panel .property-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#property-panel .property-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
}

#property-panel .property-group textarea:focus {
    outline: none;
    border-color: #4A90D9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

#property-panel .property-group select,
#property-panel .property-group input[type="text"] {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s;
}

#property-panel .property-group select:focus,
#property-panel .property-group input[type="text"]:focus {
    outline: none;
    border-color: #4A90D9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

#property-panel .property-group input[type="color"] {
    width: 48px;
    height: 36px;
    padding: 2px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
}

/* ----- タグ関連 ----- */
#property-panel .tag-input-group {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

#property-panel .tag-input-group input {
    flex: 1;
}

#property-panel .tag-input-group button {
    padding: 6px 14px;
    background: #4A90D9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

#property-panel .tag-input-group button:hover {
    background: #357ABD;
}

#property-panel #prop-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    min-height: 28px;
}

#property-panel .tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px 2px 12px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
    color: #2d3748;
    animation: tagFadeIn 0.2s ease;
}

@keyframes tagFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#property-panel .tag-item .remove-tag {
    cursor: pointer;
    color: #adb5bd;
    font-weight: bold;
    font-size: 14px;
    transition: color 0.2s;
    line-height: 1;
}

#property-panel .tag-item .remove-tag:hover {
    color: #dc3545;
}

/* ----- ボタン ----- */
#property-panel .button-group {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

#property-panel .primary-btn {
    padding: 8px 20px;
    background: #4A90D9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

#property-panel .primary-btn:hover {
    background: #357ABD;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

#property-panel .danger-btn {
    padding: 8px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

#property-panel .danger-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

#property-panel .secondary-btn {
    padding: 8px 20px;
    background: #e9ecef;
    color: #495057;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

#property-panel .secondary-btn:hover {
    background: #dee2e6;
}

/* ============================================
   グリッド
   ============================================ */
.grid-line {
    stroke: #e9ecef;
    stroke-width: 0.5;
}

/* ============================================
   ノード選択ハイライト
   ============================================ */
.node-highlight {
    stroke: #4A90D9;
    stroke-width: 2;
    stroke-dasharray: 4 4;
    animation: dash 0.5s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -8;
    }
}

/* ============================================
   ハンドル関連（resize モード用）
   ============================================ */

/* ハンドルホバー時の強調（JS側で描画するため補助） */
.handle-hover {
    cursor: pointer;
}

/* resize モード時のハンドル強調 */
.resize-mode .handle-resize {
    fill: #FFF3CD;
    stroke: #FF9800;
    stroke-width: 2.5;
}

/* 通常モード時のハンドル */
.select-mode .handle-edge {
    fill: white;
    stroke: #4A90D9;
    stroke-width: 2.5;
}

/* ============================================
   レスポンシブ
   ============================================ */
@media (max-width: 768px) {
    #property-panel {
        width: 100%;
        height: 50%;
        top: auto;
        bottom: 0;
        transform: translateY(100%);
        border-left: none;
        border-top: 1px solid #e9ecef;
    }

    #property-panel.open {
        transform: translateY(0);
    }

    #property-panel .panel-header {
        padding: 10px 14px;
    }

    #property-panel .panel-body {
        padding: 12px;
    }

    #board-toolbar {
        padding: 4px 8px;
        gap: 3px;
    }

    #board-toolbar .tool-btn {
        width: 30px;
        height: 30px;
    }

    #board-toolbar .tool-btn svg {
        width: 16px;
        height: 16px;
    }

    #board-toolbar .badge {
        font-size: 10px;
        padding: 2px 10px;
    }
}

@media (max-width: 480px) {
    #property-panel {
        height: 60%;
    }

    #board-toolbar .toolbar-group {
        padding: 0 4px;
        gap: 1px;
    }

    #board-toolbar .tool-btn {
        width: 28px;
        height: 28px;
    }
}
