/* ===== アルファロジック 買取価格表 ===== */

/* 共通カラートークン（アクセント色に連動。color-mix未対応ブラウザは直前のフォールバック値を使用） */
.apt-record-wrap,
.apt-wrap {
    --apt-row-even: #f7f7f8;
    --apt-row-even: color-mix(in srgb, var(--apt-accent, #cc0000) 5%, #fff);
    --apt-row-hover: #efeff1;
    --apt-row-hover: color-mix(in srgb, var(--apt-accent, #cc0000) 11%, #fff);
    --apt-border: #ececec;
    --apt-border: color-mix(in srgb, var(--apt-accent, #cc0000) 12%, #e6e6e6);
}

.apt-wrap {
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    margin: 1.5em 0;
}

/* タブ（旧ショートコード） */
.apt-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
}

.apt-tab {
    padding: 10px 28px;
    background: #ccc;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
    border-radius: 6px 6px 0 0;
    transition: background 0.2s;
}

.apt-tab:hover {
    background: #a00;
}

.apt-tab--active {
    background: var(--apt-header-bg, #cc0000);
}

/* テーブル外枠 */
.apt-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--apt-border, #ececec);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    background: #fff;
}

/* テーブル本体 */
.apt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ヘッダー */
.apt-table thead tr {
    background-color: var(--apt-header-bg, #cc0000);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.10));
    color: var(--apt-header-text, #fff);
}

.apt-table th {
    padding: 14px 12px;
    text-align: center;
    font-weight: 700;
    font-size: 0.86rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

.apt-table th:last-child {
    border-right: none;
}

/* 機種名列 */
.apt-table th:first-child,
.apt-table td:first-child {
    text-align: left;
    min-width: 150px;
}

/* ボディ */
.apt-table tbody tr {
    transition: background 0.15s ease;
}

.apt-table tbody tr:nth-child(odd) {
    background: #fff;
}

.apt-table tbody tr:nth-child(even) {
    background: var(--apt-row-even, #f7f7f8);
}

.apt-table tbody tr:hover {
    background: var(--apt-row-hover, #efeff1);
}

.apt-table td {
    padding: 12px 12px;
    text-align: center;
    border-right: 1px solid var(--apt-border, #ececec);
    border-bottom: 1px solid var(--apt-border, #ececec);
    color: #2b2b2b;
}

.apt-table td:last-child {
    border-right: none;
}

.apt-table tbody tr:last-child td {
    border-bottom: none;
}

/* 機種名セル */
.apt-table td.apt-model {
    color: var(--apt-accent, #cc0000);
    font-weight: 700;
    text-align: left;
    letter-spacing: 0.01em;
}

/* 価格セル（数値を強調） */
.apt-table td.apt-price {
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    color: #222;
}

/* ジャンク品（小さめ・控えめ） */
.apt-table td.apt-junk,
.apt-table th.apt-junk {
    font-size: 0.82rem;
    color: #999;
    font-weight: 500;
}

/* 「-」表示 */
.apt-dash {
    color: #c4c4c4;
}

/* ローディング・エラー */
.apt-loading {
    padding: 24px;
    text-align: center;
    color: #888;
}

.apt-error {
    padding: 16px;
    color: #c00;
    font-size: 0.9rem;
}

/* ─── Gutenberg ブロック（apt-record-wrap） ─── */

.apt-record-wrap {
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    margin: 1.6em 0;
    color: #2b2b2b;
}

.apt-record-title {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.4;
    margin: 0 0 0.35em;
    padding-left: 0.55em;
    border-left: 5px solid var(--apt-accent, #cc0000);
}

.apt-record-date {
    display: inline-block;
    color: #777;
    font-size: 0.8rem;
    margin: 0 0 0.9em;
    padding: 3px 10px;
    background: #f3f3f4;
    border-radius: 999px;
}

/* 応相談（バッジ風）・ダッシュ表示 */
.apt-nego {
    display: inline-block;
    color: var(--apt-accent, #cc0000);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 2px 9px;
    border-radius: 999px;
    background: #f7eaea;
    background: color-mix(in srgb, var(--apt-accent, #cc0000) 12%, #fff);
}

.apt-dash {
    color: #c4c4c4;
}

/* ─── 行・列固定（sticky） ─── */

/* 縦横スクロールコンテナ（max-heightはインラインstyleで指定） */
.apt-table-wrap.apt-sticky {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* ヘッダー行を上部固定 */
.apt-table-wrap.apt-sticky thead th {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--apt-header-bg, #cc0000); /* stickyセルは自前の背景が必須（透けるため） */
}

/* 機種名列（1列目）を左固定 */
.apt-table-wrap.apt-sticky th:first-child,
.apt-table-wrap.apt-sticky td:first-child {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 1;
}

/* 左上の角セル（ヘッダー×機種名）は行・列両方の固定で最前面 */
.apt-table-wrap.apt-sticky thead th:first-child {
    z-index: 3;
}

/* sticky列はtrの背景が透けるためセル自身に背景を持たせる */
.apt-table-wrap.apt-sticky tbody tr:nth-child(odd) td:first-child {
    background: #fff;
}

.apt-table-wrap.apt-sticky tbody tr:nth-child(even) td:first-child {
    background: var(--apt-row-even, #f7f7f8);
}

.apt-table-wrap.apt-sticky tbody tr:hover td:first-child {
    background: var(--apt-row-hover, #efeff1);
}

/* 固定列の境界を視覚的に分かりやすく */
.apt-table-wrap.apt-sticky th:first-child,
.apt-table-wrap.apt-sticky td:first-child {
    box-shadow: 4px 0 6px -2px rgba(0, 0, 0, 0.10);
}

/* ─── 検索（絞り込み）ボックス ─── */

.apt-search-wrap {
    margin: 0 0 0.7em;
    position: relative;
}

.apt-search {
    width: 100%;
    max-width: 340px;
    box-sizing: border-box;
    padding: 10px 14px 10px 38px;
    font-size: 0.92rem;
    border: 1px solid #d4d4d8;
    border-radius: 999px;
    background-color: #fff;
    /* 虫眼鏡アイコン（インラインSVG） */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 13px center;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.apt-search::placeholder {
    color: #9a9a9a;
}

.apt-search:focus {
    outline: none;
    border-color: var(--apt-accent, #cc0000);
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.12);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--apt-accent, #cc0000) 22%, transparent);
}

/* 「該当なし」行 */
.apt-noresult-row td {
    text-align: center;
    color: #999;
    padding: 22px 10px;
    font-size: 0.9rem;
}

/* ─── スマートフォン対応 ─── */

@media (max-width: 640px) {
    .apt-table {
        font-size: 0.8rem;
    }

    .apt-table th,
    .apt-table td {
        padding: 10px 7px;
    }

    .apt-table td.apt-price {
        font-size: 0.85rem;
    }

    /* 機種名列は幅を抑えて折り返し（横スクロール領域を確保） */
    .apt-table th:first-child,
    .apt-table td:first-child {
        min-width: 116px;
        max-width: 150px;
        white-space: normal;
        word-break: break-word;
    }

    .apt-record-title {
        font-size: 1.1rem;
    }

    .apt-search {
        max-width: 100%;
    }
}

/* ブロック未設定時のプレースホルダー */
.apt-block-notice,
.apt-block-error {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.apt-block-notice {
    background: #f0f0f1;
    color: #555;
}

.apt-block-error {
    background: #fcf0ef;
    color: #c00;
}
