/* 基本的なスタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background-color: #f9fafb;
    color: #1f2937;
    line-height: 1.5;
}

/* レイアウト */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.max-w-6xl {
    max-width: 72rem;
}

/* 背景色 */
.bg-gray-50 { background-color: #f9fafb; }
.bg-white { background-color: white; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-green-50 { background-color: #f0fdf4; }
.bg-yellow-50 { background-color: #fefce8; }
.bg-red-50 { background-color: #fef2f2; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-400 { background-color: #9ca3af; }
.bg-blue-600 { background-color: #2563eb; }
.bg-green-600 { background-color: #16a34a; }
.bg-gray-600 { background-color: #4b5563; }
.bg-purple-600 { background-color: #9333ea; }

/* ホバー時の背景色 */
.hover\:bg-gray-50:hover { background-color: #f9fafb; }
.hover\:bg-blue-700:hover { background-color: #1d4ed8; }
.hover\:bg-green-700:hover { background-color: #15803d; }
.hover\:bg-gray-700:hover { background-color: #374151; }
.hover\:bg-purple-700:hover { background-color: #7c3aed; }

/* テキスト色 */
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-blue-600 { color: #2563eb; }
.text-blue-800 { color: #1e40af; }
.text-green-600 { color: #16a34a; }
.text-red-600 { color: #dc2626; }
.text-yellow-800 { color: #854d0e; }
.text-white { color: white; }

/* ホバー時のテキスト色 */
.hover\:text-gray-700:hover { color: #374151; }
.hover\:text-blue-800:hover { color: #1e40af; }
.hover\:text-red-800:hover { color: #991b1b; }

/* 枠線 */
.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-b { border-bottom-width: 1px; }
.border-b-2 { border-bottom-width: 2px; }
.border-t { border-top-width: 1px; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-blue-200 { border-color: #bfdbfe; }
.border-blue-300 { border-color: #93c5fd; }
.border-blue-400 { border-color: #60a5fa; }
.border-blue-500 { border-color: #3b82f6; }
.border-red-200 { border-color: #fecaca; }
.border-green-200 { border-color: #bbf7d0; }
.border-transparent { border-color: transparent; }
.border-dashed { border-style: dashed; }

/* パディング */
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pt-2 { padding-top: 0.5rem; }

/* マージン */
.m-1 { margin: 0.25rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-2 { margin-right: 0.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.-mb-px { margin-bottom: -1px; }

/* テキストサイズ */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }

/* フォントウェイト */
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* 角丸 */
.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }

/* 影 */
.shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* フレックスボックス */
.flex { display: flex; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-x-8 > * + * { margin-left: 2rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1 1 0%; }

/* テキスト配置 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* 表示 */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* 幅・高さ */
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-full { max-width: 100%; }
.max-h-96 { max-height: 24rem; }
.min-w-full { min-width: 100%; }

/* カーソル */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* オーバーフロー */
.overflow-x-auto { overflow-x: auto; }

/* トランジション */
.transition-colors {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* ボタンスタイル */
button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* タブボタン */
.tab-button {
    padding: 0.5rem 0.25rem;
    border-bottom: 2px solid transparent;
    background: none;
    color: #6b7280;
    font-weight: 500;
    font-size: 0.875rem;
}

.tab-button.active {
    border-bottom-color: #2563eb;
    color: #2563eb;
}

/* 入力フィールド */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* テーブル */
table {
    border-collapse: collapse;
}

th {
    background-color: #f9fafb;
    font-weight: 500;
    text-align: left;
}

/* アニメーション */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* レスポンシブ対応 */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* カスタムスタイル */
.processing-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* スクロールバー */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== PDF/画像プレビューエリアの拡大表示 ===== */

/* アップロードエリア全体の高さを拡大 */
#uploadArea {
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ファイルプレビュー全体のレイアウト */
#filePreview {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 550px;
    background-color: #f9fafb;
    border-radius: 12px;
    padding: 30px;
    margin-top: 20px;
}

/* 画像プレビューエリア */
#imagePreview {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 画像プレビューを大きく表示 */
#previewImage {
    max-width: 90%;
    max-height: 500px;
    height: auto;
    width: auto;
    object-fit: contain;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* PDFプレビューエリアを大きく表示 */
#pdfPreview {
    min-height: 450px;
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 40px;
}

/* PDFアイコンを大きく */
#pdfPreview > div:first-child {
    font-size: 72px;
    margin-bottom: 20px;
}

/* PDFファイル名を大きく */
#pdfFileName {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 10px;
}

/* PDFファイルサイズ表示 */
#pdfFileSize {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 20px;
}

/* 処理準備完了メッセージ */
#pdfPreview .text-green-600 {
    font-size: 18px;
    font-weight: 500;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #uploadArea {
        min-height: 400px;
    }
    
    #filePreview {
        min-height: 350px;
        padding: 20px;
    }
    
    #previewImage {
        max-height: 300px;
    }
    
    #pdfPreview {
        min-height: 300px;
        padding: 30px;
    }
}

/* アップロードプロンプトのスタイル調整 */
#uploadPrompt {
    font-size: 18px;
}

#uploadPrompt > div:first-child {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ===== 既存のPDF拡大表示ボタンを目立たなくする（一時的） ===== */
#pdfExpandBtn {
    opacity: 0.7;
    font-size: 14px;
}

/* ファイルアップロードエリアの調整 */
#uploadArea {
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ファイルプレビューの拡大 */
#filePreview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* PDFプレビューボックスの拡大 */
#pdfPreview > div {
    min-width: 400px;
    padding: 3rem;
}

/* PDFアイコンを大きく */
#pdfPreview .text-4xl {
    font-size: 5rem;
    margin-bottom: 1.5rem;
}

/* PDFファイル名を大きく */
#pdfFileName {
    font-size: 1.5rem;
    font-weight: 600;
}

/* 画像プレビューの最大サイズ調整 */
#previewImage {
    max-height: 500px;
    max-width: 90%;
}

/* 狭い設定パネル用の調整 */
.col-span-1 h2 {
    font-size: 0.875rem;
}

.col-span-1 button {
    font-size: 0.75rem;
    padding: 0.5rem;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .grid-cols-10 {
        grid-template-columns: 1fr;
    }
    
    .col-span-9,
    .col-span-1 {
        grid-column: span 1;
    }
}