/* Google検索レポート専用スタイル（モック準拠） */

/* ============================================================
   スクロール固定レイアウト
   フィルターセクション: 固定
   データエリア(#gsc-report-content): スクロール可能
   サマリー画面の QuickSight iframe 方式と同等の動作を CSS で実現
   ============================================================ */
#gsc-report-container {
    display: flex;
    flex-direction: column;
    /* mdx-quicksight-graph-embed-wrapper の calc(100vh - 278px) に準じて、
       フィルターバー2行分を差し引いた高さを確保する */
    height: calc(100vh - 140px);
    min-height: calc(768px - 140px);
    /* overflow: hidden はツールチップ（xuxInfotip）が上方向にはみ出せなくなるため設定しない */
}
#gsc-report-container > section.mdx-quicksight-filter-section {
    flex: 0 0 auto;
}
#gsc-report-loading {
    flex: 1 1 auto;
}
#gsc-report-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 24px;
    padding-right: 12px;
}

#gsc-report-container .website-period-row > .xux-labelableBox-main > .xux-labelableBox-content {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}
#gsc-report-container .website-period-label {
    flex: 0 0 auto;
    margin-right: 8px;
    line-height: 32px;
}
#gsc-report-container .website-period-row #website-period-daily-box {
    flex: 0 0 auto;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
#gsc-report-container .website-filter-row {
    box-sizing: border-box;
    margin: 16px 0 !important;
    padding-left: 40px;
}

/* ローディング: 三つの点アニメーション（QuickSight iframePlaceholder準拠） */
.gsc-loading-area {
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 278px);
    min-height: calc(768px - 278px);
}
.gsc-loading-dots {
    display: flex;
    gap: 8px;
}
.gsc-loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #888;
    animation: gscDotPulse 1.4s infinite ease-in-out both;
}
.gsc-loading-dots span:nth-child(1) { animation-delay: 0s; }
.gsc-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.gsc-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes gscDotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* フィルターセクション下余白（サマリーではsection間marginがXUXで自動付与されるが、
   GSCではフィルター直後がdivのため手動指定が必要） */
#gsc-report-container > section.mdx-quicksight-filter-section {
    margin-bottom: 16px;
}

/* CVドロップダウンダイアログ: 全項目が表示されるようにする */
#table-filter-scope-setting-dialog-cv .checkbox-box {
    max-height: 60vh !important;
    overflow-y: auto !important;
}
#table-filter-scope-setting-dialog-cv .xux-infotip-text,
#table-filter-scope-setting-dialog-cv .xux-infotip-body {
    overflow: visible !important;
    max-height: none !important;
}

/* iマーク吹き出し: ダイアログポップアップより上に表示されるようにz-indexを確保 */
#gsc-report-container .xux-infotip-text {
    z-index: 10000 !important;
}

/* セクション共通 */
.gsc-report-section {
    margin-bottom: 8px;
}

/* ============================================================
   サマリーカード（モック: summary-card 準拠）
   ============================================================ */
.gsc-card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.gsc-card {
    background: #ffffff;
    border: none;
    padding: 16px 24px;
    min-height: 156px;
    box-sizing: border-box;
}
.gsc-card-title {
    font-size: 16px;
    color: #666666;
    font-weight: 600;
    line-height: 20px;
    margin-bottom: 6px;
}
.gsc-card-body {
    max-width: 192px;
    margin: 0 auto;
}
.gsc-card-value-block {
    text-align: right;
    white-space: nowrap;
    margin-bottom: 10px;
}
.gsc-card-main-value {
    font-size: 42px;
    font-weight: 700;
    color: #0a0a0a;
    line-height: 42px;
}
.gsc-card-unit {
    font-size: 28px;
    font-weight: normal;
    color: #0a0a0a;
    margin-left: 4px;
}

/* 前月/前年 比較行 */
.gsc-card-comparisons {
    margin-top: 0;
}
.gsc-card-comparison {
    font-size: 14px;
    color: #0a0a0a;
    display: flex;
    align-items: center;
    line-height: 1.8;
    white-space: nowrap;
    margin: 0;
}
.gsc-card-comparison-label {
    min-width: 28px;
    text-align: left;
    font-size: 14px;
    color: #666666;
}
.gsc-card-comparison-value {
    flex: 1;
    text-align: right;
    font-weight: normal;
    font-size: 16px;
    color: #666666;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}
.gsc-card-comparison-change {
    flex: 1;
    text-align: right;
    font-weight: normal;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}
.gsc-card-comparison-change .gsc-arrow {
    font-size: 14px;
    line-height: 1;
    margin-left: 1px;
}
.gsc-card-comparison-change.gsc-positive { color: #00856f; }
.gsc-card-comparison-change.gsc-negative { color: #CC252F; }
.gsc-card-comparison-change.gsc-neutral { color: #666; }

/* ============================================================
   日別グラフ（モック: 4面分離、凡例右側縦並び）
   ============================================================ */
.gsc-chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (max-width: 1200px) {
    .gsc-chart-grid {
        grid-template-columns: 1fr;
    }
}
.gsc-chart-panel {
    background: #ffffff;
    border: none;
    padding: 48px 48px 24px 48px;
    min-width: 0;
    overflow: hidden;
    container-type: inline-size;
}
.gsc-chart-title {
    font-size: clamp(12px, 3.1cqi, 20px);
    font-weight: 600;
    color: #666666;
    margin: 0 0 16px 0;
}
.gsc-chart-content {
    display: flex;
    align-items: flex-start;
}
.gsc-chart-canvas-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
}
.gsc-chart-content canvas {
    width: 100% !important;
    max-height: 480px;
}
.gsc-chart-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 11px;
    color: #0a0a0a;
    margin-left: 16px;
    flex-shrink: 0;
}
.gsc-chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.gsc-chart-legend-icon {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 2px;
}
.gsc-legend-current {
    background: #009DA6;
}
.gsc-legend-current::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #009DA6;
    border-radius: 50%;
}
.gsc-legend-prev {
    background: #80EAFF;
}
.gsc-legend-prev::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 7px;
    height: 7px;
    background: #80EAFF;
}

