/* ヘッダー認証情報 */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2em;
    padding: 0 2.5em;
}
.header-main h1 {
    margin: 0;
}
.header-main .catchcopy {
    margin: 0.5em 0 0 0;
}
.header-main h1,
.header-main .catchcopy {
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.header-auth {
    display: flex;
    align-items: center;
    gap: 1em;
    font-size: 0.9em;
}
.header-auth form#logout-form,
.header-auth .logout-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.header-auth form#logout-form button.auth-btn {
    margin: 0;
}
.user-info {
    color: #fff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.header-auth .auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.45em 0.9em;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    color: #fff;
    background: transparent;
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.header-auth .auth-btn:hover {
    background: #ffffff;
    color: #2d78b7;
    border-color: #ffffff;
    transform: translateY(-1px);
    text-shadow: none;
}
.header-auth .auth-btn:active {
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .header-auth .auth-btn,
    .header-auth .auth-btn:hover {
        transition: none;
        transform: none;
    }
}
.header-auth .auth-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}
/* 管理ページ等で古いヘッダーマークアップが使われている場合の互換性処理
   インラインで `color: white` が指定されているケースを上書きして
   白背景でも見えるようにする（影響範囲を header 内の .user-info に限定） */
header .user-info .auth-link {
    color: #2d78b7 !important; /* メインカラーに合わせて青に */
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    text-decoration: none !important;
    font-weight: 600;
}
.header-auth .auth-btn--danger {
    border-color: rgba(255, 255, 255, 0.95) !important;
    background: transparent !important;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25) !important;
}
.header-auth .auth-btn--danger:hover {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #dc3545 !important;
    text-shadow: none !important;
    transform: translateY(-1px) !important;
}
/* 管理ページ固有のログアウトボタンスタイル */
.header-auth form button.auth-btn--danger {
    background: transparent !important;
    color: #fff !important;
    border: 2px solid rgba(255, 255, 255, 0.95) !important;
    border-radius: 999px !important;
    padding: 0.45em 0.9em !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25) !important;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.1s !important;
}
.header-auth form button.auth-btn--danger:hover {
    background: #ffffff !important;
    color: #dc3545 !important;
    border-color: #ffffff !important;
    text-shadow: none !important;
    transform: translateY(-1px) !important;
}
.header-auth .auth-btn:disabled,
.header-auth .auth-btn[aria-disabled="true"] {
    opacity: 0.65;
    cursor: not-allowed;
}
/* 既存の.auth-linkは他所で使用されている可能性があるため維持 */
.auth-link {
    color: #007bff;
    text-decoration: none;
    padding: 0.5em 1em;
    border-radius: 4px;
    border: 1px solid #007bff;
    transition: all 0.2s;
}
.auth-link:hover {
    background: #007bff;
    color: white;
}
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 1em;
        padding: 0 1.5em;
    }
    .header-auth {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* カード型レイアウト */
.cards {
    display: grid;
    /* より小さなカード幅で4列程度まで並ぶように調整 */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5em 1.8em;
    margin: 2em 0;
    justify-items: start;
}
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px #0001;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    border: 1px solid #e3eaf2;
    max-width: 100%;
}

/* 通常のカードスタイルを確実に適用（series-cardクラスが付いていない場合） */
.card:not(.series-card) {
    background: #fff !important;
    border: 1px solid #e3eaf2 !important;
    box-shadow: 0 2px 12px #0001 !important;
}

.card:hover {
    box-shadow: 0 4px 24px #2d78b733;
    transform: translateY(-4px) scale(1.03);
}

.card:not(.series-card):hover {
    box-shadow: 0 4px 24px #2d78b733 !important;
    transform: translateY(-4px) scale(1.03) !important;
}
.card-thumb-link {
    display: block;
    width: 100%;
    height: 120px;
    background: #e7f0ff;
    text-align: center;
    overflow: hidden;
}
.card-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #e7f0ff;
}
.card-body {
    padding: 1em 1em 0.7em 1em;
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}
.card-title {
    font-size: 1.08em;
    font-weight: bold;
    margin-bottom: 0.2em;
    color: #234;
    min-height: 2.2em;
    line-height: 1.2;
}
.card-title a {
    color: #234;
    text-decoration: none;
}
.card-title a:hover {
    text-decoration: underline;
}
.card-meta {
    font-size: 0.97em;
    color: #2d78b7;
    display: flex;
    gap: 1em;
    align-items: center;
}
.card-format {
    background: #e7f0ff;
    color: #2d78b7;
    border-radius: 4px;
    padding: 0.1em 0.6em;
    font-size: 0.95em;
}
.card-price {
    background: #f4f7fb;
    color: #234;
    border-radius: 4px;
    padding: 0.1em 0.6em;
    font-size: 0.95em;
}
.card-tags, .card-subjects {
    font-size: 0.93em;
    color: #789;
    margin-top: 0.1em;
    word-break: break-all;
}
@media (max-width: 900px) {
    .cards {
        gap: 1.2em 1em;
    }
    .card {
        width: 46vw;
        min-width: 180px;
        max-width: 98vw;
    }
}
@media (max-width: 600px) {
    .cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1em;
        padding: 0 0.5em;
    }
    .card {
        width: 100%;
        max-width: none;
    }
    .card-thumb, .card-thumb-link {
        height: 90px;
    }
}
/* 横並びチェックボックス用 */
/* 教科選択欄だけ縦並び、他は横並び */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2em 2em;
    align-items: center;
    margin: 0.3em 0 0.7em 0;
}
.checkbox-group label {
    margin: 0;
    font-weight: normal;
}
.checkbox-group#subject-collapsible {
    display: block;
}
.checkbox-group#subject-collapsible label {
    display: block;
    margin: 0.1em 0 0.1em 0;
}
.checkbox-group#subject-collapsible .child-subject {
    margin-left: 1.5em;
    color: #789;
}
html {
    box-sizing: border-box;
    font-size: 16px;
}
*, *:before, *:after {
    box-sizing: inherit;
}
body {
    font-family: 'Yu Gothic', YuGothic, 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    margin: 0;
    background: #f4f7fb;
    color: #222;
    min-height: 100vh;
}
header {
    background: #3e9dd7;
    color: #fff;
    padding: 1.2em 0 1em 0;
    text-align: center;
    box-shadow: 0 2px 8px #0001;
}
h1 {
    color: #fff;
    font-size: 2.1em;
    margin: 0 0 0.2em 0;
    letter-spacing: 0.04em;
}
.catchcopy {
    color: #e3f2fd;
    font-size: 1.1em;
    margin: 0.2em 0 0 0;
}
main {
    max-width: 1300px;
    margin: 2.5em auto 2em auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px #0002;
    padding: 2.2em 2.5em 2em 2.5em;
}

