/**
 * 氷見まんがロード - スタイルシート
 * Phase1: モバイルファースト対応 + 写真背景
 */

/* ========== リセット・基本設定 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* ========== ユーティリティ ========== */
.hidden {
    display: none !important;
}

/* ========== 言語選択ページ（A方式：写真背景） ========== */
.language-page {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow: hidden;
}

/* 背景写真 */
.language-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('imgs/ui/hero_lang_portrait.jpg');
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* 白グラデーションオーバーレイ */
.language-page::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 255, 255, 0.7) 100%
    );
    z-index: 1;
}

.language-container {
    position: relative;
    z-index: 2;
    text-align: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 350px;
    width: 100%;
}

.language-container h1 {
    font-size: 60px;
    margin-bottom: 10px;
}

.language-container h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 30px;
    font-weight: normal;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.language-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px 25px;
    font-size: 18px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.lang-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.lang-btn .flag {
    font-size: 28px;
}

.lang-btn .lang-name {
    font-weight: 600;
}

/* ========== メインページ ========== */
.main-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ヘッダー（B方式：写真背景） */
.app-header {
    position: relative;
    color: white;
    padding: 15px 20px;
    text-align: center;
    z-index: 100;
    overflow: visible; /* 言語メニュー表示のため変更 */
}

/* ヘッダー背景写真 */
.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('imgs/ui/header_ocean.jpg');
    background-size: cover;
    background-position: center;
    opacity: 1;
    z-index: -2;
}

/* ヘッダー暗めグラデーション */
.app-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.1) 100%
    );
    z-index: -1;
}

.app-header h1 {
    position: relative;
    font-size: 22px;
    margin-bottom: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.app-header .subtitle {
    position: relative;
    font-size: 12px;
    opacity: 0.95;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.header-info {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
}

.lang-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

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

/* 言語メニュー */
.language-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 200;
    min-width: 140px;
}

.language-menu button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.language-menu button:hover {
    background: #f0f0f0;
}

/* ステータスバー */
.status-bar {
    background: #fff;
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    color: #555;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* 地図 */
#map {
    flex: 1;
    width: 100%;
    min-height: 300px;
}

/* ========== モーダル ========== */
#arrival-modal {
    width: 100% !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 18px;
    color: #333;
    margin: 0;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-body img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 15px;
}

.modal-body p {
    color: #555;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-top: 10px;
}

#modal-spot-description {
    white-space: pre-wrap;
    line-height: 1.8;
    margin: 15px 0;
    padding: 10px 0;
}

/* 動画コンテナ */
.video-container {
    margin-bottom: 15px;
}

.video-container video {
    width: 100%;
    border-radius: 10px;
    background: #000;
}

.btn-video {
    display: block;
    width: 100%;
    padding: 12px 20px;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-video:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

/* ボタン */
.btn-primary {
    display: inline-block;
    padding: 12px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* ========== デバッグログ ========== */
.debug-log {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 150px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.8);
    color: #0f0;
    font-size: 11px;
    font-family: monospace;
    padding: 10px;
    z-index: 500;
}

.debug-log p {
    margin: 2px 0;
}

/* ========== スポット詳細ページ ========== */
.spot-page {
    min-height: 100vh;
    background: #f5f5f5;
}

.spot-page .app-header {
    position: sticky;
    top: 0;
}

.spot-content {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.spot-content img {
    width: 100%;
    border-radius: 15px;
    margin-bottom: 20px;
}

.spot-content h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.spot-content p {
    color: #555;
    line-height: 1.8;
}

/* ========== レスポンシブ ========== */
@media (min-width: 768px) {
    .app-header h1 {
        font-size: 28px;
    }
    
    .language-container {
        padding: 50px 40px;
    }
    
    .lang-btn {
        padding: 18px 30px;
        font-size: 20px;
    }
    
    .modal-content {
        max-width: 500px;
    }
}

/* ========== index.html用 ========== */
body.index-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.index-page #status {
    color: white;
    font-size: 18px;
    text-align: center;
    padding: 20px;
}

/* ========== Mockモード ========== */
.mock-indicator {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 193, 7, 0.9);
    color: #333;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 9999;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
