/* ============================================
   Trex Content Mirror — Sidebar Styles
   v1.0.4: 7色対応
   ============================================ */

/* ── フォーマット本体（エディタ・フロント共通） ── */
/* プレビュー色はCSSカスタムプロパティで制御（JSから即時更新） */
:root {
    --trex-prev-color: #e3ff91;
    --trex-prev-pct:   40%;
}
.trex-important-preview {
    background: linear-gradient(transparent var(--trex-prev-pct), var(--trex-prev-color) 0%);
    animation: tcmBlink 0.8s ease-in-out infinite;
}
@keyframes tcmBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.15; }
}

.trex-important {
    text-decoration: underline;
    text-decoration-color: #7c3aed;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/*
  マーカー表現: linear-gradient で下半分に色を乗せるリアルなペン風
  太め(thick) → transparent 40%（下60%に色）
  細め(thin)  → transparent 78%（下22%に色）
*/

/* ── 赤（#ffcff5） ── */
.trex-highlight-red-thick {
    background: linear-gradient(transparent 40%, #ffcff5 0%);
    color: inherit;
}
.trex-highlight-red-thin {
    background: linear-gradient(transparent 78%, #ffcff5 0%);
    color: inherit;
}

/* ── 青（#ccf0ff） ── */
.trex-highlight-blue-thick {
    background: linear-gradient(transparent 40%, #ccf0ff 0%);
    color: inherit;
}
.trex-highlight-blue-thin {
    background: linear-gradient(transparent 78%, #ccf0ff 0%);
    color: inherit;
}

/* ── 黄（#e3ff91） ── */
.trex-highlight-yellow-thick {
    background: linear-gradient(transparent 40%, #e3ff91 0%);
    color: inherit;
}
.trex-highlight-yellow-thin {
    background: linear-gradient(transparent 78%, #e3ff91 0%);
    color: inherit;
}

/* ── オレンジ（#ffe2d3） ── */
.trex-highlight-orange-thick {
    background: linear-gradient(transparent 40%, #ffe2d3 0%);
    color: inherit;
}
.trex-highlight-orange-thin {
    background: linear-gradient(transparent 78%, #ffe2d3 0%);
    color: inherit;
}

/* ── 緑（#caffe2） ── */
.trex-highlight-green-thick {
    background: linear-gradient(transparent 40%, #caffe2 0%);
    color: inherit;
}
.trex-highlight-green-thin {
    background: linear-gradient(transparent 78%, #caffe2 0%);
    color: inherit;
}

/* ── 紫（#decfff） ── */
.trex-highlight-purple-thick {
    background: linear-gradient(transparent 40%, #decfff 0%);
    color: inherit;
}
.trex-highlight-purple-thin {
    background: linear-gradient(transparent 78%, #decfff 0%);
    color: inherit;
}

/* ── グレイ（#d9d9d9） ── */
.trex-highlight-gray-thick {
    background: linear-gradient(transparent 40%, #d9d9d9 0%);
    color: inherit;
}
.trex-highlight-gray-thin {
    background: linear-gradient(transparent 78%, #d9d9d9 0%);
    color: inherit;
}

/* ── 説明文 ── */
.tcm-description {
    font-size: 12px;
    color: #1e1e1e;
    line-height: 1.6;
    margin: 0 0 6px;
}
.tcm-sub-description {
    font-size: 11px;
    color: #757575;
    line-height: 1.6;
    margin: 0 0 14px;
    font-style: italic;
}

/* ── 装飾ピッカー ── */
.tcm-deco-picker { margin-bottom: 16px; }

.tcm-deco-label {
    font-size: 11px;
    font-weight: 700;
    color: #1e1e1e;
    margin: 0 0 10px;
}

.tcm-deco-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tcm-deco-group-label {
    font-size: 10px;
    color: #999;
    min-width: 36px;
    letter-spacing: 0.3px;
}

.tcm-deco-swatches {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.tcm-swatch {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 2px solid transparent;
    background: #f0f0f0;
    padding: 3px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tcm-swatch:hover    { border-color: #aaa; transform: scale(1.1); }
.tcm-swatch.is-active { border-color: #1e1e1e; transform: scale(1.1); }

.tcm-swatch-inner {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 3px;
}

/* ── 解析ボタン ── */
.tcm-analyze-btn {
    width: 100% !important;
    justify-content: center !important;
    height: 40px !important;
    margin-bottom: 12px !important;
    font-size: 13px !important;
    background: #7c3aed !important;
    border-color: #7c3aed !important;
}
.tcm-analyze-btn:hover:not(:disabled) { background: #6d28d9 !important; }

/* ── ステータス ── */
.tcm-status {
    font-size: 11px;
    color: #757575;
    margin: 8px 0;
    line-height: 1.5;
    animation: tcmPulse 1.5s ease-in-out infinite;
}
@keyframes tcmPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.tcm-notice { margin-top: 8px !important; font-size: 12px !important; }

/* ── 結果リスト ── */
.tcm-results { margin-top: 16px; }
.tcm-results-label {
    font-size: 11px;
    font-weight: 700;
    color: #1e1e1e;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 12px;
}

/* ── 各アイテム ── */
.tcm-item {
    padding: 12px 0;
    border-top: 1px solid #e0e0e0;
}
.tcm-item--previewing {
    background: #faf5ff;
    padding: 12px 8px;
    border-radius: 6px;
    border: 1px solid #ddd6fe;
    margin-bottom: 4px;
}
.tcm-item--confirmed {
    background: #f0fdf4;
    padding: 12px 8px;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
    margin-bottom: 4px;
}
.tcm-item--held {
    background: #fffbeb;
    padding: 12px 8px;
    border-radius: 6px;
    border: 1px solid #fde68a;
    margin-bottom: 4px;
}

.tcm-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.tcm-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    background: #7c3aed;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.tcm-sentence {
    font-size: 12px;
    color: #3d3d3d;
    line-height: 1.6;
    margin: 0 0 8px;
    font-style: italic;
    border-left: 3px solid #7c3aed;
    padding: 6px 8px;
    background: #faf5ff;
    border-radius: 0 4px 4px 0;
}

/* ── スコアバー ── */
.tcm-score-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.tcm-score-bar-bg {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}
.tcm-score-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.tcm-score-label {
    font-size: 11px;
    font-weight: 700;
    min-width: 32px;
    text-align: right;
}

/* ── ボタン群 ── */
.tcm-btn-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.tcm-btn {
    font-size: 11px !important;
    height: 28px !important;
    flex: 1 !important;
    min-width: 0 !important;
    padding: 0 6px !important;
    justify-content: center !important;
}
.tcm-btn--confirm {
    background: #7c3aed !important;
    border-color: #7c3aed !important;
}
.tcm-btn--confirm:hover { background: #6d28d9 !important; }
.tcm-btn--hold {
    border-color: #d97706 !important;
    color: #d97706 !important;
}
.tcm-btn--hold:hover { background: #fffbeb !important; }
.tcm-btn--reset {
    font-size: 11px !important;
    height: 28px !important;
    padding: 0 8px !important;
}

/* ── 状態ラベル ── */
.tcm-state-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}
.tcm-state--previewing { color: #7c3aed; }
.tcm-state--confirmed  { color: #00a32a; }
.tcm-state--held       { color: #d97706; }

/* ── 確定後の行 ── */
.tcm-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
