/*
Theme Name: NSIC - 地域安全情報共有サイト
Description: 地域の安全情報を共有するためのWordPressテーマ
Version: 1.0
Author: NSIC Team
*/

/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic Medium', 'Meiryo', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* ヘッダー */
.site-header {
    background: #fff;
    border-bottom: 2px solid #dc3545;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.site-logo {
    max-height: 60px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.site-logo:hover {
    opacity: 0.8;
}

.header-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.header-nav a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
}

.header-nav a:hover {
    color: #dc3545;
}

/* メインコンテンツ */
.main-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ホームページスタイル */
.hero-section {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    border-radius: 4px;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: bold;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* ヒーローボタンスタイル */
.hero-button-container {
    margin-top: 1.5rem;
}

.hero-button {
    display: inline-block;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    text-align: center;
    min-width: 160px;
}

.hero-button:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-decoration: none;
}

.hero-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .hero-button {
        padding: 0.7rem 1.5rem;
        font-size: 1rem;
    }
}

/* 検索フォーム */
.search-form {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.search-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.search-field:last-child {
    justify-self: center;
    min-width: auto;
}

.search-field:last-child button {
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

.search-field {
    flex: 1;
    min-width: 200px;
}

.search-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.search-field input,
.search-field select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-field input:focus,
.search-field select:focus {
    outline: none;
    border-color: #dc3545;
}

/* カテゴリボタン */
.category-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.category-btn {
    padding: 0.75rem 1.5rem;
    background: #fff;
    border: 2px solid #dc3545;
    color: #dc3545;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.category-btn:hover,
.category-btn.active {
    background: #dc3545;
    color: white;
    text-decoration: none;
}

.category-btn:focus {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
}

/* 投稿リスト */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.post-card {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.post-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.post-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.post-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #666;
    flex-wrap: wrap;
}

.post-category {
    background: #dc3545;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.post-content {
    padding: 1.5rem;
}

.post-excerpt {
    color: #666;
    line-height: 1.6;
}

/* ボタンスタイル */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover {
    background: #c82333;
}

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

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

/* フォームスタイル */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #dc3545;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    color: #dc3545;
    text-decoration: none;
    border-radius: 4px;
}

.pagination .current {
    background: #dc3545;
    color: white;
}

/* 地図関連スタイル */
.location-map-container {
    margin: 1.5rem 0;
}

.location-map-container h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
}

#location-map,
#detail-map {
    border: 2px solid #e9ecef;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.map-controls {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.btn-map {
    padding: 0.5rem 1rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn-map:hover {
    background: #218838;
}

.btn-map:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* 詳細ページ地図 */
.location-details {
    background: #e3f2fd;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #2196f3;
    margin: 1rem 0;
}

.location-map {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 4px;
    margin: 2rem 0;
}

.location-map h3 {
    color: #555;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* 管理画面スタイル改善 */
.wp-list-table .button-small {
    padding: 2px 8px;
    font-size: 11px;
    margin-right: 5px;
}

.notice.notice-success {
    border-left-color: #28a745;
}

/* モバイル対応 */
@media (max-width: 968px) {
    .search-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .search-field {
        width: 100%;
    }
    
    #location-map,
    #detail-map {
        height: 250px !important;
    }
    
    .map-controls {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .location-map {
        padding: 1rem;
    }
    
    .location-details {
        padding: 0.75rem;
    }
    
    .site-logo {
        max-height: 45px;
    }
}

/* 通報モーダル改善 */
.report-modal {
    backdrop-filter: blur(2px);
}

.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    color: #dc3545;
    border-bottom: 2px solid #dc3545;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

/* フォーム改善 */
.form-help {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.required {
    color: #dc3545;
    font-weight: bold;
}

/* アニメーション追加 */
.post-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-1px);
}

.btn {
    transition: all 0.2s ease;
}

.btn:active {
    transform: translateY(1px);
}

/* エラー状態のスタイル */
.category-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
}

.invalid-params-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.category-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
}

.category-btn {
    position: relative;
}

/* デバッグ情報のスタイル改善 */
.search-debug {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    max-height: 300px;
    overflow-y: auto;
}

.search-debug pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 検索結果なしのスタイル改善 */
.no-posts {
    text-align: center;
    padding: 3rem 2rem;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.no-posts p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1rem;
}

/* 検索結果情報 */
.search-results-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    text-align: center;
}

.results-count {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* 検索条件表示 */
.search-conditions-display {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.search-conditions-display ul {
    list-style-type: disc;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.search-conditions-display li {
    margin-bottom: 0.5rem;
    color: #666;
}

/* 検索フォーム行のレスポンシブ改善 */
.search-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

@media (max-width: 1024px) {
    .search-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .search-field:nth-child(5) {
        grid-column: 1 / -1;
        justify-self: center;
    }
}

@media (max-width: 768px) {
    .search-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .search-field {
        width: 100%;
    }
}

/* ヒーローセクションのアニメーション */
.hero-content {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ユーザーメニュー修正スタイル */
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 8px 0;
    z-index: 100;
    min-width: 180px;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 16px;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
}

.user-dropdown a:hover {
    background-color: #f8f9fa;
}

.dropdown-divider {
    height: 1px;
    background: #e9ecef;
    margin: 8px 0;
}
