/* メインレイアウト */
.fukuoka-curry-container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
    padding: 20px;
    position: relative;
}

.curry-content {
    flex: 1;
    min-width: 0;
}

/* 既存のCSSに追加する差分コード */

/* コンパクトな記事デザイン */
.curry-article.compact {
    padding: 12px 16px;
    margin-bottom: 12px;
}

.curry-article.compact .article-header {
    margin-bottom: 8px;
}

.curry-article.compact .article-header h4 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 600;
}

.curry-article.compact .article-header h4 a {
    color: #007cba;
    text-decoration: none;
}

.curry-article.compact .article-header h4 a:hover {
    text-decoration: underline;
}

.curry-article.compact .article-header .date {
    font-size: 12px;
    padding: 2px 6px;
    margin-left: 10px;
}

/* コンパクトなタグスタイル */
.curry-article.compact .article-tags {
    margin-bottom: 8px;
    gap: 6px;
}

.curry-article.compact .tag {
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1.2;
}

/* 訪問日付の表示スタイル */
.visit-status {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 3px;
    font-weight: normal;
}

.visit-date {
    font-size: 10px;
    color: #666;
    background: rgba(255, 255, 255, 0.8);
    padding: 1px 3px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 店名タグの訪問状況表示 */
.tag-shop .visit-status {
    font-weight: bold;
}

.tag-shop .visit-date {
    background: rgba(255, 255, 255, 0.9);
    color: #1976d2;
    font-weight: normal;
}

/* 管理コントロールのコンパクト化 */
.curry-article.compact .admin-controls {
    margin-top: 8px;
    padding-top: 8px;
    gap: 8px;
}

.curry-article.compact .admin-controls button {
    padding: 4px 8px;
    font-size: 11px;
}

/* 記事リストのグリッド化（オプション） */
@media (min-width: 1200px) {
    .articles-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .curry-article.compact {
        width: 100%;
    }
}

/* より多くの記事表示のためのスペース調整 */
.fukuoka-curry-container {
    gap: 15px;
    padding: 15px;
}

.curry-content {
    flex: 2.5;
}

.tags-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 新規追加 */
.tags-sidebar::-webkit-scrollbar {
    width: 8px;
}

.tags-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tags-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.tags-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 検索統計の調整 */
.search-stats {
    margin-bottom: 15px;
    padding: 6px 10px;
    font-size: 13px;
}

/* 記事編集モーダルのスタイル（新規追加） */
#article-edit-modal .modal-content {
    max-width: 650px;
}

#article-edit-modal .tag-input-group input[type="text"],
#article-edit-modal .tag-input-group input[type="url"],
#article-edit-modal .tag-input-group input[type="datetime-local"] {
    font-size: 14px;
    padding: 8px;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .curry-article.compact {
        padding: 10px 12px;
    }
    
    .curry-article.compact .article-header h4 {
        font-size: 15px;
    }
    
    .curry-article.compact .tag {
        font-size: 10px;
        padding: 2px 5px;
    }
    
    .visit-date {
        font-size: 9px;
    }
    
    /* グリッドを無効化 */
    .articles-list {
        display: flex;
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .curry-article.compact .article-header {
        flex-direction: column;
        gap: 5px;
    }
    
    .curry-article.compact .article-header .date {
        margin-left: 0;
        align-self: flex-start;
        font-size: 11px;
    }
    
    .visit-status {
        flex-direction: column;
        gap: 1px;
        align-items: flex-start;
    }
}


