/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* Header styles */
header {
    background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-bottom: 2rem;
    border-radius: 0 0 20px 20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

header h1:hover {
    transform: translateY(-2px);
    text-shadow: 2px 4px 8px rgba(0,0,0,0.4);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Search section */
.search-section {
    margin-bottom: 2rem;
}

.search-container {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

#addressInput {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

#addressInput:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

#searchBtn {
    padding: 12px 25px;
    background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

#searchBtn:active {
    transform: translateY(0);
}

.loading {
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
    color: #666;
}

.hidden {
    display: none;
}

/* Results section */
.results-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: start;
}

.map-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 500px;
    height: fit-content;
}

#map {
    height: 500px;
    min-height: 500px;
    width: 100%;
}

/* 高いコンテンツに合わせて地図エリアを調整 */
@media (min-width: 768px) {
    .map-container {
        height: calc(100vh - 300px);
        max-height: 800px;
        min-height: 500px;
    }

    #map {
        height: 100%;
        min-height: 500px;
    }
}

.info-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Panel styles */
.results-panel, .zoning-panel, .error-panel, .stats-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.results-panel h3, .zoning-panel h3, .error-panel h3, .stats-panel h3 {
    color: #2e7d32;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
}

.result-item {
    margin-bottom: 0.8rem;
}

.result-item label {
    font-weight: bold;
    color: #555;
    display: inline-block;
    min-width: 60px;
}

.result-item span {
    color: #333;
}

/* Zoning info styles */
.zoning-info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.zoning-info-label {
    font-weight: bold;
    color: #555;
}

.zoning-info-value {
    color: #333;
    text-align: right;
}

/* Error panel */
.error-panel {
    border-left: 4px solid #e74c3c;
}

.error-panel h3 {
    color: #e74c3c;
}

.error-suggestions {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff3e0;
    border: 1px solid #ff9800;
    border-radius: 4px;
    color: #e65100;
}

.error-suggestions p {
    margin: 0 0 0.5rem 0;
    font-weight: bold;
}

.error-suggestions ul {
    margin: 0;
    padding-left: 1.5rem;
}

.error-suggestions li {
    margin: 0.3rem 0;
    line-height: 1.4;
}

/* Stats panel */
.stats-panel {
    border-left: 4px solid #27ae60;
}

.stats-panel h3 {
    color: #27ae60;
}

/* Data source panel */
.data-source-panel {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.data-source-panel h3 {
    color: #495057;
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.data-source-panel p {
    margin: 0.3rem 0;
    line-height: 1.4;
}

.data-source-panel a {
    color: #007bff;
    text-decoration: none;
    word-break: break-all;
}

.data-source-panel a:hover {
    text-decoration: underline;
}

.data-note {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.stats-label {
    color: #555;
}

.stats-value {
    font-weight: bold;
    color: #27ae60;
}

/* Zoning type colors */
.zoning-commercial {
    background-color: #e74c3c;
    color: white;
}

.zoning-residential {
    background-color: #2ecc71;
    color: white;
}

.zoning-industrial {
    background-color: #f39c12;
    color: white;
}

.zoning-mixed {
    background-color: #9b59b6;
    color: white;
}

.zoning-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: bold;
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    border-radius: 20px 20px 0 0;
    margin-top: 2rem;
}

footer a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: white;
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .search-container {
        flex-direction: column;
    }

    .results-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* モバイル用：地図と結果を縦積み、地図の高さを削減 */
    .map-container {
        order: 2;
        min-height: auto;
    }

    .info-panel {
        order: 1;
    }

    #map {
        height: 250px;
        min-height: 250px;
    }

    /* モバイルでは地図エリアのmax-heightを無効化 */
    .map-container {
        height: auto;
        max-height: none;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    header p {
        font-size: 1rem;
    }

    #addressInput, #searchBtn {
        font-size: 14px;
    }

    /* 小さなスマホでは地図をさらに縮小 */
    #map {
        height: 200px;
        min-height: 200px;
    }

    /* パネルのパディングを削減してコンテンツを効率化 */
    .results-panel, .zoning-panel, .error-panel, .stats-panel {
        padding: 1rem;
    }

    /* ヘッダーのパディングを削減 */
    header {
        padding: 1.5rem 0;
        margin-bottom: 1rem;
    }
}