/* Discord Bot Visual Builder - Node-based Programming Interface */

/* 全体のレイアウト */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #111827;
    color: #ffffff;
}

/* ノード基本スタイル */
.node {
    position: absolute;
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    user-select: none;
    min-width: 180px;
    border: 2px solid transparent;
}

.node:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.node.selected {
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* ノードタイプ別カラー */
.node[data-node-type^="event"] {
    background: linear-gradient(135deg, #059669, #047857);
}

.node[data-node-type^="action"] {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
}

.node[data-node-type^="condition"] {
    background: linear-gradient(135deg, #D97706, #B45309);
}

.node[data-node-type^="util"] {
    background: linear-gradient(135deg, #7C2D12, #92400E);
}

/* 接続ポイント */
.connection-point {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #E5E7EB;
    border: 2px solid #ffffff;
    cursor: crosshair;
    transition: all 0.2s ease;
    z-index: 10;
}

.connection-point:hover {
    transform: scale(1.3);
}

.connection-point.input {
    background: #3B82F6;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
}

.connection-point.output {
    background: #10B981;
    right: -6px;
}

.connection-point.input:hover {
    background: #1D4ED8;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.connection-point.output:hover {
    background: #047857;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

/* 接続線 */
.connection-line {
    stroke: #10B981;
    stroke-width: 2;
    fill: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.connection-line:hover {
    stroke: #34D399;
    stroke-width: 3;
}

/* ノードパレット */
.node-template {
    transition: all 0.2s ease;
    cursor: grab;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.node-template:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.node-template:active {
    cursor: grabbing;
}

/* キャンバス */
#canvas-container {
    position: relative;
    background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.05) 0%, rgba(255, 255, 255, 0) 50%),
                radial-gradient(circle at 80% 20%, rgba(120, 119, 198, 0.05) 0%, rgba(255, 255, 255, 0) 50%),
                radial-gradient(circle at 40% 80%, rgba(120, 119, 198, 0.05) 0%, rgba(255, 255, 255, 0) 50%);
}

#canvas {
    transform-origin: 0 0;
    transition: transform 0.2s ease;
}

/* グリッドパターン */
.grid-pattern {
    opacity: 0.3;
}

/* プロパティパネル */
#properties-panel {
    background: linear-gradient(180deg, #1F2937 0%, #111827 100%);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
}

/* モーダル */
#code-modal {
    backdrop-filter: blur(4px);
}

#code-modal .bg-gray-800 {
    background: linear-gradient(135deg, #1F2937, #111827);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* コードプレビュー */
#code-preview {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    background: #0D1117;
    color: #E6EDF3;
    border: 1px solid #30363D;
    line-height: 1.6;
    font-size: 13px;
}

/* ボタンスタイル */
button {
    transition: all 0.2s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

button:hover:before {
    left: 100%;
}

/* 削除ボタン */
.delete-node {
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 20;
}

.node:hover .delete-node {
    opacity: 1;
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-slideInLeft {
    animation: slideInLeft 0.3s ease-out;
}

.animate-slideInRight {
    animation: slideInRight 0.3s ease-out;
}

/* 通知 */
.notification {
    animation: slideInRight 0.3s ease-out;
    backdrop-filter: blur(8px);
}

/* スクロールバー */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1F2937;
}

::-webkit-scrollbar-thumb {
    background: #4B5563;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

/* フォーカス状態 */
input:focus, 
textarea:focus, 
select:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .w-80 {
        width: 16rem;
    }
}

@media (max-width: 768px) {
    .w-80 {
        width: 12rem;
    }
    
    .node {
        min-width: 160px;
    }
    
    #code-modal .max-w-4xl {
        max-width: 95vw;
    }
}

/* ヘッダー */
header {
    background: linear-gradient(90deg, #1F2937, #111827);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* サイドバー */
.w-80 {
    background: linear-gradient(180deg, #1F2937 0%, #111827 100%);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

/* ノードタイトルスタイル */
.node .font-semibold {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 接続線のアニメーション */
@keyframes connectionPulse {
    0%, 100% {
        stroke-opacity: 1;
    }
    50% {
        stroke-opacity: 0.7;
    }
}

.connection-line.active {
    animation: connectionPulse 2s infinite;
}

/* ドラッグ中のスタイル */
.dragging {
    opacity: 0.8;
    transform: rotate(3deg);
    z-index: 1000;
}

/* 選択状態のハイライト */
.selected {
    box-shadow: 0 0 0 2px #3B82F6, 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* キャンバス操作ボタン */
.canvas-controls button {
    background: rgba(31, 41, 55, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ローディング状態 */
.loading {
    position: relative;
}

.loading:after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 入力フィールドのプレースホルダー */
input::placeholder,
textarea::placeholder {
    color: #9CA3AF;
    opacity: 0.7;
}

/* ツールチップ */
.tooltip {
    position: relative;
}

.tooltip:hover:after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}