/* 領収書デジタル化アプリ - アプリ固有スタイル */

/* エンティティ名バッジ（ページ見出し用） */
.entity-label {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
    padding: 0.2rem 0.75rem;
    border-radius: 2rem;
    vertical-align: middle;
    margin-left: 0.5rem;
    letter-spacing: 0.02em;
}

/* エンティティ切替ドロップダウン（ナビバー内） */
.entity-switcher {
    background-color: #fff !important;
    color: #212529 !important;
    border-radius: 0.375rem;
    padding: 0.3rem 0.75rem !important;
    font-weight: 600;
    font-size: 0.875rem;
}

.entity-switcher:hover,
.entity-switcher:focus {
    background-color: #e9ecef !important;
    color: #000 !important;
}

.entity-switcher::after {
    margin-left: 0.4rem;
}

/* ナビバー固定時のコンテンツ余白 */
body {
    padding-top: 56px;
}

/* ログイン画面 */
.login-page {
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-top: 0;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

/* D&Dアップロードエリア */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    background-color: #fafafa;
}

/* カメラ撮影ボタン */
.camera-btn {
    padding: 0.75rem 2rem;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #0d6efd;
    background-color: #f0f7ff;
}

.upload-area .upload-icon {
    font-size: 3rem;
    color: #999;
    margin-bottom: 1rem;
}

/* アップロード進捗 */
.upload-progress {
    max-height: 300px;
    overflow-y: auto;
}

.upload-progress .file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.upload-progress .file-item:last-child {
    border-bottom: none;
}

.upload-progress .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

.upload-progress .progress {
    width: 120px;
    flex-shrink: 0;
}

/* 領収書一覧テーブル */
.receipts-table {
    table-layout: fixed;
    width: 100%;
}

.receipts-table th,
.receipts-table td {
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 確認ステータスバッジ */
.verified-badge {
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.verified-pending {
    background-color: #0d6efd;
    color: #fff;
}

.verified-done {
    background-color: #198754;
    color: #fff;
}

/* ソート可能ヘッダー */
.receipts-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.receipts-table th.sortable:hover {
    background-color: #3a3f44;
}

.receipts-table th.sort-active {
    background-color: #3a3f44;
}

.receipts-table th.sortable .sort-icon {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* 各カラム幅の指定 — 日付・科目・金額は省略なし */
.receipts-table .col-id       { width: 50px; }
.receipts-table .col-verified { width: 90px; text-align: center; }
.receipts-table .col-date     { width: 110px; overflow: visible; }
.receipts-table .col-category { width: 110px; overflow: visible; }
.receipts-table .col-payee    { width: auto; white-space: normal; word-break: break-all; }
.receipts-table .amount-col   { width: 100px; overflow: visible; text-align: right; font-variant-numeric: tabular-nums; }
.receipts-table .col-note     { width: auto; white-space: normal; word-break: break-all; }

.receipts-table tbody tr {
    cursor: pointer;
}

.receipts-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* モーダル：画像+編集 */
.receipt-modal .modal-dialog {
    max-width: 90vw;
}

.receipt-modal .modal-body {
    display: flex;
    gap: 1.5rem;
}

.receipt-modal .receipt-image-area {
    flex: 1;
    min-width: 0;
    max-height: 75vh;
    overflow: auto;
}

.receipt-modal .receipt-image-area img {
    max-width: 100%;
    height: auto;
}

.receipt-modal .receipt-edit-area {
    flex: 1;
    min-width: 300px;
}

@media (max-width: 768px) {
    .receipt-modal .modal-body {
        flex-direction: column;
    }
}

/* ダッシュボード */
.summary-card {
    text-align: center;
    height: 100%;
}

.summary-card .card-body h2 {
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
}

.row > [class^="col"] > .summary-card {
    height: 100%;
}

.category-table .amount-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.category-table .count-col {
    text-align: center;
}

/* 科目件数リンク */
.category-link {
    color: #0d6efd;
    text-decoration: underline;
    cursor: pointer;
}

.category-link:hover {
    color: #0a58ca;
}

.category-link-footer {
    color: #fff;
}

.category-link-footer:hover {
    color: #ccc;
}

/* コピー用表示 */
.copy-value {
    cursor: pointer;
    position: relative;
}

.copy-value:hover {
    background-color: #e9ecef;
}

.copy-value .copy-tooltip {
    display: none;
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.copy-value.copied .copy-tooltip {
    display: block;
}

/* エラー詳細テーブル */
.error-detail-table th,
.error-detail-table td {
    vertical-align: middle;
    font-size: 0.875rem;
}

.error-detail-table .error-note {
    max-width: 300px;
    white-space: normal;
    word-break: break-all;
}

/* OCRテキスト表示 */
.ocr-text-area {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.8rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ページネーション */
.pagination-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 重複候補グループ */
.duplicate-group {
    border-left: 4px solid #ffc107;
}

.duplicate-group .card-header {
    background-color: #fff3cd;
}

.duplicate-group .table td.diff {
    background-color: #fff9e6;
    font-weight: 600;
}

/* 共通フッタ */
.site-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1rem 0;
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
}

/* ヘルプボタン（左下固定） */
.help-btn {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 1050;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background-color: #fd7e14;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color 0.2s;
}

.help-btn:hover {
    background-color: #e8670c;
}

/* トップへ戻るボタン */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1050;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background-color: #6c757d;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    cursor: pointer;
}

.back-to-top:hover {
    background-color: #495057;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}