/* ============================================================
   上位クエリ表（モック: スクロール+合計行+バー+ソートアイコン）
   ============================================================ */
.gsc-table-panel {
    background: #ffffff;
    border: none;
    padding: 48px 48px 24px 48px;
    container-type: inline-size;
}
.gsc-table-title {
    font-size: clamp(12px, 1.5cqi, 20px);
    font-weight: 600;
    color: #666666;
    margin: 0 0 16px 0;
    text-align: left;
}

/* スクロールコンテナ */
.gsc-table-scroll {
    max-height: 480px;
    overflow-y: auto;
    border: 1px solid #ccc;
}
.gsc-table-scroll .gsc-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}
.gsc-table-scroll .gsc-table thead th {
    background: #f0f0f0;
}

.gsc-table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    font-size: clamp(9px, 0.85vw, 13px);
    table-layout: fixed;
}
.gsc-table th {
    padding: 8px 8px;
    text-align: left;
    font-weight: normal;
    background: #f0f0f0;
    white-space: nowrap;
    line-height: 1.25;
    border-bottom: 1px solid #ccc;
    color: #0a0a0a;
    position: relative;
    font-size: 18px;
}
.gsc-table td {
    padding: 8px 8px;
    border-bottom: none;
    line-height: 1.25;
    font-size: 16px;
    color: #0a0a0a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ソートアイコン */
.gsc-table th.sortable {
    cursor: pointer;
    user-select: none;
    padding-right: 20px;
}
.gsc-table th.sortable:hover {
    background: #e0e0e0;
}
.gsc-table th.sortable::after {
    content: "\25BC";
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    color: #999;
}
.gsc-table th.sortable.sort-asc::after {
    content: "\25B2";
    color: #0a0a0a;
}
.gsc-table th.sortable.sort-desc::after {
    content: "\25BC";
    color: #0a0a0a;
}

/* 数値列: ヘッダーは左寄せ、データは右寄せ */
.gsc-table th.gsc-th-metric {
    text-align: left;
    width: 100px;
}
.gsc-table td.gsc-td-metric {
    text-align: right;
}
.gsc-table th.gsc-th-change {
    text-align: left;
    width: 110px;
}
.gsc-table td.gsc-td-change {
    text-align: right;
    width: 110px;
    border-right: 1px solid #e0e0e0;
}

/* クエリ列 */
.gsc-table th.gsc-th-query,
.gsc-table td.gsc-td-query {
    width: 200px;
    border-right: 1px solid #e0e0e0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 前期間比カラー */
.gsc-td-change.gsc-positive { color: #00856f; }
.gsc-td-change.gsc-negative { color: #CC252F; }

/* 合計行 */
.gsc-table .gsc-summary-row {
    background: #f0f0f0 !important;
    border-bottom: 1px solid #ccc;
    position: sticky;
    top: 35px;
    z-index: 1;
}
.gsc-table .gsc-summary-row td {
    font-weight: normal;
    background: #f0f0f0;
}

/* 偶数行ストライプ */
.gsc-table tbody tr:nth-child(even):not(.gsc-summary-row) {
    background: #fafafa;
}

/* セル内水色バー */
.gsc-table td.gsc-td-metric {
    position: relative;
    z-index: 0;
}
.gsc-cell-bar {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 70%;
    background: #37C6D9;
    opacity: 0.85;
    z-index: -1;
}

/* エラー表示 */
.gsc-report-error {
    padding: 24px;
    text-align: center;
    color: #666666;
    font-size: 16px;
}

/* カラムリサイズハンドル（モック準拠） */
.gsc-col-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    z-index: 2;
    background: transparent;
}
.gsc-col-resize-handle:hover,
.gsc-col-resize-handle.active {
    background: transparent;
}
.gsc-col-resize-handle.active {
    background: #00838d;
    opacity: 0.5;
}
.gsc-table.resizing {
    user-select: none;
    cursor: col-resize;
}
.gsc-table.resizing td,
.gsc-table.resizing th {
    cursor: col-resize;
}
