/**
 * style.css - マップ調査専用プレミアムCSS
 * 
 * [グローバルルール適用]
 * 1. 背景色と文字色の十分なコントラストを確保。
 * 2. 320pxの極小画面でも破綻せずスタックする可読性重視のデザイン。
 * 3. プルダウン（セレクトボックス）や入力欄の視認性に配慮。
 */

:root {
    --bg-color: #0d0e12;
    --card-bg: rgba(26, 29, 36, 0.65);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary-color: #00bcd4; /* シアン系プレミアムカラー */
    --accent-color: #ffd700;  /* ゴールドアクセント */
    --text-color: #f3f4f6;
    --text-muted: #9ca3af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --input-bg: #1f232d;
    --input-focus: #2d3342;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', 'M PLUS Rounded 1c', sans-serif;
    min-height: 100vh;
    padding: 1.5rem 1rem;
    background: 
        radial-gradient(circle at 5% 5%, rgba(0, 188, 212, 0.05) 0%, transparent 35%),
        radial-gradient(circle at 95% 95%, rgba(255, 215, 0, 0.03) 0%, transparent 35%),
        var(--bg-color);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #ffffff 30%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* カード共通 */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.2rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* フォーム関連 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #cbd5e1;
}

.form-control, select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

/* プルダウンの選択肢が見えなくなる問題を解消する明示的な配色 */
select option {
    background-color: #1a1d24;
    color: #fff;
}

.form-control:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--input-focus);
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.2);
}

/* ボタン */
.btn {
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #00acc1);
    color: #000;
    font-weight: 800;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--danger-color);
    color: #fff;
}

/* メインレイアウト */
.survey-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* マップエリア */
.map-viewport {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background-color: #090a0d;
    border: 1px solid var(--border-color);
}

/* マップコンテナ（アスペクト比維持のため） */
.map-container {
    position: relative;
    width: 100%;
    cursor: crosshair;
}

.map-image {
    width: 100%;
    height: auto;
    display: block;
}

/* マップ未登録時のプレースホルダー */
.map-placeholder {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.map-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* 動的ピン */
.map-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 0.75rem;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.2s ease;
    z-index: 10;
}

.map-pin:hover {
    transform: translate(-50%, -50%) scale(1.3);
    z-index: 100;
}

.pin-treasure { background-color: var(--accent-color); color: #000; }
.pin-gathering { background-color: #4caf50; color: #fff; }
.pin-mob { background-color: #2196f3; color: #fff; }
.pin-other { background-color: #9c27b0; color: #fff; }
.pin-warp { background-color: #00bcd4; color: #000; } /* ポータル用スタイル */
.pin-airship { background-color: #3f51b5; color: #fff; } /* 飛空艇用スタイル */

/* 階層セレクター */
.layer-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.layer-tab {
    position: relative;
    padding: 0.5rem 2.2rem 0.5rem 1.2rem; /* 右側に削除ボタン用のスペースを確保 */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.layer-tab.active {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
}

.layer-delete-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: inherit;
    opacity: 0.5;
    transition: all 0.15s ease;
}

.layer-delete-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    color: var(--danger-color);
    opacity: 1;
}

.layer-add-btn {
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px dashed rgba(16, 185, 129, 0.4);
    color: #34d399;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.layer-add-btn:hover {
    background: rgba(16, 185, 129, 0.3);
}

/* ピン情報ポップオーバー */
.pin-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1d24;
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 8px;
    width: 200px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 110;
    display: none;
    font-size: 0.8rem;
    color: #fff; /* 親ピンの文字色(黒など)を継承せず常に白文字にする */
}

.pin-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1a1d24;
}

/* 上端付近のピン用に、下側に吹き出しを表示するスタイル */
.pin-popover.popover-bottom {
    bottom: auto;
    top: calc(100% + 8px);
}
.pin-popover.popover-bottom::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #1a1d24;
}

/* モブ・ボス情報リスト */
.mob-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mob-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mob-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mob-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

.mob-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mob-element {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
}

/* ドロップ品見た目検索・カード */
.drops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.drop-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.drop-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.drop-image-wrap {
    width: 100%;
    height: 150px;
    background: #090a0d;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.drop-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.drop-info {
    padding: 0.8rem;
    font-size: 0.85rem;
}

.drop-title {
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: #fff;
}

.drop-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0;
}

.drop-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: rgba(0, 188, 212, 0.1);
    color: var(--primary-color);
    border-radius: 4px;
}

.drop-color-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: rgba(255, 215, 0, 0.1);
    color: var(--accent-color);
    border-radius: 4px;
}

/* モード切替タブ */
.mode-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.mode-tab {
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-weight: 800;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mode-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.mode-tab.active {
    color: var(--primary-color);
    background: rgba(0, 188, 212, 0.1);
}

/* モバイル対応 (320px完全レスポンシブ・縦に1文字ずつ並ぶのを防ぐ) */
@media (max-width: 768px) {
    .survey-layout {
        grid-template-columns: 1fr; /* 1列スタック */
    }

    body {
        padding: 1rem 0.5rem;
    }

    .card {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .layer-selector {
        flex-direction: row; /* 横並びを維持 */
        justify-content: center; /* 中央揃えにする */
        width: 100%;
    }
    
    .layer-tab {
        width: calc(50% - 4px); /* 横に2列で並ぶように横幅を半分（隙間分を差し引く）に設定 */
        text-align: center;
        justify-content: center; /* ボタン内部の要素も中央揃えにする */
    }

    .mob-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* 章選択ボタンのコンテナとスタイル */
.chapter-buttons-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 0.4rem;
    margin-bottom: 0.8rem;
}

.chapter-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chapter-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.chapter-btn.active {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.3);
}
