/* reading-log.css - 読書ノートアプリ固有のスタイル */

/* 長押し中のスタイル */
.record-row {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.record-row.long-press-active {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe6a3 100%);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.record-row:hover {
    background-color: var(--color-bg-hover, #f7fafc);
}

#mainTitle {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 1rem;
}

.current-filename {
    color: var(--color-text-primary);
    font-size: 1.7em !important;
    font-weight: bold;
}

.current-filename:hover {
    background-color: #f0f4f8;
    border-radius: 4px;
    padding: 2px 8px;
    margin: -2px -8px;
}

/* 冊数表示 */
.book-count-display {
    font-size: 14px;
    color: #64748b;
    margin-left: 8px;
    font-weight: normal;
    vertical-align: middle;
}

.book-count-display.has-hidden {
    color: #f59e0b;
    font-weight: 500;
}

.filename-input {
    color: var(--color-text-primary);
    font-size: 1.7em;
    font-weight: bold;
    border: 2px solid #4299e1;
    border-radius: 4px;
    padding: 2px 8px;
    outline: none;
    background: var(--color-bg-white);
    min-width: 200px;
}

.filename-input:focus {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.title-container {
    display: flex;
    align-items: center;
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.title-container:empty {
    min-height: 2rem;
}

/* Book Styles */
.book {
    background: var(--color-bg-white);
    color: var(--color-text-primary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.book-selected {
    background: #eff6ff !important;
    box-shadow: 0 0 0 3px #3b82f6 !important;
}

/* 検索ハイライトのアニメーション（より長く、より目立つように） */
@keyframes highlight-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.8);
    }
    33% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0.3);
    }
    66% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* 前回の検索ハイライトのフェードアウトアニメーション */
@keyframes highlight-fadeout {
    0% {
        background-color: #3b82f6;
        color: white;
        opacity: 1;
        transform: scale(1);
    }
    50% {
        background-color: rgba(59, 130, 246, 0.5);
        color: rgba(255, 255, 255, 0.7);
        opacity: 0.5;
        transform: scale(1);
    }
    100% {
        background-color: transparent;
        color: inherit;
        opacity: 0;
        transform: scale(1);
    }
}

.search-highlight-fadeout {
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    animation: highlight-fadeout 0.2s ease-out forwards;
}

.book h2 {
    margin-top: 0;
    color: var(--color-text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.book img {
    display: block;
    margin: 10px 0;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 200px;
    width: auto;
    object-fit: contain;
}

/* Book Header Styles */
.book-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.book-header h2 {
    margin: 0;
    flex: 0 1 auto;
    max-width: none;
}

.book-header-buttons {
    display: flex;
    gap: 10px;
}

.book-info-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* 編集モードのボタンのサイズを統一 */
.book-info-buttons .btn {
    flex: 1;
    min-width: 100px;
    padding: 8px 16px;
    font-size: 14px;
}

/* Progress Bar Styles */
.total-progress-bar {
    width: 100%;
    height: 20px;
    background: var(--color-progress-bar-bg, #f0f0f0);
    border-radius: 4px;
    margin: 10px 0;
    position: relative;
    overflow: visible;
    z-index: 10;
}

.total-progress-segment {
    position: absolute !important;
    top: 0 !important;
    height: 100% !important;
    min-width: 3px;
    transition: transform 0.1s ease-out;
}

.total-progress-segment:hover {
    transform: scaleY(1.1);
}

.book .total-progress-bar .total-progress-segment {
    background-color: inherit;
}

/* 進捗バーのツールチップはJavaScriptで表示（position: fixedで確実に最前面に表示するため）
   CSSベースのツールチップ（base.css）を無効化 */
.total-progress-segment[data-tooltip]::before,
.total-progress-segment[data-tooltip]::after,
.total-progress-segment[data-tooltip]:hover::before,
.total-progress-segment[data-tooltip]:hover::after {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    content: none !important;
}

.page-range-bar {
    width: 100%;
    height: 8px;
    background: var(--color-progress-bar-bg, #f0f0f0);
    border-radius: 4px;
    margin-top: 2px;
    position: relative;
    overflow: hidden;
}

.page-range-segment {
    position: absolute;
    height: 100%;
    min-width: 3px;
    background-color: #4299e1;
    border-radius: 2px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    border: 1px solid #e2e8f0;
    padding: 5px;
    text-align: left;
    vertical-align: top;
}

th {
    background-color: var(--color-bg-light);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-align: center;
    vertical-align: middle;
    position: relative;
    z-index: 1;
}

.date-column {
    width: 80px;
    min-width: 80px;
    text-align: center;
    vertical-align: middle;
}

.date-column br {
    display: none;  /* 改行タグを非表示に */
}

.date-mobile {
    display: none;  /* デフォルトは非表示（モバイルサイズで表示） */
    flex-direction: column;
    gap: 0;
    line-height: 1;
}

.date-desktop {
    display: inline;  /* デフォルトは表示（モバイルサイズで非表示） */
}

.date-year {
    display: block;
    line-height: 1;
    margin-bottom: 0;
}

.date-md {
    display: block;
    line-height: 1;
    margin-top: 0;
}

.page-column {
    width: 80px;
}

.page-column > div:first-child {
    margin-bottom: 2px;
}

.page-range-long {
    display: inline;
}

.page-range-short {
    display: none;
}

.notes-column {
    width: auto;
    line-height: 1.14;
}

/* 各メモ行をdivで囲んで行間を制御 */
.notes-column .note-line {
    margin-bottom: 8px;
}

.notes-column .note-line:last-child {
    margin-bottom: 0;
}

.notes-column img {
    max-height: 200px;
    width: auto;
    margin: 8px 0;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.action-column {
    width: 100px;
    text-align: center;
    transition: width 0.3s ease;
}

.action-column.expanded {
    width: 100px;
}

/* Edit Row Styles */
.edit-row input {
    width: 100%;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: inherit;
    font-family: inherit;
}

.edit-row textarea {
    width: 100%;
    min-height: 100px;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-sizing: border-box;
    resize: vertical;
    font-size: inherit;
    font-family: inherit;
    line-height: 1.6;
}

.edit-row {
    background: #f8fafc !important;
}

.edit-row td {
    padding: 2px;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}

.edit-row .button-container {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}

.edit-row .button-container .btn {
    width: auto;
    min-width: 60px;
    padding: 6px 10px;
    margin: 0;
}

.edit-book-info {
    display: none;
    margin: 10px 0;
    padding: 15px;
    background-color: var(--color-bg-light);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.edit-book-info.active {
    display: block;
}

.edit-book-info input,
.edit-book-info textarea {
    width: 100%;
    padding: 8px;
    margin: 5px 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
}

.edit-book-info textarea {
    min-height: 100px;
    resize: vertical;
}

.edit-book-info label {
    display: block;
    margin-top: 10px;
    color: #4a5568;
    font-weight: 600;
}

/* Book Links Styles */
.book-links, .book-author-links, .book-similar-links {
    font-size: 0.9em;
    line-height: 1.6;
}

.book-links a, .book-author-links a, .book-similar-links a,
.book-links .btn-link, .book-author-links .btn-link, .book-similar-links .btn-link {
    color: #4299e1;
    text-decoration: none;
    margin: 2px 1px;
}

.book-links strong, .book-author-links strong, .book-similar-links strong {
    color: var(--color-text-secondary);
    display: inline-block;
    width: 11em;
    vertical-align: top;
}

/* ==============================================
   蔵書目録ウィンドウ用スタイル
   ============================================== */

.catalog-window-body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    background-color: #f0f2f5;
}

.catalog-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.catalog-title {
    text-align: center;
    margin-bottom: 10px;
    color: #2d3748;
    font-size: 2em;
}

.catalog-file-info {
    text-align: center;
    color: #666;
    font-size: 0.95em;
    margin-bottom: 25px;
    padding: 15px;
    background: linear-gradient(135deg, #ebf8ff 0%, #e6fffa 100%);
    border-radius: 6px;
    border-left: 4px solid #4299e1;
}

.catalog-file-name {
    font-weight: bold;
    color: #2d3748;
    font-size: 1.1em;
    margin-top: 5px;
}

.catalog-summary-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    padding: 15px;
    background-color: #f7fafc;
    border-radius: 6px;
    flex-wrap: wrap;
}

.catalog-summary-item {
    text-align: center;
    min-width: 120px;
}

.catalog-summary-label {
    font-size: 0.85em;
    color: #718096;
    margin-bottom: 5px;
}

.catalog-summary-value {
    font-size: 1.4em;
    font-weight: bold;
    color: #2d3748;
}

.catalog-search-bar {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.catalog-search-input {
    padding: 10px 15px;
    width: 100%;
    max-width: 500px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 16px;
}

/* テーブルラッパー（横スクロール対応） */
.catalog-table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
    -webkit-overflow-scrolling: touch;
}

.catalog-book-list {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.catalog-book-list th,
.catalog-book-list td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.catalog-book-list th {
    background-color: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    text-align: center;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.catalog-book-list tr:hover {
    background-color: #f7fafc;
}

/* 書名列 */
.catalog-book-list td.book-title {
    white-space: normal;
    max-width: 350px;
    word-wrap: break-word;
}

/* 著者列 */
.catalog-book-list td.book-author {
    white-space: normal;
    max-width: 200px;
    word-wrap: break-word;
}

/* 日付列 */
.catalog-date-column {
    text-align: center;
    font-size: 0.9em;
    white-space: nowrap;
}

/* メモ行数列 */
.catalog-memo-column {
    text-align: center;
    color: #718096;
    white-space: nowrap;
}

/* プログレスバー */
.catalog-progress-bar {
    width: 100%;
    min-width: 80px;
    height: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 5px;
}

.catalog-progress-fill {
    height: 100%;
    background-color: #4299e1;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.catalog-progress-text {
    font-size: 0.9em;
    color: #4a5568;
    text-align: center;
}

/* アクションボタンコンテナ */
.catalog-action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 30px auto 20px;
    flex-wrap: wrap;
}

/* 印刷ボタン */
.catalog-print-button {
    padding: 12px 24px;
    background-color: #4299e1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.catalog-print-button:hover {
    background-color: #3182ce;
    transform: translateY(-1px);
}

/* 選択書籍エクスポートボタン */
.catalog-export-selected-button {
    padding: 12px 24px;
    background-color: #48bb78;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.catalog-export-selected-button:hover:not(:disabled) {
    background-color: #38a169;
    transform: translateY(-1px);
}

.catalog-export-selected-button:disabled {
    background-color: #cbd5e0;
    cursor: not-allowed;
    transform: none;
}

/* 分割ボタン */
.catalog-split-button {
    padding: 12px 24px;
    background-color: #ed8936;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.catalog-split-button:hover {
    background-color: #dd6b20;
    transform: translateY(-1px);
}

/* クリップボードボタン（コピー/カット/ペースト） */
.catalog-clipboard-button {
    padding: 10px 16px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.catalog-clipboard-button:hover:not(:disabled) {
    background-color: #5a67d8;
    transform: translateY(-1px);
}

.catalog-clipboard-button:disabled {
    background-color: #cbd5e0;
    cursor: not-allowed;
    transform: none;
}

.catalog-clipboard-button.catalog-cut-button {
    background-color: #ed8936;
}

.catalog-clipboard-button.catalog-cut-button:hover:not(:disabled) {
    background-color: #dd6b20;
}

.catalog-clipboard-button.catalog-paste-button {
    background-color: #48bb78;
}

.catalog-clipboard-button.catalog-paste-button:hover:not(:disabled) {
    background-color: #38a169;
}

/* 最終更新時刻 */
.catalog-last-updated {
    text-align: center;
    color: #718096;
    font-size: 0.85em;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* ==============================================
   蔵書目録の印刷スタイル
   ============================================== */

@media print {
    .catalog-print-button,
    .catalog-split-button,
    .catalog-export-selected-button,
    .catalog-clipboard-button,
    .catalog-search-bar {
        display: none;
    }
    
    .catalog-window-body {
        background-color: white;
        padding: 10px;
        margin: 0;
    }
    
    .catalog-container {
        box-shadow: none;
        padding: 10px;
    }
    
    .catalog-title {
        font-size: 1.5em;
    }
    
    .catalog-book-list {
        min-width: 100%;
        font-size: 0.85em;
    }
    
    .catalog-book-list th,
    .catalog-book-list td {
        padding: 6px 4px;
    }
    
    .catalog-summary-info {
        page-break-inside: avoid;
    }
}

/* ==============================================
   蔵書目録のレスポンシブ対応
   ============================================== */

/* タブレット（1200px以下） */
@media screen and (max-width: 1200px) {
    .catalog-container {
        padding: 25px;
    }
    
    .catalog-title {
        font-size: 1.8em;
    }
    
    .catalog-book-list {
        min-width: 850px;
    }
}

/* タブレット（768px以下） */
@media screen and (max-width: 768px) {
    .catalog-window-body {
        padding: 10px;
        margin: 0;
    }
    
    .catalog-container {
        padding: 15px;
    }
    
    .catalog-title {
        font-size: 1.5em;
    }
    
    .catalog-summary-info {
        gap: 15px;
    }
    
    .catalog-summary-item {
        min-width: 100px;
    }
    
    .catalog-summary-value {
        font-size: 1.2em;
    }
    
    .catalog-search-input {
        max-width: 100%;
    }
    
    .catalog-book-list {
        min-width: 750px;
        font-size: 0.9em;
    }
    
    .catalog-book-list th,
    .catalog-book-list td {
        padding: 8px 6px;
    }
}

/* スマホ（480px以下） */
@media screen and (max-width: 480px) {
    .catalog-window-body {
        padding: 5px;
    }
    
    .catalog-container {
        padding: 10px;
        border-radius: 4px;
    }
    
    .catalog-title {
        font-size: 1.3em;
    }
    
    .catalog-file-info {
        padding: 10px;
        font-size: 0.85em;
    }
    
    .catalog-file-name {
        font-size: 1em;
    }
    
    .catalog-summary-info {
        gap: 10px;
        padding: 10px;
    }
    
    .catalog-summary-item {
        min-width: 80px;
    }
    
    .catalog-summary-label {
        font-size: 0.75em;
    }
    
    .catalog-summary-value {
        font-size: 1.1em;
    }
    
    .catalog-search-input {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .catalog-book-list {
        min-width: 650px;
        font-size: 0.85em;
    }
    
    .catalog-book-list th,
    .catalog-book-list td {
        padding: 6px 4px;
    }
    
    .catalog-print-button {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* 蔵書目録のコントロール部分（検索とソート） */
.catalog-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.catalog-search-bar {
    display: flex;
    justify-content: center;
}

.catalog-search-input {
    padding: 10px 15px;
    width: 100%;
    max-width: 500px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 16px;
}

.catalog-sort-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.catalog-sort-label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.catalog-sort-select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
    min-width: 220px;
    color: #2d3748;
    transition: all 0.2s ease;
}

.catalog-sort-select:hover {
    border-color: #4299e1;
}

.catalog-sort-select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .catalog-sort-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .catalog-sort-select {
        width: 100%;
        min-width: auto;
    }
}

@media screen and (max-width: 480px) {
    .catalog-controls {
        gap: 10px;
    }
    
    .catalog-sort-label {
        font-size: 13px;
    }
    
    .catalog-sort-select {
        font-size: 13px;
        padding: 6px 10px;
    }
}

/* ソートボタンのスタイル */
.sort-btn {
    padding: 8px 16px;
    border: 1px solid #cbd5e0;
    background: white;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #4a5568;
}

.sort-btn:hover {
    background: #edf2f7;
    border-color: #a0aec0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sort-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.sort-btn.active-asc::after {
    content: ' ▲';
    font-size: 10px;
}

.sort-btn.active-desc::after {
    content: ' ▼';
    font-size: 10px;
}

/* 列リサイズハンドルのスタイル */
.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
}

.resize-handle:hover {
    background: rgba(102, 126, 234, 0.3);
}

.resize-handle:active {
    background: rgba(102, 126, 234, 0.5);
}

/* テーブルヘッダーのスタイル調整 */
.catalog-book-list th {
    position: relative;
    min-width: 50px;
}

.catalog-book-list {
    table-layout: fixed;
    width: 100%;
}