/* =================================================================
   GHG Input Tool - メインスタイルシート
   ================================================================= */

/* CSS Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans JP', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =================================================================
   レイアウト
   ================================================================= */

.app-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 0.75rem 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.env-badge {
    background: #f39c12;
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* 環境別バッジの色 */
.env-badge.env-prod {
    background: #3498db; /* 青: 本番環境 */
}

.env-badge.env-dev {
    background: #27ae60; /* 緑: ステージング環境 */
}

.env-badge.env-local {
    background: #f39c12; /* オレンジ: ローカル環境 */
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: #666;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.nav-link:hover {
    color: #3498db;
    background: #f8f9fa;
}

.nav-link.active {
    color: #3498db;
    background: #e3f2fd;
    font-weight: 500;
}

/* サブメニュー対応 */
.nav-item-with-submenu {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 220px;
}

.nav-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 220px;
    display: none;
    z-index: 100;
    margin-top: 4px;
}

.nav-submenu.show {
    display: block;
}

.nav-submenu .submenu-link {
    display: block;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    min-width: 220px;
}

.nav-submenu .submenu-link:last-child {
    border-bottom: none;
}

.nav-submenu .submenu-link:hover {
    background: #f8f9fa;
}

.nav-item-with-submenu > .nav-link::after {
    content: ' ▼';
    font-size: 0.7rem;
    margin-left: 0.3rem;
    
}

/* サブメニュー内のサブメニュー */
.submenu-item {
    position: relative;
}

.submenu-item > .submenu-link::after {
    content: ' ▶';
    font-size: 0.7rem;
    margin-left: 0.3rem;
    float: right;
}

.sub-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 180px;
    display: none;
    z-index: 102;
    margin-top: 0px;
}

.sub-submenu.show {
    display: block;
}

/* マスタメニューカード */
.master-menu-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.master-menu-item {
    transition: transform 0.2s;
}

.master-menu-item:hover {
    transform: translateY(-2px);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    color: #666;
    text-align: right;
}

#user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

#user-role {
    font-size: 0.8rem;
    color: #999;
}

/* ログアウトボタン */
.btn-link {
    background: none;
    border: none;
    color: #666;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-link:hover {
    color: #3498db;
    background: #f8f9fa;
}

/* メインコンテンツ */
.app-main {
    flex: 1;
    padding: 1rem 0;
}

.main-container {
    margin: 0 auto;
    padding: 0 1rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #666;
    font-size: 1.1rem;
}


/* =================================================================
   コンポーネント
   ================================================================= */

/* カード */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.card-header {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.card-header h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning-light {
    background: #fdcb6e;
    color: #fff;
}

.btn-warning-light:hover {
    background: #FCB83B;
}

.btn-outline-primary {
    background: #27ae60;
    color: white;
}

.btn-outline-primary:hover {
    background: #229954;
}

.btn-primary2 {
    background: #0d6efd;
    color: #fff;
}
.btn-primary2:hover {
    background: #0259D4;
    color: #fff;
}

.btn-success2 {
    background: #198754;
    color: #fff;
}
.btn-success2:hover {
    background: #115937;
    color: #fff;
}



/* ボタンのdisabled状態（ステータス変更後の再クリック防止用） */
.btn:disabled,
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
}

.btn:disabled:hover,
.btn[disabled]:hover {
    transform: none !important;
}

.full-width {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* フォーム */
.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* テーブル */
.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 70vh;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8f9fa;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e9ecef;
    font-size: 0.9rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #f1f3f4;
    font-size: 0.85rem;
    line-height: 1.3;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

/* ファイル一覧テーブルの列幅調整は components.css で定義 */

#files-table td:nth-child(10) {
    word-break: break-all;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* データ入力テーブルの列幅調整 */
#data-input-table th:nth-child(1) { width: 50px; }   /* チェックボックス */
#data-input-table th:nth-child(2) { width: 140px; }  /* 調査グループ */
#data-input-table th:nth-child(3) { width: 140px; }  /* 項目分類 */
#data-input-table th:nth-child(4) { width: 140px; }  /* 調査項目 */
#data-input-table th:nth-child(5) { width: 100px; }  /* 単位 */
#data-input-table th:nth-child(6) { width: 120px; }  /* 実績値（縮小） */
#data-input-table th:nth-child(7) { width: 180px; }  /* 備考（拡大） */

#data-input-table td:nth-child(1) { width: 50px; }
#data-input-table td:nth-child(2) { width: 140px; }
#data-input-table td:nth-child(3) { width: 140px; }
#data-input-table td:nth-child(4) { width: 140px; }
#data-input-table td:nth-child(5) { width: 100px; }
#data-input-table td:nth-child(6) { width: 120px; }
#data-input-table td:nth-child(7) { width: 180px; }

/* データ入力テーブル全体のスタイリング */
.data-input-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 固定レイアウトで列幅を確実に適用 */
}