/* --- two-pane 汎用レイアウト（シリーズv3で使用） --- */
.two-pane {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
}
.two-pane .pane-left { min-width: 0; }
.two-pane .pane-right { min-width: 0; }

/* ページャ共通（簡易） */
.pagination {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.pagination a {
    display: inline-block;
    padding: .25rem .6rem;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    text-decoration: none;
    color: #234;
    background: #fff;
}
.pagination a.active {
    border-color: #2d78b7;
    background: #e7f0ff;
    color: #2d78b7;
}

/* モバイルで縦積み（左→上、右→下） */
@media (max-width: 900px) {
    .two-pane { grid-template-columns: 1fr; }
    .two-pane .pane-left { order: 1; }
    .two-pane .pane-right { order: 2; }
    .two-pane .list a { padding: .7rem .9rem; }
}

.main-container {
    max-width: 1200px;
    margin: 2em auto;
    padding: 0 1em;
    background: none;
    border-radius: 0;
    box-shadow: none;
}
h2 {
    color: #2d78b7;
    font-size: 1.4em;
    margin-top: 0;
    border-left: 5px solid #4fc3f7;
    padding-left: 0.5em;
    background: #f4f7fb;
}
form {
    margin-bottom: 1.5em;
}
input[type="text"], input[type="url"], input[type="number"], select, textarea {
    width: 100%;
    padding: 0.5em 0.7em;
    border: 1px solid #b0bec5;
    border-radius: 5px;
    margin-top: 0.2em;
    font-size: 1em;
    background: #f7fbff;
    color: #222;
    transition: border 0.2s, background 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: #2d78b7;
    outline: none;
    background: #fff;
}
label {
    font-weight: bold;
    margin-top: 1em;
    display: block;
}
button, .btn, .admin-btn {
    display: inline-block;
    background: #3e9dd7;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.5em 1.5em;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1em;
    box-shadow: 0 1px 4px #0001;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}
button:hover, .btn:hover, .admin-btn:hover {
    background: #1565c0;
    color: #fff;
}

/* 管理ツールバーのボタンは見やすいピル型に（ヘッダーのauthボタン風） */
.admin-toolbar .admin-btn {
    background: #fff; /* 白背景に合わせて見やすく */
    color: #2d78b7;
    border: 2px solid #2d78b7;
    border-radius: 999px;
    padding: 0.45em 1em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    font-weight: 600;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
}
.admin-toolbar .admin-btn:hover {
    background: #2d78b7;
    color: #fff;
    border-color: #2d78b7;
    transform: translateY(-1px);
}
.admin-toolbar .admin-btn--active {
    background: #2d78b7;
    color: #fff;
    border-color: #2d78b7;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.admin-toolbar .admin-btn--active:hover {
    background: #2564a6;
    border-color: #2564a6;
}
.admin-toolbar .admin-btn:active {
    transform: translateY(0);
}
.admin-toolbar .admin-btn:focus-visible {
    outline: 3px solid #90caf9;
    outline-offset: 2px;
}
.admin-toolbar .admin-btn--muted {
    color: #6c757d;
    border-color: #6c757d;
}
.admin-toolbar .admin-btn--muted:hover {
    background: #6c757d; color:#fff; border-color:#6c757d;
}
.admin-toolbar .admin-btn--danger {
    color: #c62828; border-color: #c62828;
}
.admin-toolbar .admin-btn--danger:hover { background:#c62828; color:#fff; border-color:#c62828; }
.admin-toolbar .group-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.82);
    margin-right: 0.4em;
}
.admin-toolbar--global {
    margin-top: 1.2em;
}
@media (prefers-reduced-motion: reduce) {
    .admin-toolbar .admin-btn,
    .admin-toolbar .admin-btn:hover { transition: none; transform: none; }
}
table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    font-size: 0.97em;
    margin-bottom: 1.5em;
    box-shadow: 0 1px 8px #0001;
}
th, td {
    border: 1px solid #b0bec5;
    padding: 0.45em 0.7em;
    text-align: left;
    vertical-align: top;
}
th {
    background: #2d78b7;
    color: #fff;
    font-size: 1em;
    font-weight: bold;
    letter-spacing: 0.03em;
}
tr:nth-child(even) {
    background: #f4f7fb;
}
.checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7em 1.2em;
    margin-top: 0.3em;
}
.checkbox-list label {
    font-weight: normal;
    margin: 0;
}

