/*
	Theme Name: diver_child
	Template: diver
	Description:  Diverの子テーマです。
	Theme URI: http://tan-taka.com/diver/
	Author: Takato Takagi
 */

/* カスタマイズする場合にはこれより下に追記してください  */

/* ======================================
   修正版 Diver対応 交番・警察署サイト用CSS
   左マージン問題を修正 + 個別ページ対応
   ====================================== */

/* Diverの標準構造に対応 + 左マージン修正 */
.diver-content-layout {
    display: flex;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* 左右にパディング追加 */
}

.main-content-area {
    flex: 1;
    min-width: 0; /* flex shrinkのため */
    padding-right: 20px; /* 右側にもマージン */
}

.sidebar-area {
    flex: 0 0 300px; /* 固定幅サイドバー */
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0; /* ウィジェット内でパディング管理 */
}

/* ======================================
   ブレッドクラム（個別ページ用）
   ====================================== */
.koban-breadcrumb,
.police-station-breadcrumb {
    font-size: 14px;
    margin-bottom: 25px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border-left: 4px solid #0073aa;
}

.koban-breadcrumb a,
.police-station-breadcrumb a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.koban-breadcrumb a:hover,
.police-station-breadcrumb a:hover {
    text-decoration: underline;
}

.separator {
    color: #666;
    margin: 0 8px;
}

.current {
    color: #333;
    font-weight: 600;
}

/* ======================================
   個別ページヘッダー
   ====================================== */
.koban-page-header,
.police-station-page-header {
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #0073aa 0%, #1976d2 100%);
    color: white;
    border-radius: 12px;
    text-align: center;
}

