/**
 * ENECHANGE INSIGHT MARKETS 100% 忠実再現スタイルシート (数字フォント最適化)
 */

@import url('https://fonts.googleapis.com/css2?family=M+PLUS+1p:wght@400;500;700;800&family=Noto+Sans+JP:wght@400;500;700;900&family=Oswald:wght@500;600;700&display=swap');

:root {
    --bg-dark-header: #1e2530;
    --table-header-bg: #1e2530;
    --border-dark: #334155;
    --split-line-color: #ffffff;
    --gap-black: #000000;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    font-family: 'Noto Sans JP', 'M PLUS 1p', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #0b1120;
    color: #f8fafc;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.font-num {
    font-family: 'Oswald', -apple-system, sans-serif;
    letter-spacing: 0.01em;
}

/* カスタムスクロールバー */
.custom-scrollbar::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #0f172a;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* 洗練されたプロフェッショナル・マトリクス テーブルスタイル */
.enein-matrix-table {
    table-layout: fixed !important;
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    font-size: 11.5px;
    background-color: #0b1120;
}

.enein-matrix-table th, .enein-matrix-table td {
    padding: 0px 1px;
    height: 23px;
    box-sizing: border-box;
    border-right: 1px solid #0b1120;
    border-bottom: 2px solid #0b1120;
    white-space: nowrap;
    text-align: center;
    position: relative;
    line-height: 22px;
}

/* ================== 固定列の位置合わせ (影なしフラット) ================== */

/* 1. エリア名列 (幅 68px, left: 0px) */
.col-area {
    position: sticky !important;
    left: 0px !important;
    width: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    background-color: #1e2530 !important;
    text-align: center !important;
    font-weight: 700;
    border-right: 1.5px solid #000000 !important;
    box-shadow: none !important;
}

/* 2. Max列 (幅 50px, left: 68px) */
.col-max {
    position: sticky !important;
    left: 68px !important;
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    background-color: #be123c !important;
    color: #ffffff !important;
    font-size: 11.8px !important; /* ほんの少し大きく */
    font-weight: 700;
    border-right: 1.5px solid #000000 !important;
    box-shadow: none !important;
}

/* 3. Min列 (幅 50px, left: 118px = 68 + 50) */
.col-min {
    position: sticky !important;
    left: 118px !important;
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    background-color: #15803d !important;
    color: #ffffff !important;
    font-size: 11.8px !important; /* ほんの少し大きく */
    font-weight: 700;
    border-right: 1.5px solid #000000 !important;
    box-shadow: none !important;
}

/* 4. Avg列 (幅 50px, left: 168px = 118 + 50) */
.col-avg {
    position: sticky !important;
    left: 168px !important;
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    background-color: #1e3a8a !important;
    color: #ffffff !important;
    font-size: 11.8px !important; /* ほんの少し大きく */
    font-weight: 700;
    border-right: 1.5px solid #000000 !important;
    box-shadow: none !important;
}

/* 5. 48コマ 時刻ヘッダー & 価格セル (幅 42px) */
.col-time, .cell-price {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}

/* レイヤー重なり順 (z-index) */
tbody td.col-area { z-index: 15; }
tbody td.col-max  { z-index: 14; }
tbody td.col-min  { z-index: 14; }
tbody td.col-avg  { z-index: 14; }

thead th.col-area { position: sticky !important; top: 0; left: 0px !important; z-index: 25; }
thead th.col-max  { position: sticky !important; top: 0; left: 68px !important; z-index: 25; }
thead th.col-min  { position: sticky !important; top: 0; left: 118px !important; z-index: 25; }
thead th.col-avg  { position: sticky !important; top: 0; left: 168px !important; z-index: 25; }

thead th.col-time {
    position: sticky !important;
    top: 0;
    z-index: 20;
    background-color: #1e2530 !important;
    color: #94a3b8 !important;
    font-family: 'Oswald', sans-serif;
    font-size: 10px;
    border-bottom: 2px solid #0b1120 !important;
    border-right: 1px solid #0b1120 !important;
}

/* エリアタグバッジ */
.area-badge {
    display: inline-block;
    background-color: #0f172a;
    color: #f1f5f9;
    padding: 1px 4px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid #334155;
    white-space: nowrap;
}

/* 価格セル (数字サイズを11.8pxに拡大) */
.cell-price {
    font-family: 'Oswald', sans-serif;
    font-size: 11.8px;
    font-weight: 700;
    cursor: pointer;
    z-index: 1;
    transition: filter 0.1s ease;
}
.cell-price:hover {
    filter: brightness(1.3);
    outline: 2px solid #ffffff;
    z-index: 20 !important;
}

/* 本家 ENECHANGE 分断マーク (--o--o--) を黒フチ隙間に描画 */
.split-gap-container {
    position: absolute;
    bottom: -3.5px;
    left: 0;
    right: 0;
    height: 6px;
    z-index: 25;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.split-breaker-svg {
    width: 100%;
    height: 6px;
    overflow: visible;
}

/* ================== 1本のデュアルレンジスライダー (開始・終了 2つまみ) ================== */
.dual-slider-container {
    position: relative;
    width: 340px;
    height: 28px;
    display: flex;
    align-items: center;
}

.dual-slider-track-bg {
    position: absolute;
    width: 100%;
    height: 7px;
    background: #182234;
    border-radius: 9999px;
    border: 1px solid #334155;
    z-index: 1;
}

.dual-slider-track-highlight {
    position: absolute;
    height: 7px;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
    border-radius: 9999px;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
}

.dual-slider-input {
    position: absolute;
    left: 0;
    width: 100%;
    height: 26px;
    margin: 0;
    padding: 0;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    z-index: 3;
}

.dual-slider-input::-webkit-slider-thumb {
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #0284c7;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
    transition: transform 0.1s ease, border-color 0.1s ease;
}

.dual-slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.18);
    border-color: #38bdf8;
}

.dual-slider-input::-webkit-slider-thumb:active {
    transform: scale(1.25);
    border-color: #7dd3fc;
}

.dual-slider-input::-moz-range-thumb {
    pointer-events: auto;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #0284c7;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
}

/* 日付入力欄 (input[type="date"]) のカレンダーアイコンを非表示にして全面クリック対応 */
input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

/* ================== スマホ用レスポンシブ最適化 (768px以下) ================== */
@media (max-width: 768px) {
    /* 1. エリア列のみ左端に固定 (幅を少しスリムに) */
    .col-area {
        width: 54px !important;
        min-width: 54px !important;
        max-width: 54px !important;
        font-size: 10.5px !important;
        padding: 0px 1px !important;
    }
    
    /* 2. Max, Min, Avg 列はスマホの時は固定解除してスライドで一緒に流れる */
    .col-max, .col-min, .col-avg,
    thead th.col-max, thead th.col-min, thead th.col-avg,
    tbody td.col-max, tbody td.col-min, tbody td.col-avg {
        position: static !important;
        left: auto !important;
        z-index: 1 !important;
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        font-size: 10.8px !important;
    }

    /* 3. デュアルスライダーの幅をスマホ画面に合わせて自動調整 */
    .dual-slider-container {
        width: 100% !important;
        max-width: 280px;
    }
}
