* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
    background-color: #f4f6f8;
    height: 100vh;
    overflow: hidden;
}

#app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* サイドバー */
#sidebar {
    width: 440px;
    height: 100%;
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}

header {
    padding: 16px;
    background-color: #1a365d;
    color: #ffffff;
}

header h1 {
    font-size: 1.1rem;
    font-weight: 700;
}

header .subtitle {
    font-size: 0.75rem;
    color: #cbd5e0;
    margin-top: 4px;
}

.panel {
    padding: 12px 16px;
    border-bottom: 1px solid #edf2f7;
}

#stats-panel {
    display: flex;
    gap: 8px;
    background-color: #f8fafc;
}

.stat-card {
    flex: 1;
    background: #ffffff;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.stat-card .stat-num {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
}

.stat-card .stat-label {
    font-size: 0.7rem;
    color: #718096;
}

.stat-card.confirmed .stat-num { color: #2b6cb0; }
.stat-card.review .stat-num { color: #dd6b20; }

.filter-group {
    margin-bottom: 8px;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.82rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background-color: #fff;
}

.filter-row {
    display: flex;
    gap: 8px;
}

.filter-row .filter-group {
    flex: 1;
}

.filter-group-checkbox {
    margin-top: 4px;
    margin-bottom: 8px;
    width: 100%;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: #2b6cb0 !important;
    background-color: #ebf8ff;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #bee3f8;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.checkbox-label:hover {
    background-color: #ebf8ff;
    border-color: #3182ce;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #3182ce;
}

.action-buttons {
    margin-top: 8px;
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-primary { background-color: #3182ce; color: #fff; }
.btn-primary:hover { background-color: #2b6cb0; }

.btn-success { background-color: #38a169; color: #fff; }
.btn-success:hover { background-color: #2f855a; }

.btn-warning { background-color: #dd6b20; color: #fff; }
.btn-warning:hover { background-color: #c05621; }

#list-header {
    padding: 8px 16px;
    background-color: #edf2f7;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
}

#store-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
}

.store-card {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
}

.store-card:hover {
    border-color: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.store-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.store-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a202c;
}

.store-yago {
    font-size: 0.75rem;
    color: #718096;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 4px;
    color: #fff;
}

.badge-CONFIRMED { background-color: #38a169; }
.badge-LIKELY { background-color: #3182ce; }
.badge-REVIEW { background-color: #dd6b20; }
.badge-UNKNOWN { background-color: #e53e3e; }
.badge-INVALID { background-color: #718096; }

.genre-tag {
    display: inline-block;
    background-color: #edf2f7;
    color: #2b6cb0;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    border: 1px solid #e2e8f0;
}

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: #d69e2e;
    font-size: 0.75rem;
    font-weight: 700;
}

.rating-badge .review-count {
    color: #718096;
    font-weight: 400;
    font-size: 0.7rem;
    margin-left: 2px;
}

.store-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #4a5568;
    margin-top: 4px;
}

.store-address {
    font-size: 0.8rem;
    color: #2d3748;
    margin-top: 4px;
    font-weight: 500;
}

/* 地図エリア */
#map-container {
    flex: 1;
    height: 100%;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* 現在地移動ボタン */
.location-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1000;
    background-color: #ffffff;
    color: #1a365d;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.location-btn:hover {
    background-color: #ebf8ff;
    color: #2b6cb0;
    transform: scale(1.04);
}

.location-btn:active {
    transform: scale(0.96);
}

.location-btn.locating {
    opacity: 0.7;
    cursor: wait;
}

/* 現在地パルスマーカー */
.user-location-pulse {
    width: 18px;
    height: 18px;
    background-color: #3182ce;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(49, 130, 206, 0.8);
    position: relative;
}

.user-location-pulse::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: rgba(49, 130, 206, 0.45);
    animation: pulse-wave 1.8s infinite ease-out;
}

@keyframes pulse-wave {
    0% {
        transform: scale(0.6);
        opacity: 0.9;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

/* Leaflet DivIcon スタイルリセット & マーカーピン + 店名ラベル定義 */
.leaflet-marker-icon.custom-div-icon,
.custom-div-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.marker-container {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.marker-pin {
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    flex-shrink: 0;
}

.marker-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #1a202c;
    background-color: rgba(255, 255, 255, 0.92);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #cbd5e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    line-height: 1.3;
    pointer-events: auto;
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #fff;
    width: 650px;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #a0aec0;
}

.modal-close:hover {
    color: #4a5568;
}

.modal-content h2 {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1.1rem;
    color: #1a202c;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.info-section {
    margin-bottom: 20px;
}

.info-section h3 {
    font-size: 0.9rem;
    color: #2b6cb0;
    border-bottom: 2px solid #bee3f8;
    padding-bottom: 4px;
    margin-bottom: 10px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.detail-table th,
.detail-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
}

.detail-table th {
    width: 140px;
    background-color: #f7fafc;
    color: #4a5568;
    font-weight: 600;
}

.detail-table td.highlight {
    font-weight: 700;
    color: #2b6cb0;
}

.evidence-box {
    max-height: 80px;
    overflow-y: auto;
    background-color: #f7fafc;
    padding: 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    white-space: pre-wrap;
}

.external-links {
    margin-top: 12px;
}

.edit-section {
    background-color: #fffaf0;
    border: 1px solid #feebc8;
    padding: 12px;
    border-radius: 6px;
}

.edit-section h3 {
    color: #c05621;
    border-bottom-color: #fbd38d;
}

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

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.85rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

/* ==========================================================================
   レスポンシブ (スマートフォン・タブレット) スタイル
   ========================================================================== */

/* デスクトップ表示時はモバイル専用要素を非表示 */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* スマホ・スモールタブレット向け (画面幅 768px 以下) */
@media (max-width: 768px) {
    body {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    #app-container {
        position: relative;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    /* 地図エリア: スマホでは常に全画面表示 */
    #map-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
    }

    /* 現在地ボタン: 右上に固定 */
    .location-btn {
        top: 12px;
        right: 12px;
        padding: 8px 12px;
        font-size: 0.8rem;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }

    /* サイドバー (検索・フィルタ・リスト): 下からスライドインするレイアウト */
    #sidebar {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        z-index: 1000;
        background-color: #ffffff;
        border-right: none;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        flex-direction: column;
    }

    /* サイドバー開いた状態 */
    #app-container.show-mobile-list #sidebar {
        transform: translateY(0);
    }

    /* スマホヘッダーレイアウト */
    header {
        padding: 10px 14px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-shrink: 0;
    }

    header h1 {
        font-size: 0.95rem;
        line-height: 1.2;
    }

    header .subtitle {
        display: none;
    }

    .mobile-header-btn {
        background-color: #3182ce;
        color: #ffffff;
        border: none;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 0.78rem;
        font-weight: 700;
        cursor: pointer;
        white-space: nowrap;
        box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }

    /* 統計パネル: スマホでは省スペース化 */
    #stats-panel {
        padding: 6px 10px;
        gap: 6px;
        flex-shrink: 0;
    }

    .stat-card {
        padding: 4px 6px;
    }

    .stat-card .stat-num {
        font-size: 0.95rem;
    }

    .stat-card .stat-label {
        font-size: 0.65rem;
    }

    /* フィルタパネル: スクロール可能・省スペース */
    #filter-panel {
        padding: 10px 12px;
        max-height: 38vh;
        overflow-y: auto;
        flex-shrink: 0;
    }

    .filter-group label {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }

    .filter-group input,
    .filter-group select {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    #list-header {
        padding: 6px 12px;
        font-size: 0.78rem;
        flex-shrink: 0;
    }

    #store-list {
        flex: 1;
        overflow-y: auto;
        padding: 8px 12px;
        -webkit-overflow-scrolling: touch;
    }

    /* 店舗カードのスマホ調整 */
    .store-card {
        padding: 12px;
        margin-bottom: 10px;
    }

    .store-name {
        font-size: 0.95rem;
    }

    /* モバイル フローティングナビゲーションボタン */
    #mobile-floating-bar {
        position: fixed;
        bottom: 24px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1100;
        pointer-events: auto;
    }

    .btn-mobile-toggle {
        background-color: #1a365d;
        color: #ffffff;
        border: 2px solid #ffffff;
        padding: 12px 22px;
        border-radius: 30px;
        font-size: 0.92rem;
        font-weight: 700;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
        transition: background-color 0.2s, transform 0.1s;
    }

    .btn-mobile-toggle:active {
        transform: scale(0.96);
        background-color: #2b6cb0;
    }

    /* スマホ詳細モーダル調整 */
    .modal-content {
        width: 94vw;
        max-width: 94vw;
        max-height: 85vh;
        border-radius: 12px;
    }

    .modal-content h2 {
        padding: 12px 16px;
        font-size: 1rem;
        padding-right: 40px;
    }

    .modal-body {
        padding: 14px;
    }

    .detail-table th {
        width: 95px;
        font-size: 0.78rem;
        padding: 6px 6px;
    }

    .detail-table td {
        font-size: 0.8rem;
        padding: 6px 6px;
    }
}
