/* /box/css/style.css - 全体スタイル（フル） */

/* 基本リセット */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f6f8fb;
    color: #222;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* コンテナ */
.container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 16px;
}

/* ヘッダー / ナビ */
header, nav { margin-bottom: 12px; }
header h1 { font-size: 1.4rem; margin-bottom: 6px; color: #111; }
nav a { color: #1e6fdb; text-decoration: none; margin-right: 12px; }
nav a:hover { text-decoration: underline; }

/* パネル共通 */
.panel, .card, .container > .panel {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(20, 30, 60, 0.06);
}

/* フォーム */
form.search-sort { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:12px; }
form.search-sort input[type="text"], input[type="password"], input[type="file"], select, textarea {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #e6e8ee;
    background: #fff;
    font-size: 0.98rem;
}
button, .btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 0;
    cursor: pointer;
    background: #1e6fdb;
    color: #fff !important;         /* visitedでも変わらない */
    font-weight: 600;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
button.secondary, .btn.secondary {
    background: #6c757d;
    color: #fff !important;
}
.hint { font-size: .9rem; color: #666; }

/* PDFカードグリッド（iPhone14 でも 2列維持） */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2列固定 */
    gap: 14px;
    margin-top: 12px;
}
.pdf-item {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(20,30,60,0.05);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
    overflow: hidden;
}
.pdf-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px rgba(20,30,60,0.09);
    background: #fbfdff;
}
.pdf-item h3 {
    font-size: 1.03rem;
    margin-bottom: 6px;
    display:flex;
    align-items:center;
    gap:8px;
}
.pdf-item h3::before {
    content: "📄";
    margin-right: 6px;
}
.pdf-item .meta {
    font-size: 0.82rem;
    color: #666;
    margin-bottom: 6px;
}

/* カード式のボタン欠け防止（余白を少し詰める） */
.card-grid .pdf-item { padding: 10px; }
.card-grid .pdf-item .actions {
    margin-top: auto;
    display:flex;
    justify-content:flex-end;
    gap: 6px;
    flex-wrap: nowrap;      /* 改行させない */
    white-space: nowrap;    /* 改行させない */
}
.card-grid .pdf-item .btn.secondary,
.card-grid .pdf-item .delete-btn {
    padding: 7px 9px;
    font-size: 0.9rem;
    min-width: 70px;
    text-align: center;
}

/* リスト表示（.list-view） */
.list-view { display:block; margin-top:12px; }
.list-view .pdf-item {
    display: flex;
    justify-content: space-between;
    align-items: center;    /* ボタンと高さを揃える */
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #eef2f6;
    background: #fff;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.list-content {
    flex: 1 1 auto;
    min-width: 0;           /* ← 重要：本文がボタンを押し出さない */
}
.list-content h3 { margin: 0 0 4px; }
.list-meta { font-size: 0.85rem; color: #666; }

/* 小さめのメタ */
.small-meta { font-size:0.78rem; color:#777; }

/* 操作ボタン（右寄せ＆改行禁止） */
.actions {
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap: 8px;
    flex: 0 0 auto;
    flex-wrap: nowrap;      /* 改行させない */
    white-space: nowrap;    /* 改行させない */
}
.actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 編集・削除ボタンの統一スタイル（サイズ・太さを一致） */
.btn.secondary,
.delete-btn {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    min-width: 84px;        /* 幅を揃える */
    text-align: center;
    padding: 10px 12px;
}

/* 削除ボタン色 */
.delete-btn {
    border-radius:8px;
    color:#fff !important;
    background:#dc3545;
    text-decoration:none !important;
}
.delete-btn:hover { background:#c82333; }

/* タグ表示 */
.tag { display:inline-block; background:#f0f4ff; color:#084; padding:4px 8px; border-radius:999px; font-size:.78rem; margin-right:6px; margin-bottom:6px; }

/* ページネーション */
.pagination { margin-top:16px; text-align:center; }
.pagination a, .pagination span {
    display:inline-block; margin:0 6px; padding:8px 12px; border-radius:8px; text-decoration:none; border:1px solid #e6e8ee; background:#fff; color:#1e6fdb;
}
.pagination .current { background:#1e6fdb; color:#fff; border-color:#1e6fdb; }

/* 管理メニュー常時表示 */
.admin-menu {
    display:flex; gap:12px; align-items:center; margin:12px 0;
}
.admin-menu a { padding:8px 12px; border-radius:8px; background:#fff; border:1px solid #eef2f6; color:#1e6fdb; text-decoration:none; }

/* メッセージ */
.message { padding:10px; border-radius:8px; background:#f6f8ff; border:1px solid #dbe7ff; color:#234; margin-bottom:12px; }
.error { background:#fff0f0; border:1px solid #ffdddd; color:#b32222; padding:10px; border-radius:8px; }

/* リンクvisited対策（ボタンの見た目が変わらないように） */
a:visited {
    color: inherit;
    text-decoration: none;
}

/* スマホ最適化 */
@media (max-width: 768px) {
    .container { padding: 12px; }

    /* iPhone14(390px)でも2列維持 */
    .card-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }

    /* リストは横並び維持。本文が長くてもボタンを押し出さない */
    .list-view .pdf-item { align-items: center; gap: 8px; }
    .list-content { min-width: 0; flex: 1 1 auto; }
    .actions { flex-wrap: nowrap; white-space: nowrap; gap: 8px; }

    .btn, .delete-btn { padding: 10px 12px; font-size: 0.95rem; }
}

/* 更に小さいスマホ（超小型のみ1列） */
@media (max-width: 360px) {
    .card-grid { grid-template-columns: 1fr !important; }
    .btn.secondary, .delete-btn { min-width: 80px; padding: 10px 10px; }
}

.search-help {
    margin: 1em 0;
    padding: 0.5em 1em;
    background: #f9f9f9;
    border: 1px solid #ddd;
    font-size: 0.9em;
    border-radius: 6px;
    color: #444;
}
.search-help code {
    background: #eee;
    padding: 0 4px;
    border-radius: 3px;
}
