/* Reset & Base Styles */
body, h1, h2, p, ul, li, button {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f7f6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

/* Header */
header {
    background-color: #003366;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.header-banner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.header-message {
    position: absolute;
    top: 10px;
    right: 30px;
    background-color: rgba(0, 51, 102, 0.85);
    color: #fff;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.95em;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 10;
    letter-spacing: 0.5px;
}

.header-banner-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Responsive Design for header banner */
@media (max-width: 768px) {
    header {
        padding: 15px 0;
    }
    
    .header-banner {
        padding: 0 10px;
    }
    
    .header-message {
        position: static;
        margin-bottom: 10px;
        font-size: 0.85em;
        padding: 6px 12px;
    }
    
    .header-banner-image {
        border-radius: 4px;
    }
}

/* Navigation Tabs */
.tabs {
    display: flex;
    justify-content: center;
    background-color: #0055a4;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tab-button {
    background-color: transparent;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    outline: none;
    position: relative;
}

.tab-button:hover {
    background-color: #004488;
}

.tab-button.active {
    background-color: #003366;
    font-weight: bold;
    border-bottom: 4px solid #ffd700;
    transform: translateY(-2px);
}

/* Main Content */
main.tab-content {
    flex-grow: 1;
    padding: 30px 20px;
    max-width: 1200px;
    margin: 20px auto;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.tab-pane {
    display: none;
    padding: 20px;
    animation: fadeIn 0.5s ease-in-out;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-pane h2 {
    color: #003366;
    font-size: 2em;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.tab-pane p {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 20px;
}

/* Footer */
footer {
    background-color: #003366;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.2);
}

/* Infographics Elements */
.infographic-block {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;  /* flex-start から center に変更 */
}

.infographic-block .icon {
    font-size: 1.2em;
    color: #0055a4;
    margin-right: 15px;
    flex-shrink: 0;
    min-width: 25px;
    line-height: 1.2;  /* line-height を追加 */
}

.infographic-block .text-content h3 {
    color: #003366;
    margin-bottom: 5px;
    font-size: 1.2em;
}

.infographic-block .text-content p {
    font-size: 1em;
    color: #666;
}

.content-image {
    max-width: 500px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Image Container for side-by-side layout */
.image-container {
    display: flex;
    gap: 20px;
    margin: 20px 0 30px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.image-container .content-image {
    flex: 1;
    min-width: 280px;
    max-width: calc(50% - 10px);
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
}

/* Responsive Design for image container */
@media (max-width: 768px) {
    .image-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .image-container .content-image {
        max-width: 100%;
        min-width: 100%;
    }
}

/* Hero Styles */
.hero-section {
    position: relative;
    height: 400px;
    max-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    overflow: hidden;
}

.hero-background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    filter: brightness(0.7);
}

.hero-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 51, 102, 0.5);
    z-index: -1;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-content h1 {
    font-size: 3.5em;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

.hero-content p {
    font-size: 1.4em;
    opacity: 0.95;
    text-shadow: 1px 1px 6px rgba(0,0,0,0.7);
}

/* Responsive Design */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }

    .tab-button {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .tab-button.active {
        border-bottom: 4px solid #ffd700;
    }

    .hero-content h1 {
        font-size: 2.2em;
    }
}

/* Media Container for video and image side-by-side */
.media-container {
    display: flex;
    gap: 20px;
    margin: 20px 0 30px 0;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

.video-wrapper {
    flex: 1;
    min-width: 280px;
    max-width: calc(50% - 10px);
}

.video-wrapper iframe {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.media-image {
    flex: 1;
    min-width: 280px;
    max-width: calc(50% - 10px);
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    object-fit: cover;
}

/* Responsive Design for media container */
@media (max-width: 768px) {
    .media-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .video-wrapper,
    .media-image {
        max-width: 100%;
        min-width: 100%;
    }
}

/* Map Container */
.map-container {
    margin-bottom: 30px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Detail Link Button */
.detail-link-button {
    display: inline-block;
    text-decoration: none;
    border-radius: 5px;
    background-color: #ffd700;
    color: #003366;
    font-weight: bold;
    padding: 15px 30px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.detail-link-button:hover {
    background-color: #ffed4e;
    transform: translateY(-2px);
}

/* Contact Links */
.contact-link {
    color: #0055a4;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: #003366;
    text-decoration: underline;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 480px) {
    .header-message {
        font-size: 0.75em;
        padding: 5px 10px;
    }
    
    .tab-button {
        font-size: 1em;
        padding: 12px 20px;
    }
    
    .tab-pane h2 {
        font-size: 1.5em;
    }
    
    .infographic-block {
        background-color: #f9f9f9;
        border: 1px solid #eee;
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 20px;
        display: flex;
        align-items: center;  /* flex-start から center に変更 */
    }
    
    .infographic-block .icon {
        font-size: 1.5em;  /* スマホでは少し小さめ */
        min-width: 30px;
        margin-right: 10px;
    }
    
    .detail-link-button {
        padding: 12px 20px;
        font-size: 0.95em;
    }
}

/* Ensure images don't overflow on small screens */
img {
    max-width: 100%;
    height: auto;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Tide & Weather Styles */
.tideweather-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 8px;
    border: 1px solid #d0e0f0;
}

.tideweather-controls .form-group {
    display: flex;
    flex-direction: column;
}

.tideweather-controls label {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #003366;
}

.tideweather-controls select, 
.tideweather-controls input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.tideweather-controls .button-group {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.tideweather-controls button {
    background-color: #0055a4;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.tideweather-controls button:hover {
    background-color: #003366;
}

.tideweather-controls button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#chart-container-wrapper {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #0055a4;
    font-weight: bold;
}

.error {
    color: #d9534f;
    padding: 15px;
    background: #f2dede;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 5px solid #d9534f;
}

.info-panel {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #eee;
}

.info-panel h3 {
    color: #003366;
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.tide-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.tide-item {
    padding: 10px;
    background: white;
    border-radius: 5px;
    border: 1px solid #eee;
    font-size: 0.9em;
}

.tide-item strong {
    color: #0055a4;
}

/* Weather Overlays for Chart */
.weather-info {
    position: absolute;
    top: 70px;
    left: 60px;
    right: 60px;
    height: 60px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    pointer-events: none;
    z-index: 10;
}

.weather-item {
    text-align: center;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 6px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: absolute;
}

.weather-icon {
    font-size: 20px;
}

.weather-temp {
    font-weight: bold;
    color: #333;
}

.weather-wind {
    color: #666;
    font-size: 9px;
}

/* 水温表示ウィンドウ */
.temp-display {
    position: absolute;
    top: 140px;
    right: 70px;
    background: linear-gradient(135deg, #0055a4 0%, #003366 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
    font-size: 13px;
    z-index: 10;
    min-width: 160px;
    transition: all 0.3s ease;
}

.temp-display[data-collapsed="true"] {
    min-width: 50px;
    padding: 8px;
}

.temp-display[data-collapsed="true"] .temp-content {
    display: none;
}

.temp-toggle-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 11;
    pointer-events: auto;
}

.temp-toggle-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.temp-content {
    display: block;
    transition: opacity 0.3s ease;
    margin-top: 20px;
}

.temp-display h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 4px;
}

.temp-method {
    font-size: 9px;
    opacity: 0.8;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(255,255,255,0.2);
}



/* スマホ用の横スクロール対応 */
@media (max-width: 768px) {
    #chart-container-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch; /* iOSでスムーズなスクロール */
    }
    
    #chart-container {
        min-width: 800px; /* グラフの最小幅を確保 */
        width: 100%;
    }
    
    .weather-info {
        top: 60px;
        left: 60px; /* PC版と同じ位置に戻す */
        right: auto;
        width: calc(100% - 120px);
        min-width: 680px; /* グラフの幅に合わせる */
        flex-wrap: nowrap; /* 天気アイテムを横並びに維持 */
        height: 60px;
    }
    
    .temp-display {
        top: 140px; /* PC版と同じ位置 */
        right: 70px;
        bottom: auto;
        min-width: 160px;
    }
    
    .temp-display[data-collapsed="true"] {
        min-width: 50px;
    }
}

/* クイック日付選択ボタン */
.date-quick-select {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.quick-date-btn {
    flex: 1;
    padding: 10px 12px;
    background: #ffffff;
    border: 2px solid #1565c0;
    border-radius: 8px;
    color: #1565c0;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
    white-space: nowrap;
}

.quick-date-btn:hover {
    background: #e3f2fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.quick-date-btn.active {
    background: #1565c0;
    color: white;
    box-shadow: 0 4px 8px rgba(21, 101, 192, 0.3);
}

.quick-date-btn:active {
    transform: translateY(0);
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    .quick-date-btn {
        padding: 8px 10px;
        font-size: 0.85em;
    }
}

/* ビデオプレイヤースタイル */
.raft-video-container {
    margin-top: 30px;
    text-align: center;
}

.raft-video-container h3 {
    color: #003366;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.raft-video-container video {
    width: 100%;
    max-width: 600px;
    max-height: 400px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

/* スマホではより大きく表示 */
@media (max-width: 768px) {
    .raft-video-container video {
        max-width: 100%;
        max-height: 300px;
    }
}