/*
Theme Name: Election Candidates Comparison
Theme URI: https://example.com/
Author: Your Name
Author URI: https://example.com/
Description: 選挙候補者比較表示テーマ
Version: 1.0
License: GPL v2 or later
Text Domain: election-theme
*/

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Container */
.election-container {
    max-width: 1200px;
    margin: 20px auto;
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* Header */
.election-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 25px 20px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: bold;
    letter-spacing: 0.05em;
}

/* District Selector */
.district-selector {
    background-color: #f8f8f8;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.district-tabs {
    display: flex;
    padding: 0;
    min-width: fit-content;
}

.district-tab {
    padding: 15px 25px;
    border: none;
    background-color: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    position: relative;
}

.district-tab:hover {
    background-color: #f0f0f0;
    color: #333;
}

.district-tab.active {
    color: #2196F3;
    background-color: white;
    border-bottom-color: #2196F3;
}

/* Election District Title */
.election-district {
    background-color: #f0f0f0;
    padding: 15px 20px;
    font-size: 2.5rem;
    font-weight: bold;
    border-bottom: 2px solid #ddd;
}

/* グリッドレイアウトの最適化 */
.candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0;
    background-color: white;
}

@media (min-width: 768px) {
    .candidates-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .candidates-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) {
    .candidates-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1400px) {
    .candidates-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* 候補者カードの基本構造修正 */
.candidate {
    border: 1px solid #e0e0e0;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: white;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.candidate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: #d0d0d0;
}

.candidate-header {
    padding: 0;
    text-align: center;
    background-color: #fafafa;
    position: relative;
    flex-shrink: 0;
}

.party-info {
    padding: 12px 10px 10px;
}

.party-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    background-color: #666;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    margin-left: 5px;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.status-new { 
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.status-current { 
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

.status-former { 
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

/* Photo Container */
.photo-container {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    flex-shrink: 0;
}

.candidate-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.candidate-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
    color: white;
    padding: 25px 8px 10px;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    letter-spacing: 0.02em;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
}

.endorsement-inline {
    font-size: 0.7rem;
    font-weight: 500;
    color: #ffd700;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

.scandal-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #ff0000;
    color: white;
    padding: 8px 8px;
    border-radius: 50%;
    font-size: 1.3rem;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    animation: pulse 2s infinite;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

/* 4文字の場合の特別な調整 */
.scandal-badge-4char {
    font-size: 1.2rem;
    padding: 8px 4px;
    line-height: 1.1;
    width: 60px;
    height: 60px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.scandal-badge-link {
    text-decoration: none;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.scandal-badge-link:hover .scandal-badge {
    background-color: #cc0000;
    transform: scale(1.1);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.scandal-detail {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 8px 10px;
    margin: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #856404;
    display: flex;
    align-items: flex-start;
    gap: 5px;
    flex-wrap: wrap;
}

.scandal-link {
    margin-left: auto;
    color: #0066cc;
    text-decoration: none;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.scandal-link:hover {
    text-decoration: underline;
}

.scandal-link svg {
    opacity: 0.7;
}

.scandal-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Age Badge */
.candidate-age {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
    margin-bottom: 5px;
}

.age-badge {
    display: inline-block;
    background-color: #ffeb3b;
    color: #333;
    padding: 2px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* 政策セクションの修正 */
.policies {
    border-top: 1px solid #eee;
    background-color: #fafafa;
    padding: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.policy-row {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    gap: 10px;
}

.policy-row:hover {
    background-color: #f5f5f5;
}

.policy-row:last-child {
    border-bottom: none;
}

.policy-name {
    width: 100px;
    flex-shrink: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
}

.policy-icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    opacity: 0.7;
    flex-shrink: 0;
}

.stance {
    flex: 1;
    min-width: 0;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 6px;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.stance-link {
    flex: 1;
    min-width: 0;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 6px;
    font-size: 1rem;
    color: white;
    text-decoration: none;
}

.stance-link svg {
    margin-left: 6px;
    flex-shrink: 0;
}

.policy-row:hover .stance {
    transform: scale(1.05);
}

/* Stance Colors */
/* 青系（推進・友好・減税） */
.stance-promote,
.stance-friendly {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

/* 赤系（反対・バラまき・強硬・限定） */
.stance-oppose,
.stance-hardline,
.stance-limited {
    background: linear-gradient(135deg, #f44336, #e53935);
    color: white;
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.3);
}

/* 緑系（慎重） */
.stance-cautious {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

/* グレー系（不明・？） */
.stance-unknown {
    background: linear-gradient(135deg, #607D8B, #455A64);
    color: white;
    box-shadow: 0 2px 4px rgba(96, 125, 139, 0.3);
}

/* Party Colors */
.party-ldp { 
    color: #dc2626;
    font-weight: 700;
}

.party-cdp { 
    color: #1e40af;
    font-weight: 700;
}

.party-komeito { 
    color: #ea580c;
    font-weight: 700;
}

.party-jcp { 
    color: #b91c1c;
    font-weight: 700;
}

.party-ishin { 
    color: #16a34a;
    font-weight: 700;
}

.party-reiwa { 
    color: #ff3d95;
    font-weight: 700;
}

.party-kokumin { 
    color: #0034a5;
    font-weight: 700;
}

.party-sansei { 
    color: #f59e0b;
    font-weight: 700;
}

.party-ind { 
    color: #6b7280;
    font-weight: 700;
}

/* 保守党の色 */
.party-hoshu { 
    color: #00aeff;
    font-weight: 700;
}

/* 諸派の色 */
.party-shoha { 
    color: #868e96;
    font-weight: 700;
}

/* NHK党の色 */
.party-nhk { 
    color: #f7f31e;
    font-weight: 700;
}

/* 日本改革党の色 */
.party-kaikaku { 
    color: #059669;
    font-weight: 700;
}

/* チームみらいの色 */
.party-mirai { 
    color: #0ea5e9;
    font-weight: 700;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.candidate {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Mobile Adjustments */
@media (max-width: 767px) {
    .district-tabs {
        padding: 0 10px;
    }
    
    .district-tab {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .party-name {
        font-size: 2rem;
    }
    
    .candidate-name {
        font-size: 1rem;
        padding: 20px 6px 8px;
    }
    
    .endorsement-inline {
        font-size: 0.65rem;
    }
    
    .status-badge {
        font-size: 0.6rem;
        padding: 2px 5px;
    }
}
/* レスポンシブ調整 */
@media (max-width: 768px) {
    .policies {
        padding: 0;
    }
    
    .policy-row {
        padding: 8px 12px;
        min-height: 40px;
    }
    
    .policy-name {
        width: 100px;
        flex: 0 0 100px;
        font-size: 0.9rem;
    }
    
    .policy-icon {
        width: 16px;
        height: 16px;
        margin-right: 4px;
    }
    
    .stance,
    .stance-link {
        width: 100%;
        min-width: 80px;
        height: 32px;
        font-size: 0.85rem;
        padding: 0 10px;
    }
}
@media (max-width: 480px) {
    .policy-row {
        padding: 6px 10px;
        min-height: 36px;
    }
    
    .policy-icon {
        display: none;
    }
    
    .policy-name {
        width: 80px;
        flex: 0 0 80px;
        font-size: 0.95rem;
    }
    
    .stance,
    .stance-link {
        width: 100%;
        min-width: 70px;
        height: 28px;
        font-size: 0.8rem;
        padding: 0 8px;
    }
    
    .stance-link svg {
        width: 10px;
        height: 10px;
        margin-left: 4px;
    }
}


/* ==================================
   ヘッダースタイル
   ================================== */

/* ヘッダー基本構造 */
.site-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

/* ロゴ・サイトタイトル */
.site-branding {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo {
    color: #ffd700;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.site-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.site-title a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-title a:hover {
    color: #ffd700;
}

.site-description {
    margin: 0;
    font-size: 0.85rem;
    color: #b8bec9;
    white-space: nowrap;
}

/* メインナビゲーション */
.main-navigation {
    display: flex;
    align-items: center;
    gap: 30px;
}

.primary-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 25px;
}

.primary-menu li {
    margin: 0;
}

.primary-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: block;
}

.primary-menu a:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.primary-menu .current-menu-item a {
    background-color: rgba(255,215,0,0.2);
    color: #ffd700;
}

/* ヘッダーアクション */
.header-actions {
    display: flex;
    align-items: center;
}

.admin-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
}

.admin-link:hover {
    background-color: rgba(255,215,0,0.2);
    border-color: #ffd700;
    color: #ffd700;
    transform: translateY(-1px);
}

/* モバイルメニューボタン */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: white;
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* モバイルメニュー */
.mobile-menu {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 99;
}

.mobile-menu.active {
    transform: translateY(0);
}

.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 20px;
}

.mobile-menu-list li {
    margin: 0;
}

.mobile-menu-list a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.mobile-menu-list a:hover {
    background-color: rgba(255,255,255,0.1);
    padding-left: 30px;
}

.mobile-menu-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.admin-link-mobile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    background-color: rgba(255,215,0,0.2);
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.admin-link-mobile:hover {
    background-color: rgba(255,215,0,0.3);
    transform: translateX(5px);
}

/* ==================================
   フッタースタイル
   ================================== */

/* フッター基本構造 */
.site-footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    color: #b8bec9;
    margin-top: 60px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    padding: 50px 0 40px;
}

/* フッターセクション */
.footer-section h3,
.footer-section h4 {
    color: white;
    margin: 0 0 20px;
}

.footer-title {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-title svg {
    color: #ffd700;
}

.footer-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    position: relative;
    padding-bottom: 10px;
}

.footer-subtitle::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: #ffd700;
    border-radius: 2px;
}

.footer-description {
    line-height: 1.8;
    color: #8892a0;
}

/* フッターリスト */
.footer-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-list li {
    margin-bottom: 12px;
}

.footer-list a {
    color: #8892a0;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.footer-list a:hover {
    color: #ffd700;
    transform: translateX(5px);
}

/* 政策アイテム */
.policy-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8892a0;
}

.policy-item svg {
    color: #ffd700;
    opacity: 0.7;
}

/* ソーシャルボタン */
.footer-social {
    display: flex;
    gap: 12px;
}

.social-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background-color: rgba(255,255,255,0.1);
}

.social-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.social-button.x-twitter:hover {
    background-color: #000000;
}

.social-button.facebook:hover {
    background-color: #1877F2;
}

.social-button.line:hover {
    background-color: #00B900;
}

.social-button svg {
    fill: white;
}

/* フッターボトム */
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.copyright {
    color: #6c7583;
    font-size: 0.9rem;
}

.footer-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-nav a {
    color: #8892a0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-nav a:hover {
    color: #ffd700;
}

.separator {
    color: #4a5568;
}

/* トップへ戻るボタン */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 90;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.back-to-top svg {
    fill: white;
}

/* レスポンシブデザイン */
@media (max-width: 992px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .footer-about {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    /* ヘッダーモバイル対応 */
    .header-container {
        min-height: 60px;
    }
    
    .site-description,
    .main-navigation {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-menu {
        display: block;
    }
    
    body.menu-open {
        overflow: hidden;
    }
    
    /* フッターモバイル対応 */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 40px 0 30px;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.2rem;
    }
    
    .logo-wrapper {
        gap: 8px;
    }
    
    .site-logo {
        width: 32px;
        height: 32px;
    }
}

/* 候補者数バッジ */
.candidate-count-badge {
    display: inline-block;
    background-color: #666;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    min-width: 20px;
    text-align: center;
}

/* 不正フィルターボタン */
.scandal-filter-buttons {
    background-color: #f8f8f8;
    padding: 10px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: none; /* 初期状態は非表示 */
    gap: 10px;
}

.scandal-filter-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 10px;
}

/* 石破総裁選投票者ボタンの色 */
.scandal-filter-btn[data-filter="ishiba-all"] {
    border-color: #4CAF50;
}

.scandal-filter-btn[data-filter="ishiba-all"]:hover {
    background-color: #e8f5e9;
}

.scandal-filter-btn[data-filter="ishiba-all"].active {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

/* 不正一覧タブの特別なスタイル */
.scandal-tab {
    background-color: #fff3cd !important;
    color: #856404 !important;
    border-top: 3px solid #ff0000 !important;
}

.scandal-tab.active {
    background-color: #ff0000 !important;
    color: white !important;
}

.scandal-tab.active svg {
    fill: white !important;
}

/* 凡例のアイコン修正 */
.legend-item img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* エラーメッセージ用 */
#location-error {
    display: none;
    background: #ff6b6b;
    color: white;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    text-align: center;
}

/* 検索結果メッセージ */
.search-results-message {
    margin-top: 10px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.search-result-count {
    margin: 0;
    font-weight: 600;
    color: #2196F3;
}

.search-result-count.no-results {
    color: #f44336;
}

/* 都道府県バッジ */
.prefecture-badge {
    background-color: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* 市区町村ラベル */
.city-label {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #666;
}

/* タブパネルの表示制御 */
.tab-panel {
    display: none;
    padding: 20px;
    background: white;
}

.tab-panel.active {
    display: block;
}

/* 結果なしメッセージ */
.no-results {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1rem;
}

/* 位置情報アイコンの修正 */
.gm-style img {
    max-width: none;
    max-height: none;
}

/* カスタムコントロールボタンのスタイル改善 */
.custom-map-control-button {
    background-color: #fff;
    border: 0;
    border-radius: 2px;
    box-shadow: 0 1px 4px -1px rgba(0,0,0,.3);
    margin: 10px;
    padding: 0 17px;
    font: 400 14px Arial,sans-serif;
    overflow: hidden;
    height: 40px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.custom-map-control-button:hover {
    background-color: #ebebeb;
}

/* インフォウィンドウのスタイル */
.info-window {
    min-width: 250px;
    max-width: 350px;
}

.info-window h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.2rem;
}

.info-window p {
    margin: 5px 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.info-window strong {
    color: #666;
}

/* マップメッセージ */
.map-message {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 10px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 1000;
    font-weight: 500;
    display: none;
}

.map-message.loading {
    background: #2196F3;
    color: white;
}

.map-message.success {
    background: #4CAF50;
    color: white;
}

.map-message.error {
    background: #f44336;
    color: white;
}

/* 地図の相対位置設定 */
.map-wrapper {
    position: relative;
}

/* グループ化された投票所一覧のスタイル */

/* リストサマリー */
.list-summary {
    background: #e3f2fd;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 1.1rem;
    text-align: center;
}

.list-summary strong {
    color: #1976d2;
    font-size: 1.3rem;
}

/* クイックジャンプメニュー */
.quick-jump-menu {
    position: sticky;
    top: 0;
    background: white;
    padding: 15px 20px;
    border-bottom: 2px solid #e0e0e0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.quick-jump-menu p {
    margin: 0;
    font-weight: 600;
}

.city-selector {
    flex: 1;
    max-width: 300px;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

/* 市区町村セクション */
.city-section {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    background: white;
}

.city-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.city-header:hover {
    background: #eeeeee;
}

.city-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.expand-icon {
    transition: transform 0.3s ease;
    color: #666;
}

.location-count {
    background: #1976d2;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 市区町村内の投票所リスト */
.city-locations {
    border-top: 1px solid #e0e0e0;
    max-height: 600px;
    overflow-y: auto;
}

/* グループ化された投票所アイテム */
.location-item-grouped {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.location-item-grouped:hover {
    background: #f8f9fa;
}

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

.location-main-info h4 {
    margin: 0 0 5px 0;
    font-size: 1.05rem;
    color: #333;
}

.location-main-info .address {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.location-sub-info {
    margin-top: 10px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #666;
}

.info-row svg {
    width: 16px;
    height: 16px;
    stroke: #999;
}

.location-actions {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.map-button,
.direction-button {
    padding: 8px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-button:hover {
    background: #e3f2fd;
    border-color: #2196F3;
}

.map-button:hover svg {
    stroke: #2196F3;
}

.direction-button:hover {
    background: #e8f5e9;
    border-color: #4CAF50;
}

.direction-button:hover svg {
    stroke: #4CAF50;
}

/* 検索結果ヘッダー */
.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fff3cd;
    border-radius: 8px;
    margin-bottom: 20px;
}

.search-results-header p {
    margin: 0;
    font-size: 1.1rem;
}

.clear-search {
    padding: 6px 16px;
    background: #f0ad4e;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.clear-search:hover {
    background: #ec971f;
}

/* ハイライト */
mark {
    background: #ffeb3b;
    padding: 2px 4px;
    border-radius: 2px;
}

/* スクロールバーのスタイリング */
.city-locations::-webkit-scrollbar {
    width: 8px;
}

.city-locations::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

.city-locations::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .location-item-grouped {
        grid-template-columns: 1fr;
    }
    
    .location-actions {
        margin-top: 10px;
    }
    
    .quick-jump-menu {
        flex-direction: column;
        align-items: stretch;
    }
    
    .city-selector {
        max-width: 100%;
    }
    
    .city-locations {
        max-height: 400px;
    }
}

/* 結果なしメッセージ */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-results p {
    font-size: 1.1rem;
    margin: 0;
}

/* 距離グループ表示用のスタイル */
.distance-grouped {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.distance-group-section {
    margin-bottom: 15px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.distance-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    background: #f5f5f5;
    transition: all 0.3s ease;
}

.distance-group-header:hover {
    background: #e8e8e8;
}

.distance-group-header.nearby {
    background: #e3f2fd;
    font-weight: 600;
}

.distance-group-header.nearby:hover {
    background: #bbdefb;
}

.distance-group-locations {
    padding: 0;
}

.nearby-item {
    background: #f3f8ff;
    border-left: 4px solid #2196F3;
}

.distance-badge {
    display: inline-block;
    background: #2196F3;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.info-row.highlight {
    margin-bottom: 8px;
}

/* メッセージ表示 */
.location-message {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 距離順リストのスタイル */
.distance-based-list {
    padding: 20px;
}

.distance-list-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
}

.distance-list-header h3 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
}

.distance-list-header p {
    margin: 0 0 15px 0;
    opacity: 0.9;
}

.back-to-all-button {
    background: white;
    color: #667eea;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-to-all-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.nearest-locations {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.location-item-distance {
    display: grid;
    grid-template-columns: 40px 1fr 100px auto;
    gap: 15px;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.location-item-distance:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.location-item-distance.nearby {
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.distance-rank {
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #666;
}

.location-item-distance.nearby .distance-rank {
    background: #2196F3;
    color: white;
}

.location-info-distance h4 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}

.location-info-distance .address {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.location-info-distance .hours {
    margin: 5px 0 0 0;
    color: #888;
    font-size: 0.85rem;
}

.location-distance {
    text-align: center;
}

.distance-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #666;
}

.nearby-distance {
    color: #2196F3;
}

.location-actions {
    display: flex;
    gap: 10px;
}

.location-actions button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-actions button:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .location-item-distance {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .distance-rank {
        display: none;
    }
    
    .location-distance {
        text-align: left;
    }
    
    .location-actions {
        justify-content: flex-start;
    }
}