.error {
    color: #ff9800;
    background: #fff3e0;
    border-radius: 5px;
    padding: 0.7em 1em;
    margin: 1em 0;
}
.msg {
    color: #234;
    background: #e7f0ff;
    border-radius: 6px;
    padding: 1em;
    margin: 1em 0;
}
footer {
    text-align: center;
    color: #789;
    font-size: 0.97em;
    margin: 2em 0 0 0;
    padding: 1em 0 0 0;
}
ul {
    list-style: disc inside;
    margin: 1em 0 1em 1.5em;
}
@media (max-width: 700px) {
    main {
        padding: 1em 0.5em 1em 0.5em;
    }
    table, th, td {
        font-size: 0.93em;
    }
    h1 {
        font-size: 1.3em;
    }
}

/* シリーズ表示用スタイル */
.series-view {
    margin: 2em 0;
}

.series-group {
    margin-bottom: 3em;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.series-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5em 2em;
    border-bottom: 1px solid #dee2e6;
}

.series-header h3 {
    margin: 0 0 0.5em 0;
    color: #495057;
    font-size: 1.3em;
    font-weight: 600;
}

.series-description {
    margin: 0;
    color: #6c757d;
    font-size: 0.95em;
    line-height: 1.5;
}

.series-group .cards {
    padding: 1.5em;
}

/* シリーズなし教材のスタイル */
.series-group:last-child .series-header {
    background: linear-gradient(135deg, #f1f3f4 0%, #e8eaed 100%);
}

.series-group:last-child .series-header h3 {
    color: #5f6368;
}

/* シリーズカード用スタイル */
.series-card {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    min-height: 200px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.series-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.series-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5em;
}

.series-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
}

.series-icon {
    font-size: 2em;
    opacity: 0.9;
}

.series-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.3em 0.8em;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.series-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.series-card-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 0.8em;
    line-height: 1.3;
}

.series-card-description {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 1em;
    flex: 1;
    line-height: 1.4;
}

.series-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.series-card-format {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.2em 0.6em;
    border-radius: 12px;
    font-size: 0.8em;
}

.series-card-link-text {
    font-size: 0.9em;
    opacity: 0.9;
}

/* 混合カード表示用 */
.mixed-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 2em 2.2em;
    margin: 2em 0;
    justify-content: flex-start;
}

/* シリーズ詳細ページ用スタイル */
.series-info {
    margin: 2em 0;
}

.series-info-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 2em;
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.series-info-card h2 {
    margin: 0 0 1em 0;
    color: #495057;
    font-size: 1.5em;
}

.series-info .series-description {
    margin: 0 0 1em 0;
    color: #6c757d;
    line-height: 1.6;
}

.series-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.series-count {
    color: #495057;
    font-weight: 600;
}

.back-link {
    color: #495057;
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover {
    color: #007bff;
}

.series-filter {
    background: white;
    padding: 1.5em 2em;
    border-radius: 8px;
    margin: 2em 0;
    border: 1px solid #e0e0e0;
}

.series-filter h3 {
    margin: 0 0 1em 0;
    color: #495057;
}

.reset-btn {
    background: #6c757d;
    color: white;
    padding: 0.5em 1.5em;
    border-radius: 4px;
    text-decoration: none;
    margin-left: 1em;
}

.reset-btn:hover {
    background: #5a6268;
}

.series-materials {
    margin: 2em 0;
}

.history-item {
    transition: box-shadow 0.2s ease;
}

.history-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-in_progress {
    background: #fff3cd;
    color: #856404;
}

.status-favorite {
    background: #f8d7da;
    color: #721c24;
}

.link-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* 学習進捗ページ用スタイル */
.filter-tabs {
    display: flex;
    gap: 0.5em;
    margin: 1.5em 0;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0;
}

.filter-tab {
    padding: 0.8em 1.5em;
    text-decoration: none;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
}

.filter-tab:hover {
    color: #495057;
    border-bottom-color: #dee2e6;
}

.filter-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: 600;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.3em;
    margin: 2em 0;
    flex-wrap: wrap;
    padding: 0 1em;
}

.pagination a,
.pagination span {
    padding: 0.4em 0.8em;
    text-decoration: none;
    color: #007bff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s;
    min-width: 2.2em;
    text-align: center;
    font-size: 0.9em;
}

.pagination a:hover {
    background: #007bff;
    color: white;
}

.pagination .page-current,
.pagination .current {
    background: #007bff;
    color: white;
    border: 1px solid #007bff;
    font-weight: bold;
}

.pagination .page-nav {
    font-weight: bold;
    min-width: 2.5em;
}

.pagination .page-ellipsis {
    border: none;
    background: none;
    color: #6c757d;
    padding: 0.4em 0.3em;
    min-width: auto;
}

.pagination .disabled {
    color: #6c757d;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.5;
}

/* スマホ対応 */
@media (max-width: 768px) {
    .pagination {
        gap: 0.2em;
        padding: 0 0.5em;
    }
    
    .pagination a,
    .pagination span {
        padding: 0.3em 0.6em;
        font-size: 0.85em;
        min-width: 2em;
    }
    
    .pagination .page-nav {
        min-width: 2.2em;
    }
    
    .pagination .page-ellipsis {
        padding: 0.3em 0.2em;
    }
}

/* 超小画面対応 */
@media (max-width: 480px) {
    .pagination {
        gap: 0.1em;
        padding: 0 0.3em;
    }
    
    .pagination a,
    .pagination span {
        padding: 0.25em 0.5em;
        font-size: 0.8em;
        min-width: 1.8em;
    }
    
    .pagination .page-nav {
        min-width: 2em;
    }
}

