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

body {
    font-family: "Zen Maru Gothic", serif;
    line-height: 1.5;
    color: #333;
    min-height: 100vh;
}

.clinic-container {
    max-width: 400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.4s ease;
}

.clinic-list-bg {
    background: #ecf5b8;
    font-family: "Zen Maru Gothic", serif;
}

.clinic-main-button {
    background: linear-gradient(45deg, #2196f3 0%, #21cbf3 100%);
    color: white;
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
    font-size: 20px;
    font-weight: 600;
    /* モバイル対応の追加 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

.clinic-main-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

.clinic-main-button:hover,
.clinic-main-button:active {
    background: linear-gradient(45deg, #1976d2 0%, #1ba1d2 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.3);
}

.clinic-button-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.clinic-toggle-arrow {
    font-size: 27px;
    transition: transform 0.4s ease;
}

.clinic-container.expanded .clinic-toggle-arrow {
    transform: rotate(180deg);
}

.clinic-finder {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.clinic-container.expanded .clinic-finder {
    max-height: 500px;
}

.clinic-search-container {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.4s ease 0.1s;
}

.clinic-container.expanded .clinic-search-container {
    opacity: 1;
    transform: translateY(0);
}

.clinic-search-box {
    position: relative;
}

.clinic-search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 15px;
    background: white;
    transition: all 0.3s ease;
    /* モバイル対応の追加 */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}

.clinic-search-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.clinic-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 15px;
}

/* clinic-list.css の .clinic-content の部分を以下に置き換えてください */

.clinic-content {
    max-height: 350px; /* 初期値：JSで動的に変更される */
    overflow-y: auto;
    padding: 20px 20px 20px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.4s ease 0.2s, max-height 0.3s ease; /* max-heightのトランジションを追加 */
}

.clinic-container.expanded .clinic-content {
    opacity: 1;
    transform: translateY(0);
}

/* スクロールバーのスタイリングを改善 */
.clinic-content::-webkit-scrollbar {
    width: 8px; /* 少し太くして操作しやすく */
}

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

.clinic-content::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #2196f3, #21cbf3);
    border-radius: 4px;
    border: 1px solid #e9ecef; /* 境界線を追加 */
}

.clinic-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #1976d2, #1ba1d2);
}

/* モバイル用の追加スタイル */
@media (max-width: 480px) {
    .clinic-content {
        padding: 15px 15px 20px;
        /* モバイルでは画面の80%まで使用可能 */
        max-height: 80vh;
    }
    
    /* モバイルでのスクロールバーを細く */
    .clinic-content::-webkit-scrollbar {
        width: 6px;
    }
}

.clinic-container.expanded .clinic-content {
    opacity: 1;
    transform: translateY(0);
}

/* 地方レベルのスクロール機能追加 */
.clinic-region {
    margin-bottom: 20px;
    /* 地方の最大高さを制限 */
    max-height: none; /* デフォルト状態 */
    transition: max-height 0.3s ease;
}

/* 地方が展開されている時の高さ制限 */
.clinic-region:not(.collapsed) {
    max-height: 300px; /* 地方単位での最大高さ */
}

/* 地方の都道府県リストにスクロール機能を追加 */
.clinic-prefecture-list {
    display: block;
    transition: all 0.3s ease;
    max-height: 1000px;
    overflow: hidden;
    /* 地方が展開時にスクロール可能にする */
}

.clinic-region:not(.collapsed) .clinic-prefecture-list {
    max-height: 250px; /* 都道府県リストの最大高さ */
    overflow-y: auto; /* 縦スクロールを有効化 */
    padding-right: 5px; /* スクロールバー分の余白 */
}

/* 地方レベルのスクロールバーのスタイリング */
.clinic-region:not(.collapsed) .clinic-prefecture-list::-webkit-scrollbar {
    width: 6px;
}

.clinic-region:not(.collapsed) .clinic-prefecture-list::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.clinic-region:not(.collapsed) .clinic-prefecture-list::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #f8bbd9, #fce4ec);
    border-radius: 3px;
}

.clinic-region:not(.collapsed) .clinic-prefecture-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #f48fb1, #f8bbd9);
}

