/* 基本設定 */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    color: #333;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* レイアウト */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

@media only screen and (max-width: 767px) {
    .container {
        padding: 0 15px;
    }
}

/* ヘッダー */
.header {
    width: 100%;
    background-color: rgb(250, 250, 250);
    padding: 10px 0;
}

.header h1 {
    margin: 0;
    font-size: 1.5em;
}

/* ナビゲーション */
.nav-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 5px 20px;
    background-color: #fff;
    overflow: hidden;
}

.nav-item-right {
    text-align: right;
}

.navicontainer {
    width: 100%;
    clear: both;
    margin: 0;
    padding: 2px 0;
    background-color: rgb(250, 250, 250);
    overflow: hidden;
}

.navitemleft {
    float: left;
}

.navitemright {
    float: right;
}

/* 特設ページ */
.special {
    max-width: 900px;
    margin: 10px auto;
    padding: 10px 20px;
    background-color: #fff8e1;
    border-radius: 4px;
}

.special-link {
    margin: 5px 0;
}

/* 最新コメント */
.new-comment {
    max-width: 860px;
    margin: 20px auto;
    background-color: #fff;
}

.new-comment .comment-item {
    margin: 10px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.new-comment .comment-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* メインコンテンツ */
.main-table {
    width: 100%;
    border-collapse: collapse;
}

.main-contents {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 20px;
    vertical-align: top;
}

@media only screen and (max-width: 767px) {
    .main-contents {
        margin: 15px auto;
        padding: 0 15px;
    }
}

.sidebar {
    width: 200px;
    padding: 10px;
    vertical-align: top;
}

/* 管理者メニュー */
.admin-menu {
    max-width: 900px;
    margin: 10px auto;
    padding: 10px 20px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.admin-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-menu li {
    margin-bottom: 5px;
}

.admin-links a {
    margin-left: 15px;
}

/* 記事リスト */
.items-list {
    margin: 20px 0;
}

.item {
    margin-bottom: 20px;
}

.item-title {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 5px;
}

.item-date {
    font-size: 0.85em;
    color: #666;
}

.item-categories {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
}

.item-body {
    margin: 15px 0;
}

.item-more {
    margin-top: 10px;
}

.item-actions {
    display: inline-block;
    margin-left: 10px;
}

/* 編集セクション */
.edit-section {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.header-edit {
    background-color: rgb(250, 250, 250);
    padding: 10px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}

.body-edit {
    padding: 15px;
}

/* フォーム */
.form-table {
    width: 100%;
    border-collapse: collapse;
}

.form-table td {
    padding: 8px;
    vertical-align: top;
}

.form-table label {
    font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
}

textarea {
    resize: vertical;
}

.input-sort {
    width: 60px !important;
}

.input-name {
    width: 200px !important;
}

.input-parent {
    width: 160px;
    padding: 4px;
    font-size: 0.9em;
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 1em;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f8f9fa;
    cursor: pointer;
    text-decoration: none;
    color: #333;
}

.btn:hover {
    background-color: #e9ecef;
    text-decoration: none;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    color: #fff;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #c82333;
    color: #fff;
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #5a6268;
    color: #fff;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.85em;
}

/* ページネーション */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 0.25rem;
    justify-content: center;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: #007bff;
    background-color: #fff;
    border: 1px solid #dee2e6;
}

.page-link:hover {
    color: #0056b3;
    text-decoration: none;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item:first-child .page-link {
    margin-left: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.page-item:last-child .page-link {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

.page-item.active .page-link {
    z-index: 1;
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    cursor: auto;
    background-color: #fff;
    border-color: #dee2e6;
}

/* センター配置 */
.center {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* 折りたたみ */
.collapsible {
    max-width: 860px;
    margin: 20px auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

@media only screen and (max-width: 900px) {
    .collapsible {
        margin-left: 20px;
        margin-right: 20px;
    }
}

.collapsible-header {
    padding: 12px 15px;
    background-color: #f8f9fa;
    cursor: pointer;
    font-weight: bold;
    list-style: none;
    display: flex;
    align-items: center;
}

.collapsible-header::-webkit-details-marker {
    display: none;
}

.collapsible-header::before {
    content: "▶";
    font-size: 0.8em;
    margin-right: 8px;
    transition: transform 0.2s;
}

details[open] > .collapsible-header::before {
    transform: rotate(90deg);
}

.collapsible-content {
    padding: 15px;
    border-top: 1px solid #ddd;
}

/* カテゴリ選択 */
.category-select {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
}

.category-filter {
    background-color: #fff;
}

.category-checkboxes {
    margin: 10px 0;
}

.category-checkbox {
    display: block;
    margin-bottom: 5px;
}

.category-actions {
    margin-top: 10px;
}

.category-row {
    margin-bottom: 8px;
}

.category-form-inline {
    display: inline;
}

/* コメント */
.comments-section {
    margin-top: 30px;
}

.comment {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.comment-meta {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
}

.comment-body {
    margin-top: 10px;
}

.comment-form {
    margin-top: 20px;
}

.comments-pagination {
    margin: 15px 0;
}

/* メディア */
.media-table {
    width: 100%;
    border-collapse: collapse;
}

.media-table td {
    padding: 5px;
    vertical-align: middle;
}

.media-thumb {
    width: 130px;
}

.media-thumb img {
    display: block;
}

/* アラート */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.error-message {
    color: #dc3545;
    font-size: 0.85em;
    margin-top: 5px;
}

/* バナー */
.banner {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 20px;
    text-align: center;
}

/* バックリンク */
.back-link {
    margin-top: 20px;
    padding: 10px 0;
}

/* フッター */
.footer {
    max-width: 900px;
    margin: 20px auto;
    padding: 10px 20px;
    word-wrap: break-word;
    font-size: 0.85em;
    color: #666;
    text-align: center;
}

/* レスポンシブ対応 */
@media only screen and (max-width: 767px) {
    .main-table,
    .main-table tbody,
    .main-table tr,
    .main-table td {
        display: block;
        width: 100%;
    }

    .sidebar {
        width: 100%;
    }

    .category-form-inline {
        display: block;
        margin-bottom: 5px;
    }
}
