/* -------------------------------------------------------------
 * PDF結合ツール専用スタイル (style.css)
 * 共通スタイル (common.css) の後に読み込まれます。
 * ------------------------------------------------------------- */

/* レイアウト調整（ツール専用） */
.layout-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
}

@media (max-width: 768px) {
  .layout-container {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* -------------------------------------------------------------
 * 操作エリア: ドラッグ＆ドロップゾーン
 * ------------------------------------------------------------- */
.tool-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drop-zone {
  background-color: var(--surface-color);
  border: 2.5px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

.upload-icon {
  color: var(--primary-color);
  transition: var(--transition-smooth);
}

.drop-zone:hover .upload-icon {
  transform: translateY(-6px) scale(1.05);
}

.drop-zone .main-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color);
}

.drop-zone .sub-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* -------------------------------------------------------------
 * ファイル一覧 (PDFカード)
 * ------------------------------------------------------------- */
#file-list-wrapper {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
}

.list-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.pdf-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

/* 各PDFカード */
.pdf-card {
  display: flex;
  align-items: center;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  gap: 18px;
  position: relative;
  transition: var(--transition-smooth);
}

.pdf-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

/* ドラッグ時のスタイル */
.pdf-card.sortable-ghost {
  opacity: 0.3;
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

.pdf-card.sortable-chosen {
  box-shadow: var(--shadow-md);
  transform: scale(1.01);
}

/* サムネイル */
.pdf-thumbnail {
  width: 58px;
  height: 78px;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.pdf-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pdf-thumbnail-placeholder {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ファイル詳細情報 */
.pdf-details {
  flex-grow: 1;
  min-width: 0; /* text-overflow用 */
}

.pdf-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.pdf-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
}

/* 操作アクション */
.pdf-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* つまみ（ドラッグハンドル） */
.drag-handle {
  cursor: grab;
  padding: 10px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.drag-handle:hover {
  color: var(--text-color);
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle svg {
  pointer-events: none;
}

/* -------------------------------------------------------------
 * 集計情報 & アクションエリア
 * ------------------------------------------------------------- */
.summary-card {
  display: flex;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 28px;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 16px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.summary-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.summary-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-color);
}

.action-area {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

/* プログレスバー */
.progress-container {
  width: 100%;
  text-align: center;
  margin-top: 10px;
}

.progress-bar-wrapper {
  width: 100%;
  height: 10px;
  background-color: var(--border-color);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  /* JS は scaleX で伸縮させる（width だとレイアウト再計算が起きる） */
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  height: 100%;
  background-color: var(--accent);
  border-radius: 5px;
  transition: transform 0.1s ease;
}

.progress-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* -------------------------------------------------------------
 * メッセージ表示 (トースト/ステータス)
 * ------------------------------------------------------------- */
.status-message {
  padding: 16px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-message.success {
  background-color: var(--success-light);
  color: var(--success-color);
  border: 1px solid rgba(52, 199, 89, 0.15);
}

.status-message.error {
  background-color: var(--danger-light);
  color: var(--danger-color);
  border: 1px solid rgba(255, 59, 48, 0.15);
}



/* -------------------------------------------------------------
 * サイドバー & 解説テキスト (SEO)
 * ------------------------------------------------------------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.info-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.info-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.info-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-card li {
  font-size: 0.9rem;
  color: var(--text-color);
}

.info-card li strong {
  display: block;
  font-size: 0.95rem;
  color: var(--primary-color);
  margin-bottom: 4px;
}

/* 解説コンテンツ（SEO用） */
.explain-content {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-top: 40px;
  box-shadow: var(--shadow-sm);
}

.explain-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 18px;
}

.explain-content h3 {
  font-size: 1.2rem;
  margin: 28px 0 14px 0;
  font-weight: 700;
}

.explain-content p {
  color: var(--text-secondary);
  font-size: 0.98rem;
  margin-bottom: 18px;
  text-align: justify;
}

.explain-content ol {
  padding-left: 22px;
  color: var(--text-secondary);
  font-size: 0.98rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 免責事項セクション */
.disclaimer-section {
  margin-top: 40px;
  padding: 24px 28px;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.disclaimer-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-color);
}

.disclaimer-section p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: justify;
}

/* -------------------------------------------------------------
 * 印刷時スタイル
 * ------------------------------------------------------------- */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .ad-container, .drop-zone, .action-area, .sidebar, .btn {
    display: none !important;
  }
}