.progress-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5em;
    margin-bottom: 1em;
    background: white;
    transition: all 0.2s;
}

.progress-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1em;
}

.progress-title {
    flex: 1;
}

.progress-title h3 {
    margin: 0 0 0.5em 0;
    color: #495057;
}

.progress-title h3 a {
    color: #007bff;
    text-decoration: none;
}

.progress-title h3 a:hover {
    text-decoration: underline;
}

.progress-meta {
    color: #6c757d;
    font-size: 0.9em;
}

.progress-status {
    text-align: right;
}

.stats-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5em;
    border-radius: 8px;
    margin-bottom: 2em;
    border: 1px solid #dee2e6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1em;
    text-align: center;
}

.stat-item {
    padding: 1em;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.stat-number {
    font-size: 1.8em;
    font-weight: bold;
    color: #495057;
    margin-bottom: 0.2em;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9em;
}

.empty-state {
    text-align: center;
    padding: 3em 2em;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    color: #6c757d;
}

.empty-state h3 {
    margin: 0 0 1em 0;
    color: #495057;
}

/* 共通ナビゲーション用スタイル */
.nav-back-link {
    color: #6c757d;
    text-decoration: none;
    margin-bottom: 2em;
    display: inline-block;
}

.nav-back-link:hover {
    color: #495057;
}

/* 学習進捗ページ - 追加スタイル */
.stats-summary h3 {
    margin: 0 0 1em 0;
    color: #495057;
}

.search-results-info {
    margin-bottom: 1em;
    color: #6c757d;
    font-size: 0.9em;
}

.tag-highlight {
    color: #007bff;
}

.progress-meta-time {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 0.5em;
}

.progress-meta-date {
    font-size: 0.8em;
    color: #6c757d;
}

.progress-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid #e9ecef;
}

.progress-btn {
    margin: 0;
    padding: 0.4em 1em;
    font-size: 0.9em;
}

.progress-date-info {
    font-size: 0.8em;
    color: #6c757d;
}

.empty-state-actions {
    margin-top: 1.5em;
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5em;
}

.series-item-card {
    border: 1px solid #ddd;
    padding: 1.5em;
    border-radius: 8px;
    background: #fff;
}

.series-item-title {
    margin: 0 0 0.5em 0;
    color: #333;
}

.series-item-link {
    text-decoration: none;
    color: #0066cc;
}

.series-description {
    color: #666;
    font-size: 0.9em;
    margin: 0.5em 0;
}

.series-progress {
    margin: 1em 0;
}

.series-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5em;
}

.series-progress-label {
    font-size: 0.9em;
    color: #666;
}

.series-progress-stats {
    font-size: 0.9em;
    font-weight: bold;
}

.series-progress-bar {
    width: 100%;
    height: 10px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
}

.series-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
}

.series-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: #666;
}

.series-detail-link {
    color: #007bff;
    text-decoration: none;
}

.series-nav-center {
    text-align: center;
    margin-top: 1.5em;
}

.series-nav-link {
    color: #007bff;
    text-decoration: none;
}

/* Series navigation components */
.series-navigation {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.series-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.series-nav-header h3 {
    margin: 0;
    font-size: 1.1em;
}

.series-position {
    background: #007bff;
    color: white;
    padding: 0.3em 0.8em;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
}

.series-nav-buttons {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
}

.series-nav-btn {
    display: block;
    padding: 0.8rem 1rem;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9em;
    text-align: center;
    transition: all 0.2s;
    border: 1px solid #dee2e6;
}

.series-nav-btn.prev-btn {
    background: #e9ecef;
    color: #495057;
    text-align: left;
}

.series-nav-btn.next-btn {
    background: #e9ecef;
    color: #495057;
    text-align: right;
}

.series-nav-btn.series-btn {
    background: #007bff;
    color: white;
    font-weight: bold;
}

.series-nav-btn:hover:not(.disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.series-nav-btn.prev-btn:hover:not(.disabled) {
    background: #007bff;
    color: white;
}

.series-nav-btn.next-btn:hover:not(.disabled) {
    background: #007bff;
    color: white;
}

.series-nav-btn.series-btn:hover {
    background: #0056b3;
}

.series-nav-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
    color: #6c757d;
}

@media (max-width: 768px) {
    .series-nav-buttons {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .series-nav-btn {
        text-align: center;
    }
    
    .series-nav-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* Mini series navigation in cards */
.card-series-nav {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid #e9ecef;
}

.series-nav-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mini-nav-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    text-decoration: none;
    color: #495057;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.2s;
}

.mini-nav-btn:hover:not(.disabled) {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.mini-nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.mini-position {
    font-size: 0.8em;
    color: #6c757d;
    font-weight: bold;
}

/* History and Recent Links sections */
.history-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
}

.history-section-header h2 {
    margin: 0;
}

.view-all-link {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9em;
}

.view-all-link:hover {
    text-decoration: underline;
}

.history-section {
    margin-bottom: 2em;
}

.history-item {
    border: 1px solid #ddd;
    padding: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
    background: white;
    transition: box-shadow 0.2s ease;
}

.history-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.history-content {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.history-main {
    flex: 1;
}

.history-title-link {
    text-decoration: none;
    color: #0066cc;
}

.history-title-link:hover {
    text-decoration: underline;
}

.history-meta {
    margin: 0.5em 0;
    color: #666;
}

.history-status {
    text-align: right;
}

.history-date {
    font-size: 0.8em;
    color: #888;
    margin-top: 0.5em;
}

.recent-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1em;
}

.recent-link-card {
    border: 1px solid #ddd;
    padding: 1em;
    border-radius: 4px;
    background: white;
    transition: box-shadow 0.2s ease;
}

.recent-link-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.recent-link-title {
    text-decoration: none;
    color: #0066cc;
}

.recent-link-title:hover {
    text-decoration: underline;
}

.recent-link-meta {
    margin: 0.5em 0;
    color: #666;
}

.recent-link-tags {
    font-size: 0.8em;
    color: #888;
}

/* サイドバーレイアウト */
.page-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    gap: 2em;
    padding: 0 1em;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    
    /* PC版でのみ適用するビューポート高さベースのサイドバー */
    height: fit-content;
    position: sticky;
    top: 2em;
}

/* PC版でのみ適用するビューポート高さベースの独立スクロール */
@media (min-width: 769px) {
    .sidebar {
        /* ビューポート高さベースの設定 */
        height: calc(100vh - 180px); /* 少し余裕を持たせる */
        overflow-y: auto;
        position: sticky;
        top: 20px; /* 上部からの距離を少し設定 */
        
        /* スムーズスクロール */
        scroll-behavior: smooth;
    }
}

/* 改善されたスクロールバーデザイン（PC版のみ） */
@media (min-width: 769px) {
    .sidebar::-webkit-scrollbar {
        width: 6px;
    }
    
    .sidebar::-webkit-scrollbar-track {
        background: rgba(0,0,0,0.05);
        border-radius: 3px;
    }
    
    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(45, 120, 183, 0.4);
        border-radius: 3px;
        transition: background 0.2s;
    }
    
    .sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(45, 120, 183, 0.7);
    }
}

