/* リセットCSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本設定 */
body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    flex: 1;
}

.current-time {
    font-size: 1.2rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 120px;
    text-align: center;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.language-selector {
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

.city-select {
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.city-select option {
    background: #667eea;
    color: white;
}

/* メインコンテンツ */
.main {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* カレンダーセクション */
.calendar-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

.date-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.year-select, .month-select {
    padding: 8px 12px;
    border: 2px solid #667eea;
    background: white;
    color: #333;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 80px;
}

.year-select:hover, .month-select:hover {
    background: #f0f8ff;
    border-color: #5a6fd8;
}

.year-select:focus, .month-select:focus {
    outline: none;
    border-color: #5a6fd8;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.nav-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.nav-btn:hover {
    background: #667eea;
    color: white;
}

.month-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #333;
}

/* カレンダーグリッド */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.day-header {
    background: #f5f5f5;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.calendar-day {
    background: white;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    position: relative;
}

.calendar-day:hover {
    background: #f0f8ff;
}

.calendar-day.other-month {
    background: #f8f9fa;
    color: #999;
}

.calendar-day.today {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

.calendar-day.saturday {
    background: #e8f5e8;
    color: #006400;
}

.calendar-day.sunday {
    background: #ffe8e8;
    color: #cc0000;
}

.calendar-day.holiday {
    background: #ffe8e8;
    color: #cc0000;
}

.day-number {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.rokuyo {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.8;
    margin-bottom: 2px;
}

.weather-icon {
    font-size: 12px;
    margin-top: auto;
}

.temperature {
    font-size: 10px;
    font-weight: 500;
}

/* 天気セクション */
.weather-section {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 横スクロール時のオーバーフローを制御 */
}

.weather-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.weather-info {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.current-weather {
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    border-radius: 8px;
    flex-shrink: 0;
}

.today-weather-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
    text-align: center;
}

.weather-icon-large {
    font-size: 3rem;
    margin-bottom: 10px;
}

.current-temp {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.today-max-min {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.weather-description {
    font-size: 1rem;
    opacity: 0.9;
}

.forecast {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-height: 360px; /* 7日間天気予報の最小高さを設定 */
    max-height: 360px; /* 7日間天気予報の最大高さを設定 */
    overflow-y: hidden; /* デフォルトでは縦スクロールを非表示 */
}

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

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

.forecast-date {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.forecast-weather {
    font-size: 16px;
    margin: 0 10px;
}

.forecast-temps {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* 7日間天気予報の土日の色設定 */
.forecast-item.saturday {
    background: #e8f5e8;
    color: #006400;
    border-radius: 6px;
    margin: 2px 0;
}

.forecast-item.sunday {
    background: #ffe8e8;
    color: #cc0000;
    border-radius: 6px;
    margin: 2px 0;
}

.forecast-item.saturday .forecast-date,
.forecast-item.saturday .forecast-weather,
.forecast-item.saturday .forecast-temps {
    color: #006400;
}

.forecast-item.sunday .forecast-date,
.forecast-item.sunday .forecast-weather,
.forecast-item.sunday .forecast-temps {
    color: #cc0000;
}

/* 広告セクション */
.ads-container {
    margin: 30px 0;
}

.ad-banner {
    width: 100%;
    max-width: 728px;
    margin: 20px auto;
    text-align: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-header {
    margin-top: 0;
    margin-bottom: 30px;
    min-height: 90px;
    min-width: 728px;
    width: 100%;
    max-width: 728px;
}


.ad-sidebar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    z-index: 1000;
}

.ad-unit {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    min-height: 250px;
    min-width: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ad-vertical {
    width: 300px;
    min-height: 250px;
    max-width: 300px;
    max-height: 600px;
}

/* 広告プレースホルダー */
.adsbygoogle:empty::before {
    content: "広告スペース";
    color: #6c757d;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
}

/* コンテンツページ */
.content-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    line-height: 1.8;
}

.content-section h2 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 10px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.content-section h3 {
    color: #667eea;
    font-size: 1.4rem;
    margin-top: 30px;
    margin-bottom: 15px;
}

.content-section p {
    margin-bottom: 15px;
    color: #555;
}

.content-section ul {
    margin-bottom: 15px;
    padding-left: 20px;
}

.content-section li {
    margin-bottom: 8px;
    color: #555;
}

.last-updated {
    color: #888;
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 30px;
}

.content-section a {
    color: #667eea;
    text-decoration: none;
}

.content-section a:hover {
    text-decoration: underline;
}

/* フッター */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    margin: 0 5px;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* PC表示用の調整 */
@media (min-width: 769px) {
    .current-weather {
        padding: 10px; /* パディングをさらに縮小 */
        margin-bottom: 10px; /* マージンをさらに縮小 */
    }
    
    .today-weather-label {
        font-size: 0.9rem; /* フォントサイズをさらに縮小 */
        margin-bottom: 4px; /* マージンをさらに縮小 */
    }
    
    .weather-icon-large {
        font-size: 2rem; /* アイコンサイズをさらに縮小 */
        margin-bottom: 6px; /* マージンをさらに縮小 */
    }
    
    .current-temp {
        font-size: 1.5rem; /* フォントサイズをさらに縮小 */
        margin-bottom: 3px; /* マージンをさらに縮小 */
    }
    
    .today-max-min {
        font-size: 1rem; /* フォントサイズをさらに縮小 */
        margin-bottom: 4px; /* マージンをさらに縮小 */
    }
    
    .weather-description {
        font-size: 0.8rem; /* フォントサイズをさらに縮小 */
        margin-bottom: 6px; /* マージンを縮小 */
    }
    
    /* 都市名のスタイルも調整 */
    .current-weather div[style*="margin-top: 10px"] {
        margin-top: 6px !important;
        font-size: 12px !important;
    }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-top {
        flex-direction: column;
        gap: 12px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .current-time {
        font-size: 1rem;
        min-width: 100px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .language-selector {
        justify-content: center;
    }
    
    .main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .weather-section {
        height: auto;
        min-height: 400px;
    }
    
    .ad-sidebar {
        display: none;
    }
    
    .ad-banner {
        max-width: 100%;
        min-height: 50px;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 8px 4px;
    }
    
    .day-number {
        font-size: 14px;
    }
    
    .rokuyo {
        font-size: 10px;
    }
    
    .weather-icon {
        font-size: 10px;
    }
    
    .temperature {
        font-size: 9px;
    }
    
    .month-title {
        font-size: 1.4rem;
    }
    
    .nav-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .date-selector {
        flex-direction: column;
        gap: 8px;
    }
    
    .year-select, .month-select {
        font-size: 14px;
        padding: 6px 10px;
        min-width: 70px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.6rem;
    }
    
    .current-time {
        font-size: 0.9rem;
        min-width: 80px;
    }
    
    .ad-banner {
        min-height: 50px;
        padding: 5px;
    }
    
    .year-select, .month-select {
        font-size: 12px;
        padding: 4px 8px;
        min-width: 60px;
    }
    
    .calendar-day {
        min-height: 50px;
        padding: 6px 2px;
    }
    
    .day-number {
        font-size: 12px;
    }
    
    .rokuyo {
        font-size: 9px;
    }
    
    .weather-icon {
        font-size: 9px;
    }
    
    .temperature {
        font-size: 8px;
    }
    
    .day-header {
        padding: 8px 4px;
        font-size: 12px;
    }
}

/* ローディングアニメーション */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* エラーメッセージ */
.error-message {
    color: #e74c3c;
    text-align: center;
    padding: 10px;
    background: #fdf2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    margin: 10px 0;
}

/* 成功メッセージ */
.success-message {
    color: #27ae60;
    text-align: center;
    padding: 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    margin: 10px 0;
}

/* 時間ごとの天気予報 */
.hourly-weather-section {
    margin-top: 20px;
    padding-top: 20px;
    max-height: 220px; /* 高さを調整 */
    overflow: hidden; /* 縦方向のオーバーフローを制御 */
}

.hourly-title {
    color: #333;
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.hourly-forecast {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: #667eea #f1f1f1;
    scroll-behavior: smooth;
}

.hourly-forecast::-webkit-scrollbar {
    height: 6px;
}

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

.hourly-forecast::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.hourly-forecast::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

.hourly-item {
    min-width: 80px;
    text-align: center;
    padding: 16px 10px;
    background: #f8f9ff;
    border-radius: 8px;
    border: 1px solid #e0e7ff;
    flex-shrink: 0;
}

.hourly-item .time {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.hourly-item .weather {
    font-size: 1.2rem;
    margin: 5px 0;
}

.hourly-item .temp {
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
}

.hourly-item .precipitation {
    font-size: 0.7rem;
    color: #666;
    margin-top: 4px;
}

/* 過去の時間のスタイル */
.hourly-item.past {
    background: #f5f5f5;
    border-color: #ddd;
    opacity: 0.7;
}

.hourly-item.past .time,
.hourly-item.past .temp,
.hourly-item.past .precipitation {
    color: #999;
}

.hourly-item.past .weather {
    opacity: 0.6;
}

/* 現在時刻のスタイル */
.hourly-item.current {
    background: #e3f2fd;
    border-color: #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.hourly-item.current .time {
    color: #1976d2;
    font-weight: 600;
}

/* 時間ごとの天気予報のレスポンシブ対応 */
@media (max-width: 768px) {
    .forecast {
        min-height: 250px; /* 7日間天気予報の最小高さを調整 */
        max-height: 250px; /* 7日間天気予報の最大高さを調整 */
        overflow-y: auto; /* タブレットでは縦スクロールを有効 */
    }
    
    .hourly-weather-section {
        max-height: 200px; /* 48時間天気予報の高さを拡大 */
    }
    
    .hourly-item {
        min-width: 70px;
        padding: 10px 8px;
    }
    
    .hourly-item .time {
        font-size: 0.7rem;
    }
    
    .hourly-item .weather {
        font-size: 1.1rem;
    }
    
    .hourly-item .temp {
        font-size: 0.8rem;
    }
    
    .hourly-item .precipitation {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 5px; /* モバイルでヘッダーをさらに狭く */
    }
    
    .header-top {
        margin-bottom: 6px; /* ヘッダー内要素のマージンをさらに縮小 */
    }
    
    .calendar-section {
        margin-bottom: 15px; /* カレンダーセクションの下マージンを追加 */
    }
    
    .day-cell {
        min-height: 45px; /* カレンダーの日付セルの高さを拡大 */
        padding: 8px 4px; /* パディングを調整 */
    }
    
    .forecast {
        min-height: 380px; /* 7日間天気予報の最小高さを調整 */
        max-height: 380px; /* 7日間天気予報の最大高さを調整 */
        overflow-y: auto; /* スマホでは縦スクロールを有効 */
    }
    
    .hourly-weather-section {
        max-height: 200px; /* 48時間天気予報の高さを拡大 */
    }
    
    .hourly-item {
        min-width: 60px;
        padding: 14px 6px;
    }
    
    .hourly-title {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    .hourly-item .time {
        font-size: 0.65rem;
    }
    
    .hourly-item .weather {
        font-size: 1rem;
    }
    
    .hourly-item .temp {
        font-size: 0.75rem;
    }
    
    .hourly-item .precipitation {
        font-size: 0.55rem;
    }
}

/* エラーメッセージ */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    text-align: center;
    font-size: 14px;
    margin: 10px 0;
}