/* 検索バー・ソートバー（更新） */
.search-and-sort-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-section {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

.sort-section {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}

.search-section input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.search-section button {
    padding: 10px 20px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.search-section button:hover {
    background: #005a87;
}

/* ソートセレクト */
.sort-section label {
    font-weight: bold;
    color: #555;
}

.sort-section select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.sort-section select:hover {
    border-color: #007cba;
}

.sort-section select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 3px rgba(0, 124, 186, 0.3);
}

/* 検索統計 */
.search-stats {
    margin-bottom: 20px;
    padding: 8px 12px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    font-size: 14px;
    color: #1976d2;
}

/* 記事リスト */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.curry-article {
    background: white;
    padding: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.curry-article:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 記事ヘッダー（新規追加） */
.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.article-header h3 {
    margin: 0;
    font-size: 18px;
    flex: 1;
}

.article-header h3 a {
    color: #007cba;
    text-decoration: none;
}

.article-header h3 a:hover {
    text-decoration: underline;
}

.article-header .date {
    color: #666;
    font-size: 14px;
    font-weight: bold;
    margin: 0;
    margin-left: 15px;
    white-space: nowrap;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* タグスタイル */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-shop {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.tag-curry_type {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.tag-location {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.visit-status {
    margin-left: 4px;
    font-weight: bold;
}

/* 管理コントロール */
.admin-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.edit-tags, .delete-article {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.delete-article {
    background: #dc3545;
}

.edit-tags:hover {
    background: #218838;
}

.delete-article:hover {
    background: #c82333;
}

/* サイドバーのタグ */
.tags-sidebar h3 {
    margin: 0 0 20px 0;
    color: #333;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
}

.tag-section {
    margin-bottom: 25px;
}

.tag-section h4 {
    margin: 0 0 10px 0;
    color: #555;
    font-size: 14px;
    font-weight: bold;
}

.sidebar-tag {
    display: inline-block;
    margin: 3px;
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-tag:hover {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* タグクラウド */
.tag-cloud {
    line-height: 1.8;
}

.tag-cloud .shop-tag {
    margin: 2px;
    font-weight: bold;
}

/* ローディング状態 */
.articles-list.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.articles-list.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

.modal-content h3 {
    margin: 0 0 20px 0;
    color: #333;
}

/* フォーム */
.tag-input-group {
    margin-bottom: 20px;
}

.tag-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.tag-input-group input[type="text"],
.tag-input-group input[type="date"],
.tag-input-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.tag-input-group textarea {
    height: 80px;
    resize: vertical;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* オートコンプリート */
.tag-suggestions {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    width: calc(100% - 2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* フォーム送信ボタン */
.modal-content button[type="submit"] {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    margin-top: 20px;
}

.modal-content button[type="submit"]:hover {
    background: #005a87;
}

/* レスポンシブデザイン */
/* 修正後（@media (max-width: 1024px)に変更） */
@media (max-width: 1024px) {
    .fukuoka-curry-container {
        flex-direction: column;
    }
    
    .tags-sidebar {
        position: static;      /* 固定解除 */
        width: 100%;
        max-height: none;      /* 最大高さ制限解除 */
        order: -1;
    }
    
    .curry-content {
        order: 0;
    }
}

@media (max-width: 480px) {
    .curry-article {
        padding: 15px;
    }
    
    .article-header h3 {
        font-size: 16px;
    }
    
    .tags-sidebar {
        padding: 15px;
    }
    
    .tag-cloud .shop-tag {
        font-size: 12px !important;
        max-width: calc(50% - 6px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .search-and-sort-bar {
        gap: 10px;
    }
    
    .search-section {
        flex-direction: column;
    }
}

/* エラーメッセージ */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* 成功メッセージ */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* フィルター状態表示 */
.active-filters {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
}

.active-filters.show {
    display: block;
}

.filter-tag {
    display: inline-block;
    background: #007cba;
    color: white;
    padding: 4px 8px;
    margin: 2px;
    border-radius: 4px;
    font-size: 12px;
}

.filter-tag .remove-filter {
    margin-left: 5px;
    cursor: pointer;
    font-weight: bold;
}

.filter-tag .remove-filter:hover {
    color: #ffcccb;
}

/* モーダル全体のスクロール対応修正 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto; /* 縦スクロール追加 */
}

/* モーダルコンテンツの修正 */
.modal-content {
    background-color: #fff;
    margin: 20px auto; /* 上下マージンを固定値に変更 */
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-height: none; /* 最大高さ制限を削除 */
    min-height: auto; /* 最小高さを自動に */
}

/* 記事編集モーダル専用の大きめスタイル */
#article-edit-modal .modal-content {
    max-width: 650px;
    margin: 20px auto 40px auto; /* 下マージンを増加 */
}

/* モバイルでのモーダル調整 */
@media (max-width: 768px) {
    .modal-content {
        margin: 10px auto 30px auto; /* モバイルでもマージンを確保 */
        width: 95%;
        padding: 20px;
    }
    
    #article-edit-modal .modal-content {
        margin: 10px auto 30px auto;
    }
}

/* 超小画面での調整 */
@media (max-width: 480px) {
    .modal-content {
        margin: 5px auto 20px auto;
        width: 98%;
        padding: 15px;
    }
    
    #article-edit-modal .modal-content {
        margin: 5px auto 20px auto;
    }
}

/* フォーム要素の調整 */
.tag-input-group {
    margin-bottom: 20px;
}

.tag-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.tag-input-group input[type="text"],
.tag-input-group input[type="url"],
.tag-input-group input[type="datetime-local"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

/* 送信ボタンの調整 */
.modal-content button[type="submit"] {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 10px; /* 下マージン追加 */
}

.modal-content button[type="submit"]:hover {
    background: #005a87;
}

/* 閉じるボタンの調整 */
.close {
    position: absolute;
    right: 15px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    z-index: 1001; /* 他の要素より前面に */
}

.close:hover {
    color: #000;
}

/* オートコンプリートがモーダル外に出ないよう調整 */
.modal-content .tag-input-group {
    position: relative;
}

.modal-content .autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 1002;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.modal-content .autocomplete-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.modal-content .autocomplete-item:hover {
    background-color: #f5f5f5;
}

.modal-content .autocomplete-item:last-child {
    border-bottom: none;
}

/* オートコンプリート候補のスタイル */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 2px;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #f5f5f5;
}

.autocomplete-item .count {
    color: #999;
    font-size: 0.9em;
    margin-left: 4px;
}

/* タグ入力フィールドの親要素に相対位置を設定 */
.tag-input-group {
    position: relative;
}

.form-group {
    position: relative;
}

/* 入力フィールドのバリデーション表示 */
.tag-autocomplete.error {
    border-color: #dc3545;
}

.tag-autocomplete.success {
    border-color: #28a745;
}

/* ページネーション用CSS */
.pagination-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 40px;
}

.page-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.page-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
    cursor: default;
}

.page-btn.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-ellipsis {
    padding: 8px 4px;
    color: #999;
}

.prev-page, .next-page {
    font-weight: bold;
    padding: 8px 16px;
}

/* ローディング状態 */
.articles-list.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
    min-height: 200px;
}

.articles-list.loading::after {
    content: "読み込み中...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-size: 16px;
    font-weight: bold;
    z-index: 100;
}

/* 検索統計表示 */
.search-stats {
    margin: 15px 0;
    padding: 10px 15px;
    background: #f8f9fa;
    border-left: 4px solid #007bff;
    font-weight: 500;
    border-radius: 4px;
}

/* フォーム全体のスクロール考慮 */
#article-edit-form {
    min-height: auto;
}

/* iOS Safariでの表示問題対応 */
@supports (-webkit-overflow-scrolling: touch) {
    .modal {
        -webkit-overflow-scrolling: touch;
    }
}