/* サイドバー内部のスタイル調整（PC版のみ） */
@media (min-width: 769px) {
    .sidebar .sidebar-section {
        margin-bottom: 1.8em;
    }
    
    .sidebar .sidebar-section:last-child {
        margin-bottom: 1em; /* 最後のセクションは少し余白を残す */
    }
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar-section {
    margin-bottom: 2em;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h3 {
    margin: 0 0 1em 0;
    font-size: 1.1em;
    color: #2d78b7;
    border-bottom: 2px solid #4fc3f7;
    padding-bottom: 0.5em;
}

.sidebar-form {
    background: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.sidebar .form-group {
    margin-bottom: 1.5em;
}

.sidebar .form-group:last-child {
    margin-bottom: 0;
}

.sidebar .form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5em;
    color: #333;
}

.sidebar .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.3em;
    align-items: flex-start;
}

.sidebar .checkbox-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 0.5em;
    cursor: pointer;
    padding: 0.2em 0;
    width: 100%;
    text-align: left;
}

.sidebar .checkbox-group input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.sidebar .checkbox-group label span {
    flex: 1;
    line-height: 1.2;
}

.sidebar .checkbox-group .child-subject {
    margin-left: 1em;
    font-size: 0.9em;
}

.sidebar .checkbox-group .child-subject span {
    color: #666;
}

.sidebar .search-btn {
    width: 100%;
    padding: 0.8em;
    font-size: 1em;
    font-weight: 600;
}

.sidebar .collapsible-toggle {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 0.5em 0;
    font-size: 0.9em;
    text-decoration: underline;
}

.sidebar .collapsible-toggle:hover {
    color: #0056b3;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .page-container {
        flex-direction: column;
        gap: 1em;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
}

/* 検索カードの調整（簡略版） */
.search-card-simple {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.5em;
    margin-bottom: 2em;
}

/* 管理ツール共通ツールバー */
.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6em;
    margin: 0.6em 0 1.2em 0;
}
.admin-toolbar .group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6em;
}
.admin-toolbar .spacer { flex: 1; }
.admin-toolbar .admin-btn { margin-top: 0; }
@media (max-width: 700px) {
    .admin-toolbar { gap: 0.5em; }
}

.search-card-simple .form-group {
    margin-bottom: 1em;
}

.search-card-simple .form-group:last-child {
    margin-bottom: 0;
}

/* 現在の検索条件表示 */
.current-conditions {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1em;
    margin-bottom: 1em;
}

.current-conditions h3 {
    margin: 0 0 0.8em 0;
    font-size: 1.1em;
    color: #495057;
}

.conditions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-bottom: 0.8em;
}

.condition-item {
    background: #007bff;
    color: white;
    padding: 0.3em 0.8em;
    border-radius: 20px;
    font-size: 0.9em;
    white-space: nowrap;
}

.search-hint {
    margin: 0;
    font-size: 0.9em;
    color: #6c757d;
    font-style: italic;
}

/* 検索案内セクション */
.search-guide {
    text-align: center;
}

.guide-text {
    font-size: 1.1em;
    margin-bottom: 1em;
    color: #007bff;
}

.search-features {
    list-style: none;
    padding: 0;
    margin: 1.5em 0;
    display: inline-block;
    text-align: left;
}

.search-features li {
    margin: 0.5em 0;
    font-size: 1em;
    color: #495057;
}