.koban-page-title,
.police-station-page-title {
    margin: 0 0 15px 0;
    color: white;
    font-size: 2.2em;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.koban-meta-info,
.police-station-meta-info {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.facility-type-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
}

.police-station-badge {
    background: rgba(25,118,210,0.3);
}

.prefecture-badge {
    background: rgba(255,255,255,0.15);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

/* ======================================
   セクション構造（個別ページ用）
   ====================================== */
.section-title {
    margin: 0 0 25px 0;
    color: #0073aa;
    font-size: 1.4em;
    font-weight: 600;
    border-bottom: 3px solid #e0e0e0;
    padding-bottom: 10px;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #0073aa, #1976d2);
}

/* 基本情報セクション */
.koban-basic-info-section,
.police-station-basic-info-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.koban-info-grid,
.police-station-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 16px;
    color: #555;
    line-height: 1.5;
}

.phone-link {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.phone-link:hover {
    color: #005a87;
    text-decoration: underline;
}

.police-station-link {
    color: #1976d2;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.police-station-link:hover {
    color: #1565c0;
    text-decoration: underline;
}

.jurisdiction-text {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
    font-style: italic;
}

/* ======================================
   地図セクション
   ====================================== */
.koban-map-section,
.police-station-map-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.map-container {
    margin-top: 20px;
}

.koban-map,
.police-station-map {
    height: 400px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.map-note {
    font-size: 13px;
    color: #666;
    margin-top: 15px;
    font-style: italic;
    text-align: center;
}

.map-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.map-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    color: #0073aa;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
}

.map-action-btn:hover {
    background: #0073aa;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.map-error,
.map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #666;
    text-align: center;
    flex-direction: column;
}

/* ======================================
   関連情報セクション（交番ページ）
   ====================================== */
.koban-related-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.nearby-facilities {
    margin-top: 20px;
}

.nearby-facilities h3 {
    color: #0073aa;
    margin: 0 0 20px 0;
    font-size: 1.2em;
}

.nearby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.nearby-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.nearby-card:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.nearby-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nearby-title a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}

.nearby-title a:hover {
    text-decoration: underline;
}

.nearby-type {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.nearby-phone,
.nearby-address {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* ======================================
   管轄交番セクション（警察署ページ）
   ====================================== */
.related-kobans-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.count-badge {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.management-stats {
    margin: 20px 0 30px 0;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.stat-summary {
    display: flex;
    justify-content: space-around;
    text-align: center;
    gap: 20px;
}

.stat-item {
    flex: 1;
}

.stat-item.total {
    border-left: 2px solid #1976d2;
    padding-left: 20px;
}

.stat-number {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: #1976d2;
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    font-weight: 500;
}

.managed-kobans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.managed-koban-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.managed-koban-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0073aa, #1976d2);
}

.managed-koban-card:hover {
    background: white;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.koban-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 10px;
}

.koban-card-title {
    margin: 0;
    flex: 1;
}

.koban-card-title a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.3;
}

.koban-card-title a:hover {
    color: #005a87;
    text-decoration: underline;
}

.facility-type-mini {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.facility-type-mini.交番 {
    background: #e3f2fd;
    color: #1976d2;
}

.facility-type-mini.駐在所 {
    background: #f3e5f5;
    color: #7b1fa2;
}

.koban-card-info {
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-size: 14px;
}

.info-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.address-text {
    color: #666;
    line-height: 1.4;
}

.koban-card-actions {
    text-align: right;
}

.view-koban-btn {
    display: inline-block;
    background: linear-gradient(135deg, #0073aa, #1976d2);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.view-koban-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

/* ======================================
   サイドバーウィジェット スタイル
   ====================================== */
.widget {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.widget-title {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    margin: 0;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
}

.widget-content {
    padding: 20px;
}

/* 緊急連絡先ウィジェット */
.koban-emergency-widget .widget-title,
.emergency-contact-widget .widget-title {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.emergency-contacts {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.emergency-item {
    text-align: center;
}

.emergency-item.urgent {
    padding: 15px;
    background: #fff5f5;
    border-radius: 8px;
    border: 2px solid #fee;
}

.emergency-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.emergency-number {
    display: inline-block;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white !important;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none !important;
    font-weight: bold;
    font-size: 18px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.emergency-number:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220,53,69,0.4);
}

.direct-number {
    display: inline-block;
    background: linear-gradient(135deg, #0073aa, #1976d2);
    color: white !important;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.direct-number:hover {
    background: linear-gradient(135deg, #005a87, #1565c0);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.4);
}

.emergency-note {
    font-size: 12px;
    color: #666;
    margin-top: 15px;
    text-align: center;
    line-height: 1.4;
}

/* 統計ウィジェット */
.police-station-stats-widget .widget-title {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
}

.sidebar-stats {
    display: flex;
    justify-content: space-between;
    text-align: center;
    gap: 15px;
}

.sidebar-stat-item {
    flex: 1;
    padding: 15px 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.sidebar-stat-item.total {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
}

.sidebar-stat-number {
    display: block;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
}

.sidebar-stat-item.total .sidebar-stat-number {
    color: white;
}

.sidebar-stat-item:not(.total) .sidebar-stat-number {
    color: #1976d2;
}

.sidebar-stat-label {
    display: block;
    font-size: 12px;
    margin-top: 5px;
    font-weight: 500;
}

.sidebar-stat-item.total .sidebar-stat-label {
    color: rgba(255,255,255,0.9);
}

.sidebar-stat-item:not(.total) .sidebar-stat-label {
    color: #666;
}

/* 近隣警察署ウィジェット */
.nearby-stations-widget .widget-title {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
}

.nearby-stations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nearby-station-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.nearby-station-link {
    color: #1976d2;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
}

.nearby-station-link:hover {
    color: #1565c0;
    text-decoration: underline;
}

.nearby-station-phone {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.view-all-stations {
    margin-top: 15px;
    text-align: center;
}

.view-all-btn {
    display: inline-block;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25,118,210,0.4);
}

/* ======================================
   レスポンシブ対応
   ====================================== */

@media (max-width: 1024px) {
    .diver-content-layout {
        flex-direction: column;
        padding: 0 15px;
    }
    
    .main-content-area {
        padding-right: 0;
    }
    
    .sidebar-area {
        flex: none;
        width: 100%;
        margin-top: 30px;
    }
    
    .sidebar-stats {
        justify-content: space-around;
    }
    
    .stat-summary {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stat-item.total {
        border-left: none;
        border-top: 2px solid #1976d2;
        padding-left: 0;
        padding-top: 15px;
        margin-top: 15px;
    }
}

@media (max-width: 768px) {
    .diver-content-layout {
        padding: 0 10px;
    }
    
    .koban-page-header,
    .police-station-page-header {
        padding: 20px;
        text-align: center;
    }
    
    .koban-page-title,
    .police-station-page-title {
        font-size: 1.8em;
    }
    
    .koban-meta-info,
    .police-station-meta-info {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .koban-basic-info-section,
    .police-station-basic-info-section,
    .koban-map-section,
    .police-station-map-section,
    .koban-related-section,
    .related-kobans-section {
        padding: 20px;
    }
    
    .koban-info-grid,
    .police-station-info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .managed-kobans-grid {
        grid-template-columns: 1fr;
    }
    
    .nearby-grid {
        grid-template-columns: 1fr;
    }
    
    .map-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .map-action-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    .sidebar-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .koban-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .emergency-contacts {
        gap: 12px;
    }
    
    .emergency-number {
        font-size: 16px;
        padding: 10px 18px;
    }
}

@media (max-width: 480px) {
    .diver-content-layout {
        padding: 0 5px;
    }
    
    .koban-page-header,
    .police-station-page-header {
        padding: 15px;
        margin-bottom: 25px;
    }
    
    .koban-page-title,
    .police-station-page-title {
        font-size: 1.5em;
    }
    
    .koban-basic-info-section,
    .police-station-basic-info-section,
    .koban-map-section,
    .police-station-map-section,
    .koban-related-section,
    .related-kobans-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .section-title {
        font-size: 1.2em;
        margin-bottom: 20px;
    }
    
    .koban-map,
    .police-station-map {
        height: 300px;
    }
    
    .managed-koban-card,
    .nearby-card {
        padding: 15px;
    }
    
    .widget-content {
        padding: 15px;
    }
    
    .emergency-item.urgent {
        padding: 12px;
    }
    
    .stat-summary {
        gap: 10px;
    }
    
    .info-value {
        font-size: 15px;
    }
    
    .phone-link,
    .police-station-link {
        font-size: 15px;
    }
}

/* ======================================
   Diver固有の調整とオーバーライド
   ====================================== */

/* Diverのデフォルトスタイルを上書き */
.diver-theme .koban-single-article,
.diver-theme .police-station-single-article {
    max-width: none;
}

/* Diverのサイドバー幅調整 */
@media (min-width: 1025px) {
    .diver-theme .sidebar-area {
        flex: 0 0 280px;
    }
}

/* Diverのフォント調整 */
.diver-theme .koban-page-title,
.diver-theme .police-station-page-title {
    font-family: inherit;
}

/* Diverのリンク色調整 */
.diver-theme .koban-card-title a,
.diver-theme .nearby-title a,
.diver-theme .nearby-station-link {
    color: #0073aa !important;
}

.diver-theme .koban-card-title a:hover,
.diver-theme .nearby-title a:hover,
.diver-theme .nearby-station-link:hover {
    color: #005a87 !important;
}

/* Diverのボタンスタイル調整 */
.diver-theme .view-koban-btn,
.diver-theme .map-action-btn,
.diver-theme .view-all-btn {
    font-family: inherit;
}

/* Diverのコンテナ調整 */
.diver-theme .container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ======================================
   アクセシビリティ対応
   ====================================== */

/* フォーカス表示の改善 */
.phone-link:focus,
.police-station-link:focus,
.map-action-btn:focus,
.view-koban-btn:focus,
.emergency-number:focus,
.direct-number:focus {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .facility-type-badge,
    .prefecture-badge {
        border: 2px solid currentColor;
    }
    
    .koban-map,
    .police-station-map {
        border: 2px solid #333;
    }
    
    .managed-koban-card,
    .nearby-card {
        border: 2px solid #333;
    }
}

/* 動きを減らす設定への対応 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .managed-koban-card:hover,
    .nearby-card:hover,
    .map-action-btn:hover,
    .view-koban-btn:hover {
        transform: none;
    }
}

/* ======================================
   印刷用スタイル
   ====================================== */
@media print {
    .sidebar-area,
    .map-action-btn,
    .view-koban-btn,
    .view-all-btn,
    .emergency-number,
    .direct-number {
        display: none !important;
    }
    
    .diver-content-layout {
        flex-direction: column;
    }
    
    .main-content-area {
        width: 100% !important;
        padding: 0 !important;
    }
    
    .koban-page-header,
    .police-station-page-header {
        background: #f8f9fa !important;
        color: #333 !important;
        border: 2px solid #333 !important;
    }
    
    .koban-page-title,
    .police-station-page-title {
        color: #333 !important;
    }
    
    .managed-koban-card,
    .nearby-card,
    .koban-basic-info-section,
    .police-station-basic-info-section {
        border: 1px solid #333 !important;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 15px !important;
    }
    
    .koban-map,
    .police-station-map {
        display: none !important;
    }
    
    .map-note {
        display: none !important;
    }
    
    .phone-link,
    .police-station-link {
        color: #333 !important;
        text-decoration: underline !important;
    }
}

/* ======================================
   ダークモード対応（オプション）
   ====================================== */
@media (prefers-color-scheme: dark) {
    .koban-basic-info-section,
    .police-station-basic-info-section,
    .koban-map-section,
    .police-station-map-section,
    .koban-related-section,
    .related-kobans-section,
    .widget {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .section-title {
        color: #63b3ed;
    }
    
    .info-label {
        color: #a0aec0;
    }
    
    .info-value {
        color: #e2e8f0;
    }
    
    .managed-koban-card,
    .nearby-card {
        background: #374151;
        border-color: #4b5563;
    }
    
    .managed-koban-card:hover,
    .nearby-card:hover {
        background: #4b5563;
    }
    
    .widget-title {
        background: #374151;
        color: #f7fafc;
        border-color: #4b5563;
    }
    
    .sidebar-area {
        background: #2d3748;
    }
}

/* ======================================
   カスタムスクロールバー（Webkit系ブラウザ）
   ====================================== */
.widget-content::-webkit-scrollbar {
    width: 6px;
}

.widget-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.widget-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.widget-content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}