/* コンテナのスタイル */
.pdf-viewer-container {
    
    position: relative;
    background: #f5f5f5;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    transition: height 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ツールバーのスタイル */
.pdf-viewer-toolbar {
    padding: 10px;
    background: #ddd;
    border-bottom: 1px solid #ccc;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    border-radius: 4px;
}

/* ボタンの共通スタイル */
.pdf-viewer-toolbar button,
.pdf-viewer-toolbar a.pdf-download {
    padding: 8px 15px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

/* ボタンホバー時のスタイル */
.pdf-viewer-toolbar button:hover,
.pdf-viewer-toolbar a.pdf-download:hover {
    background: #f0f0f0;
    border-color: #999;
}

/* ボタンアクティブ時のスタイル */
.pdf-viewer-toolbar button:active,
.pdf-viewer-toolbar a.pdf-download:active {
    background: #e5e5e5;
    border-color: #666;
}

/* ページ情報のスタイル */
.pdf-page-info {
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    min-width: 60px;
    text-align: center;
}

/* キャンバスのスタイル */
.pdf-canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

/* ローディング表示 */
.pdf-viewer-container.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pdf-viewer-container.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1001;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* エラーメッセージ */
.pdf-viewer-error {
    padding: 20px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    border-radius: 4px;
    margin: 10px 0;
    text-align: center;
}

/* フルスクリーン時のスタイル */
.pdf-viewer-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh !important;
    margin: 0;
    padding: 20px;
    z-index: 9999;
    background: #fff;
    overflow-y: auto;
}

.pdf-viewer-container.fullscreen .pdf-canvas {
    max-height: calc(100vh - 100px);
    width: auto;
    margin: 0 auto;
}

/* アクセシビリティ対応 */
.pdf-viewer-toolbar button:focus,
.pdf-viewer-toolbar a.pdf-download:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* キーボードナビゲーション用のフォーカスインジケータ */
.pdf-viewer-toolbar button:focus-visible,
.pdf-viewer-toolbar a.pdf-download:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
}

/* 印刷時のスタイル */
@media print {
    .pdf-viewer-toolbar {
        display: none;
    }

    .pdf-viewer-container {
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .pdf-canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .pdf-viewer-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pdf-viewer-toolbar button,
    .pdf-viewer-toolbar a.pdf-download {
        width: 100%;
        margin: 5px 0;
    }

    .pdf-page-info {
        text-align: center;
        width: 100%;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .pdf-viewer-container {
        background: #f1f1f1;
        border-color: #D5D5D5;
    }

    .pdf-viewer-toolbar {
        background: #d1d9d5;
        border-color: #b5bbb8;
    }

    .pdf-viewer-toolbar button,
    .pdf-viewer-toolbar a.pdf-download {
        background: #444;
        border-color: #555;
        color: #fff;
    }

    .pdf-viewer-toolbar button:hover,
    .pdf-viewer-toolbar a.pdf-download:hover {
        background: #555;
        border-color: #666;
    }

    .pdf-page-info {
        background: #444;
        border-color: #555;
        color: #fff;
    }

    .pdf-canvas {
        background: #333;
    }

    .pdf-viewer-error {
        background: #442c2c;
        border-color: #662c2c;
        color: #ffb2b2;
    }
}

/* ドラッグ&ドロップ時のスタイル */
.pdf-viewer-container.is-dragover {
    background-color: rgba(52, 152, 219, 0.1);
    border-color: #3498db;
}

/* ツールチップ */
.pdf-viewer-toolbar button[title],
.pdf-viewer-toolbar a[title] {
    position: relative;
}

.pdf-viewer-toolbar button[title]:hover::after,
.pdf-viewer-toolbar a[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}