/* モバイル対応の調整 */
@media (max-width: 480px) {
    .clinic-region:not(.collapsed) {
        max-height: 280px; /* モバイルでは少し低めに */
    }
    
    .clinic-region:not(.collapsed) .clinic-prefecture-list {
        max-height: 230px;
    }
}

.clinic-region-header {
    background: linear-gradient(90deg, #fce4ec 0%, #f8bbd9 100%);
    color: #ad1457;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(248, 187, 217, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* モバイル対応の追加 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.clinic-region-header:hover,
.clinic-region-header:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(248, 187, 217, 0.4);
}

.clinic-region-toggle-icon {
    transition: transform 0.3s ease;
}

.clinic-region.collapsed .clinic-region-toggle-icon {
    transform: rotate(180deg);
}

.clinic-prefecture-list {
    display: block;
    transition: all 0.3s ease;
    max-height: 1000px;
    overflow: hidden;
}

.clinic-region.collapsed .clinic-prefecture-list {
    max-height: 0;
    opacity: 0;
}

.clinic-prefecture {
    background: white;
    margin: 8px 0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.clinic-prefecture:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.clinic-prefecture-name {
    font-weight: 600;
    padding: 12px 16px;
    background: #e3f2fd;
    color: #2c3e50;
    border-radius: 10px 10px 0 0;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* モバイル対応の追加 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.clinic-prefecture-name:hover,
.clinic-prefecture-name:active {
    background: #bbdefb;
}

.clinic-prefecture-toggle-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.clinic-prefecture.collapsed .clinic-prefecture-toggle-icon {
    transform: rotate(180deg);
}

.clinic-list {
    padding: 12px 16px;
    transition: all 0.3s ease;
    max-height: 1000px;
    overflow: hidden;
}

.clinic-prefecture.collapsed .clinic-list {
    max-height: 0;
    opacity: 0;
    padding: 0 16px;
}

.clinic-item {
    margin: 6px 0;
    padding: 8px 12px;
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.05) 0%, rgba(33, 203, 243, 0.05) 100%);
    border-radius: 8px;
    font-size: 15px;
    color: #555;
    border-left: 3px solid #2196f3;
    transition: all 0.2s ease;
}

.clinic-item:hover {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.1) 0%, rgba(33, 203, 243, 0.1) 100%);
    transform: translateX(3px);
}

.clinic-station-info {
    color: #6c757d;
    font-size: 13px;
    margin-top: 5px;
}

.clinic-station-item {
    display: block;
    margin: 4px 0;
    padding-left: 15px;
    position: relative;
}

.clinic-station-item:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #2196f3;
    font-weight: bold;
}

.clinic-no-clinics {
    color: #999;
    font-style: italic;
    padding: 8px 16px;
    font-size: 13px;
}

.clinic-prefecture.no-clinic-prefecture .clinic-prefecture-name {
    background: #f5f5f5;
    color: #666;
}

.clinic-prefecture.no-clinic-prefecture:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.clinic-stats {
    background: #21cbf3;
    color: white;
    padding: 15px 20px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.4s ease 0.3s;
}

.clinic-container.expanded .clinic-stats {
    opacity: 1;
    transform: translateY(0);
}

.clinic-content::-webkit-scrollbar {
    width: 6px;
}

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

.clinic-content::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #2196f3, #21cbf3);
    border-radius: 3px;
}

.clinic-hidden {
    display: none !important;
}

.clinic-container:not(.expanded) {
    border-radius: 15px;
}

.clinic-container:not(.expanded) .clinic-main-button {
    border-radius: 15px;
}

@media (max-width: 480px) {
    .clinic-container {
        margin: 10px;
        max-width: none;
    }
    
    .clinic-main-button {
        padding: 20px 15px;
        font-size: 17px;
    }
    
    .clinic-content {
        padding: 0 15px 15px;
    }
    
    /* モバイル用の追加スタイル */
    .clinic-main-button:active {
        transform: scale(0.98);
    }
    
    .clinic-region-header:active {
        transform: scale(0.98);
    }
    
    .clinic-prefecture-name:active {
        transform: scale(0.98);
    }
}