/**
 * style.css
 *
 * インタラクティブDiffマージツールのスタイルシート
 * - 全体レイアウト（Flexbox）
 * - 3ペインレイアウト（Grid）
 * - Diff表示スタイル（削除、挿入、等しい）
 * - クリック可能要素のインタラクション
 */

/* ========================================
   リセット・基本設定
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   ヘッダー（コンパクト）
   ======================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid #ddd;
}

.title {
    font-size: 20px;
    font-weight: bold;
}

.github-link {
    font-size: 14px;
    color: #666;
    text-decoration: none;
}

.github-link:hover {
    color: #2196F3;
    text-decoration: underline;
}

.header-links {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.header-links span {
    cursor: pointer;
}

.header-links span:hover {
    color: #2196F3;
    text-decoration: underline;
}

/* ========================================
   アクションボタン
   ======================================== */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 10px 20px;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
}

.btn {
    padding: 8px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #2196F3;
    color: white;
}

.btn-primary:hover {
    background-color: #0b7dda;
}

.btn-secondary {
    background-color: #FF9800;
    color: white;
}

.btn-secondary:hover {
    background-color: #e68900;
}

.btn-danger {
    background-color: #f44336;
    color: white;
}

.btn-danger:hover {
    background-color: #d32f2f;
}

.btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* ========================================
   3ペインレイアウト
   ======================================== */
.panels-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 10px;
    flex: 1;
    min-height: 0;
}

.panel {
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f0f0f0;
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
}

.panel-header h2 {
    font-size: 16px;
    font-weight: bold;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* パネルヘッダーのアップロードボタン */
.upload-btn-small {
    padding: 4px 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.upload-btn-small:hover {
    background-color: #45a049;
}

/* ダウンロードボタン（青色） */
#btn-download.upload-btn-small {
    background-color: #2196F3;
}

#btn-download.upload-btn-small:hover {
    background-color: #1976D2;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    font-family: 'Noto Sans JP', 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 0;
}

/* ========================================
   ドラッグ&ドロップ
   ======================================== */
.drop-zone {
    transition: all 0.3s;
}

.drop-zone.drag-over {
    background-color: #e3f2fd;
    border: 2px dashed #2196F3;
}

.drop-zone:empty::before {
    content: 'ファイルをドラッグ&ドロップ\Aまたはアップロードボタンをクリック';
    white-space: pre-wrap;
    text-align: center;
    display: block;
    color: #999;
    font-style: italic;
    padding: 40px 20px;
}

/* ========================================
   Diff表示スタイル
   ======================================== */

/* 削除された部分（赤背景） */
.diff-delete {
    background-color: #ffcccc;
    border-radius: 2px;
}

/* 挿入された部分（緑背景） */
.diff-insert {
    background-color: #ccffcc;
    border-radius: 2px;
}

/* 等しい部分（通常テキスト） */
.diff-equal {
    /* デフォルトスタイル */
}

/* クリック可能な差分 */
.clickable {
    cursor: pointer;
    position: relative;
}

.clickable:hover {
    opacity: 0.7;
}

.clickable:hover::after {
    content: 'クリックして切替';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
}

/* 選択されている差分（ペアの排他的選択） - フォント太字で強調 */
.diff-selected {
    font-weight: bold;
}

/* 選択されていない差分（ペアの排他的選択） */
.diff-unselected {
    opacity: 0.5;
}

/* ========================================
   結果パネルの色分け表示
   ======================================== */

/* A側から採用された部分（赤系） */
.result-from-a {
    background-color: #ffcccc;
    border-radius: 2px;
    font-weight: bold;
}

/* B側から採用された部分（緑系） */
.result-from-b {
    background-color: #ccffcc;
    border-radius: 2px;
    font-weight: bold;
}

/* ========================================
   スクロールバーのカスタマイズ
   ======================================== */
.panel-content::-webkit-scrollbar {
    width: 8px;
}

.panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   レスポンシブ対応
   ======================================== */
@media (max-width: 1200px) {
    .panels-container {
        grid-template-columns: 1fr;
    }

    .panel {
        min-height: 300px;
    }
}

/* ========================================
   マージ結果パネルのプレースホルダー
   ======================================== */
#panel-result:empty::before {
    content: '比較実行後、差分をクリックすると反映されます';
    color: #999;
    font-style: italic;
    display: block;
    padding: 40px 20px;
    text-align: center;
}