.data-input-table th {
    background: #f8f9fa;
    padding: 0.5rem 0.4rem;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e9ecef;
    font-size: 0.85rem;
}

.data-input-table td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

/* データ入力テーブルのフォームコントロール */
#data-input-table .form-control-sm {
    width: 100%;
    box-sizing: border-box;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    height: auto;
    min-height: 28px;
}

.text-center {
    text-align: center;
}

/* =================================================================
   ダッシュボード
   ================================================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.status-item, .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.status-item:last-child, .stat-item:last-child {
    border-bottom: none;
}

.status-label, .stat-label {
    font-weight: 500;
    color: #666;
}

.status-value, .stat-value {
    font-weight: 600;
    color: #2c3e50;
}

.dev-info {
    line-height: 1.8;
    color: #666;
}

/* =================================================================
   設定ページ
   ================================================================= */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.setting-item {
    margin-bottom: 1rem;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

/* =================================================================
   ローディング
   ================================================================= */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =================================================================
   通知
   ================================================================= */

.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    pointer-events: none;
}

.notification {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 0.5rem;
    pointer-events: auto;
    transform: translateX(100%);
    animation: slideIn 0.3s ease forwards;
    max-width: 400px;
    border-left: 4px solid #3498db;
}

.notification.success {
    border-left-color: #27ae60;
}

.notification.error {
    border-left-color: #e74c3c;
}