/* サイドバー 教科カード＋アコーディオン */
.sidebar-subject-card {
    border: 1px solid #e0e7ef;
    border-radius: 8px;
    background: #fff;
}
.sidebar-subject-card > .card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    cursor: pointer;
    list-style: none;
    background: linear-gradient(135deg, #f8fbff 0%, #eef5fb 100%);
    border-bottom: 1px solid #eef2f7;
}
.sidebar-subject-card > .card-head::-webkit-details-marker { display:none; }
.sidebar-subject-card > .card-head .card-title { font-weight: 600; color: #2d78b7; }
.sidebar-subject-card > .card-head .chev { transition: transform .15s ease; }
.sidebar-subject-card[open] > .card-head .chev { transform: rotate(90deg); }
.sidebar-subject-card > .card-body { padding: 0.8rem 1rem; }
.sidebar-subject-card .checkbox-grid { display:grid; grid-template-columns: 1fr; gap: 0.4rem 0.6rem; }
.sidebar-subject-card .checkbox-grid label { display:flex; align-items:center; gap:0.5rem; }
.sidebar-subject-card .checkbox-grid .child-subject { margin-left: 1em; }

/* 親ごとアコーディオン（複数カード） */
.subject-groups { display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
.subject-group-card .card-body .group-children label { display:flex; align-items:center; gap:0.5rem; margin: 0.25rem 0; }
.subject-group-card .card-head .parent-label input { transform: translateY(1px); }

/* タググループ用カード（教科カードと見た目を揃える） */
.tag-group-card { border: 1px solid #e0e7ef; border-radius: 8px; background: #fff; }
.tag-group-card > .card-head { display:flex; align-items:center; justify-content:space-between; padding:0.6rem 0.9rem; background: linear-gradient(135deg, #f8fbff 0%, #eef5fb 100%); border-bottom:1px solid #eef2f7; cursor:pointer; }
.tag-group-card > .card-head .card-title { font-weight:600; color:#2d78b7; }
.tag-group-card > .card-body { padding:0.6rem 0.9rem; }
.tag-group-card .checkbox-grid { display:grid; grid-template-columns:1fr; gap:0.25rem 0.6rem; }
.tag-group-card .checkbox-grid label { display:flex; align-items:center; gap:.5rem; }

.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.content-panel, .info-panel {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.panel-title {
    color: #2c3e50;
    margin: 0 0 15px 0;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    font-size: 1.1rem;
}

.content-description p {
    line-height: 1.6;
    margin-bottom: 15px;
}

.content-tags {
    margin-top: 15px;
}

.tag-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-right: 5px;
    display: inline-block;
    margin-bottom: 5px;
}

.action-section {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.action-button.primary {
    background: #3498db;
    color: white;
}

.action-button.primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.action-button.secondary {
    background: #95a5a6;
    color: white;
}

.action-button.secondary:hover {
    background: #7f8c8d;
}

.info-list {
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: #7f8c8d;
    min-width: 80px;
}

.info-value {
    font-weight: 500;
    color: #2c3e50;
    text-align: right;
}

.info-value.price-free {
    color: #27ae60;
    font-weight: 600;
}

.info-value.price-paid {
    color: #e74c3c;
    font-weight: 600;
}

.user-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.user-actions h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1rem;
}

.error-message {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.error-message h2 {
    margin: 0 0 15px 0;
    color: #e74c3c;
}

.error-message p {
    margin-bottom: 20px;
    color: #7f8c8d;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .status-buttons-grid {
        grid-template-columns: 1fr;
    }
    
    .action-section {
        flex-direction: column;
    }
    
    .action-button {
        text-align: center;
        justify-content: center;
    }
    
    .related-cards {
        grid-template-columns: 1fr !important;
    }
}

/* 関連教材セクション */
.related-materials-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e9ecef;
}

.section-title {
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.section-description {
    color: #7f8c8d;
    margin: 0 0 20px 0;
    font-size: 0.95rem;
}

.related-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.related-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #3498db;
}

.related-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.related-card-thumb {
    position: relative;
    height: 140px;
    overflow: hidden;
    background: #f8f9fa;
}

.related-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-card:hover .related-thumb {
    transform: scale(1.05);
}

.related-card-body {
    padding: 15px;
}

.related-title {
    margin: 0 0 10px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.related-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 5px;
}

.related-site {
    color: #7f8c8d;
    font-weight: 500;
}

.related-format {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.related-price.price-free {
    color: #27ae60;
    font-weight: 600;
}

.related-price.price-paid {
    color: #e74c3c;
    font-weight: 600;
}

.related-matches {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
    margin-top: 10px;
}

.match-label {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 500;
    margin-bottom: 3px;
}

.match-items {
    font-size: 0.85rem;
    color: #2c3e50;
    line-height: 1.3;
}

.more-matches {
    color: #3498db;
    font-weight: 500;
}

/* シリーズカード専用スタイル - 見やすく改良 */
.series-card {
    border: 2px solid #e8f4fd;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    position: relative;
    box-shadow: 0 2px 8px rgba(41, 128, 185, 0.1);
}

.series-card::before {
    content: "📚";
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    font-size: 1.2em;
    opacity: 0.6;
    z-index: 1;
}

.series-card:hover {
    box-shadow: 0 4px 16px rgba(41, 128, 185, 0.15);
    transform: translateY(-2px);
    border-color: #d1e7dd;
}

.series-card .card-title h4 {
    margin: 0 0 0.5em 0;
    color: #2980b9;
    font-size: 1.1em;
    font-weight: 600;
    line-height: 1.3;
}

.series-card .card-title h4 a {
    color: inherit;
    text-decoration: none;
}

.series-card .card-title h4 a:hover {
    color: #1f618d;
    text-decoration: underline;
}

.series-meta {
    margin: 1em 0;
}

.series-counts {
    display: flex;
    gap: 1em;
    margin-bottom: 0.5em;
}

.matched-count {
    color: #2e7d32;
    font-weight: 600;
    font-size: 0.9em;
}

.total-count {
    color: #5d4037;
    font-weight: 500;
    font-size: 0.9em;
}

.series-progress {
    margin-top: 0.5em;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.3em;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50 0%, #8bc34a 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8em;
    color: #666;
    text-align: right;
}

.series-actions {
    margin-top: 1em;
    text-align: center;
}

.btn-view-series {
    display: inline-block;
    padding: 0.6em 1.2em;
    background: linear-gradient(135deg, #1976d2 0%, #42a5f5 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
}

.btn-view-series:hover {
    background: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(25, 118, 210, 0.4);
    color: white;
    text-decoration: none;
}

/* セクション見出し */
.card-list h3 {
    margin: 0 0 1em 0;
    padding: 0.5em 0;
    color: #2c3e50;
    font-size: 1.3em;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

/* オプションヘルプテキスト */
.option-help {
    margin-top: 0.3em;
    margin-left: 1.5em;
}

.option-help small {
    color: #666;
    font-size: 0.8em;
    line-height: 1.3;
}

/* 検索結果の表示モード別スタイル */
.search-results.individual-cards .card {
    background: #fff !important;
    border: 1px solid #e3eaf2 !important;
    box-shadow: 0 2px 12px #0001 !important;
}

.search-results.individual-cards .card:hover {
    box-shadow: 0 4px 24px #2d78b733 !important;
    transform: translateY(-4px) scale(1.03) !important;
}

/* シリーズ表示モードでのみシリーズカードスタイルを適用 */
.search-results.grouped-by-series .series-card {
    /* シリーズカードの既存スタイルが自動的に適用される */
    opacity: 1;
}

/* 安全対策: individual-cardsモードで誤ってseries-cardクラスが付いた場合の上書き */
.search-results.individual-cards .series-card {
    background: #fff !important;
    border: 1px solid #e3eaf2 !important;
    box-shadow: 0 2px 12px #0001 !important;
}

.search-results.individual-cards .series-card::before {
    display: none !important;
}

/* ホームページのシリーズカードは通常通りに表示 */
.homepage-content .series-card {
    /* ホームページでは既存のシリーズカードスタイルを維持 */
    opacity: 1;
}

/* ステータスフィルタセクションのスタイル */
.sidebar-section h4 {
    margin: 1em 0 0.5em 0;
    font-size: 0.9em;
    color: #666;
    font-weight: 600;
}

.checkbox-group label {
    display: block;
    margin-bottom: 0.5em;
    font-size: 0.9em;
    cursor: pointer;
    transition: color 0.2s ease;
}

.checkbox-group label:hover {
    color: #2980b9;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5em;
    transform: scale(1.1);
}

/* フッター */
.site-footer {
    background: #f8f9fa;
    padding: 2em 0;
    margin-top: 3em;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    margin-bottom: 1.5em;
}

.footer-link {
    color: #007bff;
    text-decoration: none;
    margin: 0 1em;
    display: inline-block;
}

.footer-link:hover {
    text-decoration: underline;
}

.footer-copyright {
    color: #666;
    font-size: 0.9em;
}

/* フッターセクション分割（複数カテゴリ対応） */
.footer-section {
    margin-bottom: 1.2em;
}

.footer-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .12em;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 0.5em;
}

.footer-link--disabled {
    color: #bbb;
    cursor: default;
    pointer-events: none;
}

.footer-link--disabled:hover {
    text-decoration: none;
}

/* 認証ページ共通スタイル */
.auth-container {
    max-width: 400px;
    margin: 2em auto;
    padding: 2em;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
}

.auth-form .form-group label {
    margin-bottom: 0.5em;
    font-weight: bold;
}

.auth-form .form-group input {
    padding: 0.8em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

.auth-form .btn-primary {
    background: #007bff;
    color: white;
    padding: 0.8em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

.auth-form .btn-primary:hover {
    background: #0056b3;
}

.auth-links {
    text-align: center;
    margin-top: 2em;
}

.auth-links a {
    color: #007bff;
    text-decoration: none;
    margin: 0 1em;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* メッセージ共通スタイル */
.message-error {
    color: #dc3545;
    background: #f8d7da;
    padding: 0.8em;
    border-radius: 4px;
    margin-bottom: 1em;
}

.message-success {
    color: #155724;
    background: #d4edda;
    padding: 0.8em;
    border-radius: 4px;
    margin-bottom: 1em;
}

/* 管理画面共通スタイル */
.admin-container {
    max-width: 1200px;
    margin: 2em auto;
    padding: 1em;
}

.admin-table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    font-size: 13px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-table th,
.admin-table td {
    border: 1px solid #ccc;
    padding: 0.3em 0.4em;
    vertical-align: top;
}

.admin-table th {
    background: #234;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
}

.admin-table tr:nth-child(even) {
    background: #f7faff;
}

.admin-table .description-col {
    max-width: 180px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 12px;
}

.admin-btn {
    padding: 0.2em 0.7em;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.admin-btn:hover {
    opacity: 0.8;
}

.admin-btn.edit-btn {
    background: #e7f0ff;
    color: #234;
}

.admin-btn.delete-btn {
    background: #ffe7e7;
    color: #a00;
}

.admin-btn.primary {
    background: #007bff;
    color: white;
}

.admin-btn.secondary {
    background: #6c757d;
    color: white;
}

.admin-card {
    background: #fff;
    padding: 1.2em 1.5em;
    border-radius: 8px;
    max-width: 760px;
    margin: 1em auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* フォーム共通スタイル */
.form-container {
    background: #fff;
    padding: 1.5em 2em;
    border-radius: 8px;
    max-width: 500px;
    margin: 2em auto;
    font-size: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-container .form-group {
    margin-bottom: 1em;
}

.form-container .form-group:last-child {
    margin-bottom: 0;
}

.form-container label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: bold;
    color: #333;
}

.form-container input,
.form-container textarea,
.form-container select {
    width: 100%;
    padding: 0.8em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
}

.form-container textarea {
    resize: vertical;
}

.form-container .btn {
    margin-top: 1.5em;
    padding: 0.5em 2em;
    border-radius: 4px;
    border: none;
    background: #234;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.form-container .btn:hover {
    background: #345;
}

/* ソートボタンのスタイル */
.sort-controls {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.sort-btn {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 4px;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid #007bff;
    background: white;
    color: #007bff;
}

.sort-btn:hover {
    background: #e7f3ff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,123,255,0.15);
}

.sort-btn.active {
    background: #007bff !important;
    color: white !important;
    font-weight: bold !important;
    border: 2px solid #0056b3 !important;
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.sort-btn.active:hover {
    background: #0056b3 !important;
    transform: none;
}

/* 管理画面統一スタイル */
.admin-logout-btn {
    background: none !important;
    border: none !important;
    color: #666 !important;
    padding: 0 !important;
    cursor: pointer !important;
    text-decoration: underline !important;
    font-size: inherit !important;
    margin-left: 1em !important;
}

.admin-logout-btn:hover {
    color: #333 !important;
}

.admin-toolbar .user-info {
    color: #333;
    font-weight: normal;
    text-shadow: none;
}

/* ===== モバイル用ドロワーサイドバー ===== */
@media (max-width: 768px) {
    /* ドロワー用オーバーレイ */
    .drawer-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .drawer-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* ドロワーサイドバー */
    .sidebar.drawer {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: #fff;
        z-index: 999;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        padding-top: 60px;
    }
    
    .sidebar.drawer.active {
        left: 0;
    }
    
    /* ドロワーヘッダー */
    .drawer-header {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 60px;
        background: #007bff;
        color: white;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 1rem;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .drawer-header.active {
        left: 0;
    }
    
    .drawer-title {
        font-weight: 600;
        font-size: 1.1rem;
    }
    
    .drawer-close {
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 5px;
        border-radius: 50%;
        transition: background 0.2s;
    }
    
    .drawer-close:hover {
        background: rgba(255, 255, 255, 0.2);
    }
    
    /* ハンバーガーメニューボタン */
    .mobile-menu-toggle {
        display: none; /* デフォルトでは非表示 */
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1001;
        background: #007bff;
        border: none;
        border-radius: 8px;
        color: white;
        padding: 8px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        transition: all 0.2s;
    }
    
    /* モバイル専用サイドバー開くボタン */
    .mobile-sidebar-toggle {
        display: block;
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        background: #007bff;
        color: white;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        font-size: 16px;
        box-shadow: 0 2px 10px rgba(0,123,255,0.3);
        transition: all 0.3s ease;
        z-index: 1001;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-sidebar-toggle:hover,
    .mobile-sidebar-toggle:active {
        background: #0056b3;
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(0,123,255,0.4);
    }
    
    .mobile-menu-toggle:hover {
        background: #0056b3;
        transform: scale(1.05);
    }
    
    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }
    
    /* ハンバーガーアイコン */
    .hamburger {
        width: 20px;
        height: 16px;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .hamburger span {
        display: block;
        height: 2px;
        width: 100%;
        background: white;
        transition: all 0.3s;
        transform-origin: center;
    }
    
    .mobile-menu-toggle.active .hamburger span:nth-child(1) {
        transform: rotate(45deg) translateY(7px);
    }
    
    .mobile-menu-toggle.active .hamburger span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active .hamburger span:nth-child(3) {
        transform: rotate(-45deg) translateY(-7px);
    }
    
    /* デスクトップでは通常のサイドバー表示 */
    .sidebar:not(.drawer) {
        position: static;
        width: auto;
        max-width: none;
        height: auto;
        background: transparent;
        box-shadow: none;
        padding-top: 0;
    }
    
    /* モバイルでは通常のサイドバーを非表示 */
    .sidebar:not(.drawer) {
        display: none;
    }
}

/* デスクトップではモバイル要素を非表示 */
@media (min-width: 769px) {
    .mobile-menu-toggle,
    .mobile-sidebar-toggle,
    .drawer-overlay,
    .drawer-header {
        display: none !important;
    }
    
    .sidebar.drawer {
        display: none !important;
    }
}

/* ===== series_detail.php専用レイアウト調整 ===== */
/* 右側余白の調整とコンテンツ中央寄せ */
.series-detail-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 768px) {
    .series-detail-layout {
        padding: 0 15px;
    }
}

/* シリーズ詳細ページのメインコンテンツ調整 */
body.series-detail main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

body.series-detail .dashboard-header h1 {
    color: #222;
}

@media (max-width: 768px) {
    body.series-detail main {
        padding: 0 15px;
    }
}

/* ===== ページトップボタン ===== */
.page-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 2px 10px rgba(0,123,255,0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.page-top-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,123,255,0.4);
}

.page-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* モバイル版でページトップボタンの位置調整（サイドバーボタンと重ならないよう） */
@media (max-width: 768px) {
    .page-top-btn {
        bottom: 90px; /* サイドバーボタンの上に配置 */
        right: 20px;
    }
}