@charset "UTF-8";

/* =================================================================
 * Page Specific Styles for UI Template & PDF Editor (style.css)
 * ================================================================= */

.mac-app-container {
    border-radius: 8px;
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    height: 75vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    background-color: var(--bs-body-bg);
}

.mac-toolbar {
    background-color: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mac-toolbar .btn { padding: 0.25rem 0.5rem; }
.toolbar-title { font-size: 0.9rem; }
.zoom-control-wrap { width: 120px; }

.mac-workspace {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

/* --- キャンバス（基本はグリッド） --- */
#pdf-canvas {
    flex-grow: 1;
    background-color: #ebeced;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 1rem;
    --pdf-card-width: 140px; 
}
[data-bs-theme="dark"] #pdf-canvas { background-color: #1e1e1e; }

/* --- インスペクタ（右側情報パネル） --- */
.mac-inspector {
    width: 280px;
    min-width: 280px;
    background-color: var(--bs-tertiary-bg);
    border-left: 1px solid var(--bs-border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.inspector-info-list { font-size: 0.85rem; }
.inspector-info-list dt { font-weight: normal; color: var(--bs-secondary-color); }
.inspector-info-list dd { text-align: right; margin-bottom: 0.5rem; font-weight: 500; }

/* =================================================================
 * ページカード（サムネイル）
 * ================================================================= */
.pdf-page-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto; 
    margin: 1rem; 
}

.pdf-page-card-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--pdf-card-width);
    height: var(--pdf-card-width);
}

.pdf-page-image-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    transform: rotate(var(--pdf-card-rotation, 0deg));
}
.pdf-page-image-wrap:active { cursor: grabbing; }

.page-thumbnail {
    max-width: var(--pdf-card-width) !important;
    max-height: var(--pdf-card-width) !important;
    width: auto;
    height: auto;
    display: block;
    background: white;
    border: 2px solid transparent;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.annotation-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    max-width: var(--pdf-card-width) !important;
    max-height: var(--pdf-card-width) !important;
    pointer-events: none;
    z-index: 5;
}

/* -------------------------------------
 * 選択状態の明瞭化 (太枠 + グロウ効果)
 * ------------------------------------- */
.pdf-page-card.selected .page-thumbnail {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px var(--bs-primary), 0 4px 15px rgba(13, 110, 253, 0.3);
}

[data-bs-theme="dark"] .pdf-page-card.selected .page-thumbnail {
    border-color: #6ea8fe; 
    box-shadow: 0 0 0 3px #6ea8fe, 0 4px 15px rgba(110, 168, 254, 0.4);
}

/* -------------------------------------
 * 選択用チェックボックスの洗練
 * ------------------------------------- */
.selection-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    border: 2px solid #adb5bd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .selection-checkbox {
    border-color: #6c757d;
    background-color: #2b2b2b;
}

.selection-checkbox:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* -------------------------------------
 * オーバーレイとアクションボタン
 * ------------------------------------- */
.pdf-page-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    
    opacity: 0;
    visibility: hidden; 
    transition: opacity 0.2s, visibility 0.2s;
    
    border-radius: 8px;
    padding: 0.75rem;
    z-index: 10;
    width: max-content;
}
.pdf-page-card-inner:hover .pdf-page-overlay { 
    opacity: 1; 
    visibility: visible; 
}

.pdf-page-action-btn {
    pointer-events: auto;
    background: white;
    color: #333; 
    border: none;
    border-radius: 50%;
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.15s;
}
.pdf-page-action-btn:hover { background: var(--bs-primary); color: white; }

.pdf-page-action-btn.action-delete { color: var(--bs-danger); }
.pdf-page-action-btn.action-delete:hover { background: var(--bs-danger); color: white !important; }
.pdf-page-action-btn.action-delete:hover i { color: white !important; }

.pdf-page-action-btn.action-annotate { color: var(--bs-primary); }
.pdf-page-action-btn.action-annotate:hover { background: var(--bs-primary); color: white !important; }
.pdf-page-action-btn.action-annotate:hover i { color: white !important; }

.page-number-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--bs-border-color);
}

/* =================================================================
 * ★ リスト表示モード（横長レイアウトへの最適化）
 * ================================================================= */
#pdf-canvas.list-view {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center; 
}

#pdf-canvas.list-view .pdf-page-card {
    width: 100% !important;
    max-width: 800px; /* カード全体の最大幅 */
    flex-direction: row; /* 横並びにする */
    align-items: center;
    justify-content: flex-start;
    padding: 1rem 1.5rem;
    margin: 0.5rem 0;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    gap: 2rem; /* 画像と情報エリアの間の隙間 */
}

#pdf-canvas.list-view .pdf-page-card-inner {
    width: var(--pdf-card-width);
    height: var(--pdf-card-width); 
    flex-shrink: 0;
}

/* リスト表示時のラベルとチェックボックスのコンテナ */
#pdf-canvas.list-view .pdf-page-card-info {
    margin-top: 0 !important;
    flex-grow: 1; /* 右側の空きスペースを埋める */
    justify-content: flex-start !important;
    border-left: 1px solid var(--bs-border-color); /* 縦線で区切る */
    padding-left: 2rem;
}

/* リスト表示時のチェックボックスを少し大きく */
#pdf-canvas.list-view .selection-checkbox {
    width: 1.5rem;
    height: 1.5rem;
}

/* リスト表示時のページ番号の見栄え */
#pdf-canvas.list-view .page-number-label {
    font-size: 1.5rem;
    background: transparent;
    border: none;
    color: var(--bs-body-color);
}
#pdf-canvas.list-view .page-number-label::before {
    content: 'ページ ';
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
    margin-right: 0.5rem;
}

/* --- 汎用ユーティリティ --- */
#empty-state {
    cursor: pointer;
}
.empty-state-box { 
    border-color: var(--bs-border-color) !important; 
    transition: all 0.2s;
}
#empty-state:hover .empty-state-box {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-primary) !important;
}
#empty-state:hover .empty-state-box i,
#empty-state:hover .empty-state-box h5 {
    color: var(--bs-primary) !important;
    opacity: 1 !important;
}

.toast-overlay { z-index: 1100; }
.loading-spinner-large { width: 3rem; height: 3rem; }
.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(var(--bs-body-bg-rgb), 0.7);
    display: none; align-items: center; justify-content: center;
    z-index: 1090; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}

/* --- 操作パネル (ツールパレット風) --- */
.tool-palette-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.tool-palette-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.25rem;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    color: var(--bs-secondary-color);
    transition: all 0.15s;
}
.tool-palette-btn:hover {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}
.tool-palette-btn i { font-size: 1.25rem; margin-bottom: 0.35rem; }
.tool-palette-btn span { font-size: 0.7rem; font-weight: 600; }