/* 薬の検索サイト風 - 検索画面デザイン */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
    background: #f8fafc;
    line-height: 1.6;
}

/* ヘッダー */
.search-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.header-left .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #2563eb;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 40px;
}

.header-search {
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: border-color 0.2s;
}

.search-input-wrapper:focus-within {
    border-color: #2563eb;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    font-size: 20px;
}

.header-search-input {
    flex: 1;
    padding: 12px 12px 12px 44px;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
}

.search-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: 0 10px 10px 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.search-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1744be 100%);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.header-right {
    display: flex;
    gap: 12px;
}

.location-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.location-btn:hover {
    background: #e2e8f0;
    color: #2563eb;
}

/* メインコンテンツ */
/* メインコンテンツ */
.main-content {
    display: flex;
    /* flex-direction: row-reverse; 削除: サイドバーを左側に戻す */
    height: calc(100vh - 64px);
}

/* サイドバー */
/* サイドバー */
.sidebar {
    width: 450px;
    height: 100%;
    /* 幅を広げて見やすくする */
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.05);
    /* サイドバーを浮き立たせる */
    background: #fff;
    border-right: 1px solid #e5e7eb;
    /* ボーダーを右側に戻す */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* サイドバー全体をスクロール可能にする */
    position: relative;
    z-index: 10;
}

.results-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
}

.results-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.results-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-count {
    color: #64748b;
    font-size: 15px;
    font-weight: 500;
}

.filter-badge {
    background: #fbbf24;
    color: #92400e;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* フィルター */
.filters {
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}

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

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.range-value {
    background: #2563eb;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.filter-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.filter-input:focus {
    outline: none;
    border-color: #2563eb;
}

.clear-btn {
    position: absolute;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.clear-btn .material-icons {
    font-size: 16px;
}

.filter-result {
    margin-top: 8px;
    font-size: 12px;
    color: #059669;
    background: #f0fdf4;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
}

.range-slider {
    width: 100%;
    height: 6px;
    border-radius: 10px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 12px 0;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    border: 2px solid #fff;
    transition: all 0.2s;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.2);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    transition: all 0.2s;
}

/* 検索結果リスト */
.results-list {
    /* flex: 1; 削除: 親のスクロールに任せる */
    /* overflow-y: auto; 削除 */
    padding: 0 24px 24px;
}

.result-card {
    background: #fff;
    border: 1px solid #eef2f6;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.result-card:hover {
    border-color: #2563eb;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.08);
    transform: translateY(-2px);
}

.result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.result-name {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    flex: 1;
    line-height: 1.4;
}

.result-distance {
    background: #f1f5f9;
    color: #64748b;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 12px;
    flex-shrink: 0;
}

.result-info {
    margin-bottom: 8px;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #2563eb;
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
}

.meta-icon {
    font-size: 14px;
}

.result-address,
.result-phone {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #64748b;
    margin-bottom: 4px;
}

.info-icon {
    font-size: 16px;
    color: #9ca3af;
}

.result-actions {
    display: flex;
    justify-content: flex-end;
}

.detail-btn {
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.detail-btn:hover {
    background: #1d4ed8;
}

/* 検索結果なし */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.no-results-icon {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.no-results-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.no-results-hint {
    font-size: 14px;
    color: #9ca3af;
}

/* 地図コンテナ */
.map-container {
    flex: 1;
    position: relative;
    background: #f0f0f0;
}

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

/* 現在地取得状態表示 */
.location-status {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    background: #2563eb;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    z-index: 1000;
    animation: pulse 2s infinite;
}

.status-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-icon {
    font-size: 18px;
    animation: spin 2s linear infinite;
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.9;
    }

    50% {
        opacity: 1;
    }
}

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #374151;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.detail-title .material-icons {
    font-size: 20px;
    color: #2563eb;
}

.detail-grid {
    display: grid;
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid #f8fafc;
}

.detail-item.full-width {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

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

.detail-label {
    font-weight: 500;
    color: #64748b;
    min-width: 80px;
}

.detail-item.full-width .detail-label {
    min-width: unset;
}

.detail-value {
    text-align: right;
    color: #1e293b;
    font-weight: 500;
    flex: 1;
    margin-left: 16px;
}

.detail-item.full-width .detail-value {
    text-align: left;
    margin-left: 0;
    width: 100%;
}

.detail-link {
    color: #2563eb;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.detail-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.detail-link .material-icons {
    font-size: 16px;
}

/* 診療科目・統計・ベッド内訳 */
.departments-list {
    font-size: 14px;
    color: #334155;
    line-height: 1.8;
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
}

.stats-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.detail-item.full-width .stats-list {
    justify-content: flex-start;
}

.stats-list span {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #475569;
}

.beds-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.beds-breakdown .badge {
    background: #eff6ff;
    color: #2563eb;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #dbeafe;
}

/* タグコンテナ */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    background: #f0fdf4;
    color: #166534;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #dcfce7;
}

.tag-item.secondary {
    background: #fdf2f8;
    color: #9d174d;
    border-color: #fce7f3;
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.no-data .material-icons {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 16px;
}

/* トースト通知 */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: #10b981;
    color: #fff;
}

.toast-error {
    background: #ef4444;
    color: #fff;
}

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

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 12px 20px;
        gap: 12px;
    }

    .header-center {
        margin: 0;
        max-width: none;
        width: 100%;
    }

    .main-content {
        flex-direction: column;
        height: calc(100vh - 120px);
    }

    .sidebar {
        width: 100%;
        height: 50vh;
        border-right: none;
        border-left: none;
        /* デスクトップ版の左ボーダーをリセット */
        border-bottom: 1px solid #e5e7eb;
    }

    .map-container {
        height: 50vh;
    }

    .location-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        height: 45vh;
    }

    .map-container {
        height: 55vh;
    }

    .result-card {
        padding: 12px;
    }

    .modal {
        width: 95%;
        margin: 20px;
    }
}

/* カテゴリフィルタ */
.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* カテゴリバッジ */
.result-name-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    width: fit-content;
}

.category-pharmacy {
    background: #dbeafe;
    color: #1d4ed8;
}

.category-hospital {
    background: #fee2e2;
    color: #dc2626;
}

.category-clinic {
    background: #d1fae5;
    color: #059669;
}

/* 診療科目タグ */
.departments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.department-tag {
    background: #f3f4f6;
    color: #374151;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

/* タグ内の値 */
.tag-value {
    font-size: 0.9em;
    opacity: 0.8;
    margin-left: 4px;
}

/* チェックボックスグループ */
.filter-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
}

.checkbox-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid transparent;
}

.checkbox-badge:hover {
    background: #e5e7eb;
}

.checkbox-badge.active {
    background: #3b82f6;
    color: #ffffff;
}

.checkbox-badge input[type="checkbox"] {
    display: none;
}

/* フィルタ切り替えボタン */
.filter-toggle-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.filter-toggle-btn:hover {
    background: #f1f5f9;
    color: #2563eb;
    transform: scale(1.1);
}

/* マーカーハイライト用 */
.marker-orange {
    filter: hue-rotate(160deg) saturate(1.5) brightness(0.9);
}