/* 全体のスタイル */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans JP', sans-serif;
}

:root {
    --primary-color: #D32F2F;
    --primary-dark: #9A0007;
    --primary-light: #FF6659;
    --accent-color: #FF9800;
    --text-on-primary: #FFFFFF;
    --text-primary: #212121;
    --text-secondary: #757575;
    --background-color: #F5F5F5;
    --card-color: #FFFFFF;
    --border-radius: 8px;
    --shadow-small: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-large: 0 8px 16px rgba(0, 0, 0, 0.14);
    --transition-speed: 0.3s;
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    color: var(--text-primary);
    background-color: var(--background-color);
}

/* 地図コンテナ */
#map-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* オーバーレイパネルの共通スタイル */
.overlay-panel {
    position: absolute;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    backdrop-filter: blur(5px);
    padding: 1rem;
    transition: all var(--transition-speed);
}

/* 検索パネル */
.search-panel {
    bottom: 1rem;
    left: 1rem;
    right: 5rem;
    max-width: 600px;
    margin: 0 auto 0 0;
    top: auto;
}

.app-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    text-align: center;
    color: var(--primary-color);
}

.search-container {
    display: flex;
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none; /* アイコンがクリックを妨げないように */
}

#search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all var(--transition-speed);
}

#search-input:focus {
    outline: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    background-color: var(--accent-color);
    color: var(--text-on-primary);
    border: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.search-button:hover {
    background-color: #F57C00;
}

/* アクションボタンパネル */
.action-panel {
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background-color: transparent;
    box-shadow: none;
    z-index: 20;
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: white;
    color: var(--primary-dark);
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.icon-button:hover {
    background-color: #f5f5f5;
    transform: translateY(-2px);
}

.icon-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-small);
}

.icon-button:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

.icon-button .material-icons {
    font-size: 20px;
}

.icon-button.updating .material-icons {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* バージョン情報パネル */
.version-panel {
    bottom: 1rem;
    left: 1rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

.version-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.copyright {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    opacity: 0.8;
}

/* Google Mapsカスタムコントロール */
.custom-map-control {
    background-color: #fff;
    border: none;
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    margin: 10px;
    padding: 8px 12px;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.custom-map-control:hover {
    background-color: #f5f5f5;
    color: #333;
}

.update-icon {
    font-size: 1.2rem;
    margin-right: 0.3rem;
}

.version-info {
    font-size: 0.8rem;
    color: #666;
}

/* 地図 */
#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* メインコンテンツ */
main {
    flex: 1;
    position: relative;
}

/* 神社詳細パネル */
.shrine-details-panel {
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 20;
    transition: all var(--transition-speed);
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-large);
}

.shrine-details-panel.hidden {
    display: none;
    opacity: 0;
    transform: translate(-50%, 20px);
}

.close-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color var(--transition-speed);
}

.close-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

#shrine-name {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    padding-right: 2rem;
}

#shrine-address {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    display: flex;
    align-items: flex-start;
}

#shrine-address::before {
    content: '\e55f'; /* location_on icon */
    font-family: 'Material Icons';
    margin-right: 0.5rem;
    color: var(--primary-color);
}

#shrine-history, #shrine-deities {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    border-left: 3px solid var(--primary-light);
    padding-left: 1rem;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(211, 47, 47, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-small);
}

#loading p {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}

.error-message {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 80%;
}

.error-message p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4a8f53;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* レスポンシブデザインの調整 */
@media (min-width: 768px) {
    .search-panel {
        max-width: 500px;
        left: 1rem;
        right: auto;
    }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.2rem;
    }
    
    /* 検索パネルの調整 */
    .search-panel {
        top: auto;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        width: auto;
        max-width: none;
        padding: 0;
        background: none;
        box-shadow: none;
    }
    
    /* 検索入力フィールドの調整 */
    .search-container {
        flex-direction: column;
    }
    
    #search-input {
        border-radius: 24px;
        margin-bottom: 0;
        padding: 0.75rem 1rem 0.75rem 3rem;
        font-size: 1rem;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    /* 検索アイコンの位置調整 */
    .search-icon {
        left: 1.2rem;
    }
    
    /* アクションボタンの調整 */
    .action-panel {
        top: 1rem;
        right: 1rem;
        bottom: auto;
        padding: 0;
        background: none;
        backdrop-filter: none;
    }
    
    .icon-button {
        width: 44px;
        height: 44px;
        background-color: white;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    /* バージョン情報パネルの調整 */
    .version-panel {
        left: 50%;
        transform: translateX(-50%);
        bottom: 5.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.7rem;
        text-align: center;
        background-color: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(5px);
        border-radius: 20px;
    }
}

/* マーカーのカスタムスタイル */
.shrine-marker {
    border-radius: 50%;
    border: 2px solid white;
    /* margin-left: -6px; */
    /* margin-top: -6px; */
    background-color: white;
}

.shrine-marker.important {
    margin-left: -8px;
    margin-top: -8px;
}

/* ポップアップのスタイル */
.leaflet-popup-content-wrapper {
    border-radius: 4px;
}

.leaflet-popup-content {
    margin: 8px;
}

.shrine-popup h3 {
    margin: 0 0 5px 0;
    color: #4a8f53;
}

.shrine-popup p {
    margin: 0;
    font-size: 0.9rem;
}

.shrine-popup .view-details {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    background-color: #4a8f53;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.8rem;
}