.notification.warning {
    border-left-color: #f39c12;
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

/* =================================================================
   レスポンシブ
   ================================================================= */

@media (max-width: 1024px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .app-title {
        font-size: 1.25rem;
    }
    
    .nav-menu {
        flex-wrap: wrap;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 0 0.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* =================================================================
   画像マーキング機能
   ================================================================= */

.image-section {
    position: relative;
    overflow: hidden;
    max-width: 100%;
    max-height: 1000px;   /* マークアップエリアの高さ（大きくするともっと証憑ファイルが拡大される） */
    min-width: 600px;
}

/* ページナビゲーション */
.page-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: nowrap;
}

.page-navigation .page-display {
    display: flex;
    align-items: center;
    white-space: nowrap;
    font-weight: 500;
}

.page-navigation .page-jump {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.image-viewer {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 600px;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

#invoice-image {
    display: block;
    max-width: 1000px !important;
    /* マークアップエリアの高さ（大きくするともっと証憑ファイルが拡大される。コメントアウトすることで上限を取っていっぱいいっぱい表示させる） */
    /* max-height: 600px !important; */
    width: auto;
    height: auto;
    user-select: none;
    pointer-events: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 1;
}

.markup-canvas {
    position: absolute;
    pointer-events: auto !important;
    cursor: crosshair;
    z-index: 10;
    background: transparent;
    opacity: 1;
}

.markup-tools {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 0.75rem;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    min-width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.tool-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.tool-btn:active {
    transform: translateY(0);
}

/* 太さ選択UI */
.line-width-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #495057;
}

.line-width-selector label {
    margin: 0;
    font-weight: 500;
    white-space: nowrap;
}

.line-width-selector select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #f8f9fa;
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 50px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.line-width-selector select:hover {
    border-color: #3498db;
}

.line-width-selector select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* マーキングカラー表示 */
.markup-tools::before {
    content: "ツール: ";
    align-self: center;
    font-weight: 500;
    color: #495057;
}

.markup-tools::after {
    content: "🔴 赤色 (入力段階)";
    align-self: center;
    background: #fff5f5;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #fed7d7;
    font-size: 0.85rem;
}

/* =================================================================
   マイグレーション管理ページ
   ================================================================= */

.migration-section {
    margin-bottom: 2rem;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.migration-section h3 {
    margin-bottom: 1rem;
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.page-description {
    color: #666;
    margin-bottom: 1.5rem;
    font-style: italic;
}

.migration-actions {
    margin-top: 1rem;
    text-align: right;
}

.migration-list-container,
.migration-history-container {
    margin-bottom: 1rem;
}

/* =================================================================
   モーダルダイアログ
   ================================================================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Bootstrap modal dialog adjustments */
.modal-dialog {
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
    margin: 0.5rem auto;
    width: auto;
    height: fit-content !important;
    min-height: auto !important;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
    height: auto !important;
}

.modal-dialog-centered .modal-content {
    height: auto !important;
    max-height: 90vh;
}

/* Ensure modal content fits properly */
.modal .modal-content {
    height: auto !important;
    min-height: auto !important;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #2d3748;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #f7fafc;
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* =================================================================
   マイグレーションモーダル特有のスタイル
   ================================================================= */

.warning-message {
    background-color: #fff5cc;
    border: 1px solid #f6e05e;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.warning-message strong {
    color: #d69e2e;
    display: block;
    margin-bottom: 0.5rem;
}

.warning-message p {
    margin: 0.5rem 0;
    color: #744210;
}

.migration-details {
    background-color: #f7fafc;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.migration-details p {
    margin: 0.5rem 0;
    color: #4a5568;
}

.migration-details strong {
    color: #2d3748;
    min-width: 80px;
    display: inline-block;
}

.confirmation-input {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

.confirmation-input label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #4a5568;
}

.confirmation-input input[type="checkbox"] {
    margin: 0;
}

/* =================================================================
   ファイル一覧の強調表示
   ================================================================= */

/* ハイライトアニメーション（初回のみ） */
@keyframes highlightRow {
    0% {
        background-color: #fef3c7;
        transform: scale(1);
    }
    50% {
        background-color: #fde68a;
        transform: scale(1.005);
    }
    100% {
        background-color: #fef3c7;
        transform: scale(1);
    }
}

.highlight-row {
    animation: highlightRow 0.5s ease-in-out 2; /* 最初に2回だけアニメーション */
    background-color: #fef3c7 !important; /* アニメーション後も背景色を維持 */
    transition: background-color 0.3s ease;
}

.highlight-row:hover {
    background-color: #fde68a !important;
}

/* =================================================================
   N行構成データテーブル（動的項目数対応）
   ================================================================= */

/* データテーブルの基本スタイル */
.data-input-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 14px;
}

/* レコード内の行スタイリング（N行構成対応） */
/* 全てのデータ行 */
.data-row {
    border-bottom: none !important; /* レコード内の行間は境界線なし */
}

/* レコードの最後の行 */
.data-row-end {
    border-bottom: 2px solid #dee2e6 !important; /* レコード間の区切り線を太く */
}

/* チェックボックスセルのスタイル（rowspan=N） */
.data-row-start td:first-child {
    vertical-align: middle; /* 中央揃え */
    text-align: center;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
}

/* ヘッダー行のrowspanセルスタイル */
.data-input-table thead th:first-child {
    vertical-align: middle;
    text-align: center;
    background-color: #e9ecef;
}

/* ヘッダー行の縦幅を小さく */
.data-input-table thead th {
    padding: 6px 8px; /* デフォルトより小さく */
    font-size: 13px;
    line-height: 1.2;
    vertical-align: middle;
}

/* 入力フィールドのサイズ調整 */
.data-input-table .form-control-sm {
    font-size: 13px;
    padding: 4px 6px;
    height: auto;
    min-height: 32px;
}

/* ホバー効果（JSでrow-hoverクラスを付与） */
.data-row.row-hover {
    background-color: #f5f5f5;
}

/* 選択状態（JSでselectedクラスを付与） */
.data-row.selected {
    background-color: #e3f2fd;
}

/* 後方互換性: 旧クラス名のサポート（移行期間中） */
.data-row-first {
    border-bottom: none !important;
}
.data-row-second {
    border-top: none !important;
    border-bottom: 2px solid #dee2e6 !important;
}
.data-row-first td:first-child {
    vertical-align: middle;
    text-align: center;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
}
.data-row-first:hover,
.data-row-first:hover + .data-row-second {
    background-color: #f5f5f5;
}
.data-row-first.selected,
.data-row-first.selected + .data-row-second {
    background-color: #e3f2fd;
}

/* =================================================================
   ログ詳細モーダル
   ================================================================= */

.log-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.log-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.log-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.log-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #2c3e50;
}

.log-detail-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.log-detail-section h4 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.1rem;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.5rem;
}

.log-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.75rem;
}

.log-detail-grid > div {
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
}

.log-detail-grid strong {
    color: #6c757d;
    display: inline-block;
    min-width: 120px;
}

.close-btn {
    font-size: 32px;
    line-height: .5;
    padding: 6px;
}

#detail-images img {
    transition: transform 0.2s;
}

#detail-images img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* レスポンシブ対応 */
@media (max-width: 1200px) {
    .data-input-table {
        font-size: 12px;
    }

    .data-input-table .form-control-sm {
        font-size: 12px;
        padding: 3px 4px;
        min-height: 28px;
    }

    .log-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   入力項目自動補完（機能B）用スタイル
   ============================================================ */

/* VLOOKUPで自動入力されたフィールドのスタイル */
.vlookup-auto-filled {
    background-color: #e8f5e9 !important; /* 薄い緑色の背景 */
    border-color: #4caf50 !important;     /* 緑色のボーダー */
}

.vlookup-auto-filled:focus {
    background-color: #c8e6c9 !important; /* フォーカス時は少し濃い緑 */
    border-color: #2e7d32 !important;
    box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.25) !important;
}