/* ==========================================================================
   1. 全体設定
========================================================================== */

/* メインラッパー */
.idx-wrapper {
    min-height: 100vh;
    width: 100%;
    position: relative;
    background-image: url('../images/main-background-03.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* メインコンテナ */
.idx-container {
    position: relative;
    z-index: 2;
    max-width: 1536px;
    margin: 0 auto;
    padding: 10px;
    display: flex;
    gap: 10px;
    box-sizing: border-box;
}

.idx-container-temporary {
    position: relative;
    z-index: 2;
    max-width: 1536px;  /* サイドバーなしの場合は幅を狭く */
    margin: 0 auto;
    padding: 10px;
    display: flex;
    justify-content: center;  /* 水平方向の中央揃え */
    box-sizing: border-box;
}

/* メインコンテンツエリア */
.idx-main {
    flex: 0 0 calc(80% - 5px);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border-radius: 5px;
    padding: 15px;
    box-sizing: border-box;
}

/* サイドバー */
.idx-sidebar {
    flex: 0 0 calc(20% - 5px);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border-radius: 5px;
    padding: 15px;
    box-sizing: border-box;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .idx-container {
        flex-direction: column;
        padding: 5px;  /* モバイルでパディングを縮小 */
        gap: 0;     /* モバイルでギャップなし */
    }
    
    .idx-main,
    .idx-sidebar {
        flex: 1 1 100%;
        width: 100%;
        padding: 10px;  /* モバイルでパディングを縮小 */
    }
}

/* ==========================================================================
   2. メインコンテンツ設定
========================================================================== */

/* メインバナー */
.idx-main-banner {
    width: 100%;
    margin-bottom: 15px;
}

.idx-main-banner__image {
    width: 100%;
    height: auto;
    border-radius: 3px;
    overflow: hidden;
}

.idx-main-banner__image img {
    width: 100%;
    height: auto;
    display: block;
}

/* グリッドレイアウト */
.idx-content-grid {
    display: flex;
    width: 100%;
}

/* グラフエリア */
.idx-graph-area {
    flex: 1 1 75%;
    min-width: 0;
}

.idx-graph-area iframe {
    flex: 1;
    min-height: 280px;
    border: none;
    width: 100%;
    height: 100%;
}

/* テーブルエリア */
.idx-table-area {
    flex: 1 1 25%;
    min-width: 0;
}

.idx-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 5px 5px;
}

.idx-table-header h3 {
    font-size: 1em;
    color: #333;
    margin: 0;
}

.idx-table-unit {
    font-size: 0.8em;
    color: #666;
    text-align: right;
}

.idx-table-column {
    width: 100%;
    position: relative;
    font-size: 1em;
}

.idx-ea-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8em;
}

.idx-ea-table td:first-child {
    width: calc(100% - 60px);
    text-align: left;
}

.idx-ea-table td:last-child {
    width: 60px;
    text-align: center;
    color: #666;
}

.idx-ea-table td:last-child div {
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: center;
    white-space: nowrap;
}

.idx-ea-table td:last-child input {
    width: 70px;
    padding: 2px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}

.idx-ea-table td:last-child span {
    font-size: 0.9em;
    white-space: nowrap;
}

.idx-ea-table input[type="checkbox"] {
    width: 12px;
    height: 12px;
    margin: 0;
    vertical-align: middle;
}

/* コントロールボタン */
.control-button {
    padding: 6px 12px;
    margin: 0 4px;
    border: none;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: fit-content;
}

/* 選択系ボタン - 青系統 */
#selectAllBtn {
    background-color: #4a6da7;
    color: white;
}

/* 解除系ボタン - グレー系統 */
#deselectAllBtn {
    background-color: #5a6268;
    color: white;
}

/* RF基準ボタン - 緑系統 */
#rfStandardBtn {
    background-color: #2d8a6b;
    color: white;
}

/* 最大DD基準ボタン - オレンジ系統 */
#maxDDBtn {
    background-color: #d17f46;
    color: white;
}

/* ALL0.1ボタン - 紫系統 */
#allMinLotsBtn {
    background-color: #6b5b95;
    color: white;
}

.control-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.control-button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.idx-button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px 0;
}

.idx-button-row {
    display: flex;
    justify-content: space-between;  /* 中央揃えから均等配置に変更 */
    width: 100%;  /* 幅を最大に */
    gap: 5px;    /* ボタン間の間隔 */
}

.idx-button-row .control-button {
    flex: 1;      /* 各ボタンを均等に拡大 */
}

#myChartDiv {
    height: 280px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

@media (max-width: 768px) {
    .idx-content-grid {
        flex-direction: column;
        gap: 15px;
    }

    .idx-graph-area,
    .idx-table-area {
        flex: 1 1 100%;
        width: 100%;
    }

    .idx-graph-area {
        height: 30px;
        margin-bottom: 0;
    }

    .idx-table-header {
        width: 100%;
        margin-bottom: 10px;
    }

    .idx-table-column {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .idx-ea-table-wrapper {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .idx-ea-table {
        width: 100%;
        font-size: 0.75em;
    }

    .idx-ea-table-column {
        width: 100%;
    }

    .idx-button-group {
        width: 100%;
        justify-content: flex-end;
        margin-top: 15px;
        gap: 8px;
    }

    .control-button {
        padding: 6px 12px;
        font-size: 0.85em;
    }

    #myChartDiv {
        height: 230px;
    }
}

@media (max-width: 480px) {
    .idx-ea-table-wrapper {
        gap: 0;
    }

    #myChartDiv {
        padding: 10px;
        height: 160px;
    }

    .idx-button-group {
        justify-content: center;  /* 中央寄せに変更 */
        gap: 8px;  /* ボタン間の間隔を確保 */
    }
    
    .control-button {
        padding: 6px 8px;    /* 小さい画面でパディングを少し縮小 */
        font-size: 0.8em;    /* フォントサイズをさらに小さく */
    }
}

/* ==========================================================================
   3. サイドバー設定
========================================================================== */

/* サイドバーバナー */
.idx-sidebar-banner {
    width: 100%;
    overflow: hidden;
}

.idx-sidebar-banner__ad {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.youtube-guide {
    text-align: center;
    font-weight: bold;
    color: #e53e3e;
    margin: 8px;
    font-size: 0.85rem;
    padding: 0 auto;
    background-color: #fff8f8;
    border-radius: 4px;
}

.minato-banner {
    max-width: 100%;
    height: auto;
    display: block;
}

/* レスポンシブ対応の調整 */
@media (max-width: 768px) {
    .idx-sidebar__content {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .idx-sidebar-banner {
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .idx-sidebar-banner__ad.minato-banner {
        width: auto !important;
        height: auto !important;
        max-width: 100%;
    }
}

/* さらに小さい画面サイズでの調整 */
@media (max-width: 480px) {
    .idx-sidebar__content {
        grid-template-columns: 1fr;  /* 1カラムに戻す */
        gap: 15px;
    }
}

/* iframeのスクロールを無効化 */
#iframe_graph {
    overflow: hidden !important;
    height: auto !important;
    min-height: 650px; /* グラフの高さに合わせて調整 */
    width: 100% !important;
}

/* iframeの中身のスクロールも無効化（iframe内のCSSが必要） */
iframe#iframe_graph {
    scrolling: no;
}
