/* CSSグラデーション ジェネレーター（css/gradient）
   色は Bootstrap の変数で組み、ライト／ダークで自動的に切り替える。 */

#app-gradient {
    max-width: 1200px;
}

/* ---------- 配置: スマホは プレビュー → 設定 → コード、PC は左に設定・右にプレビューとコード ---------- */
#app-gradient .gr-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "preview" "controls" "code";
    gap: 1rem;
}

#app-gradient .gr-preview-wrap { grid-area: preview; }
#app-gradient .gr-controls { grid-area: controls; }
#app-gradient .gr-code { grid-area: code; }

@media (min-width: 992px) {
    #app-gradient .gr-layout {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        grid-template-areas: "controls preview" "controls code";
        grid-template-rows: auto 1fr;
        align-items: start;
    }
    #app-gradient .gr-preview-wrap {
        position: sticky;
        top: 1rem;
    }
}

/* ---------- 透明の見える市松模様 ---------- */
#app-gradient .gr-checker,
#app-gradient .gr-bar-checker {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #d9d9d9 25%, transparent 25%),
        linear-gradient(-45deg, #d9d9d9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d9d9d9 75%),
        linear-gradient(-45deg, transparent 75%, #d9d9d9 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: 4px;
    overflow: hidden;
}

#app-gradient .gr-checker {
    border: 1px solid var(--bs-border-color);
}

#app-gradient .gr-preview {
    height: 240px;
}

@media (min-width: 992px) {
    #app-gradient .gr-preview { height: 340px; }
}

/* ---------- 設定のかたまり ---------- */
#app-gradient .gr-block {
    padding: .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
    background: var(--bs-body-bg);
    margin-bottom: .75rem;
}

#app-gradient .gr-label {
    font-weight: 700;
    font-size: .9rem;
    margin-bottom: .5rem;
}

#app-gradient .gr-optgroup {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: .4rem;
    max-width: 22rem;
}

#app-gradient .gr-optgroup .btn {
    white-space: nowrap;
}

/* ---------- 停止点のバー ---------- */
#app-gradient .gr-bar-checker {
    margin: 0 11px; /* つまみが端ではみ出さないように */
    border: 1px solid var(--bs-border-color);
    overflow: visible;
}

#app-gradient .gr-bar {
    position: relative;
    height: 36px;
    border-radius: 3px;
    cursor: copy;
    touch-action: none;
}

#app-gradient .gr-handle {
    position: absolute;
    top: 50%;
    width: 22px;
    height: 44px;
    margin-left: -11px;
    transform: translateY(-50%);
    padding: 0;
    border: 3px solid #fff;
    border-radius: 6px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .55);
    cursor: grab;
    touch-action: none;
}

#app-gradient .gr-handle.is-selected {
    box-shadow: 0 0 0 2px var(--bs-body-bg), 0 0 0 4px var(--bs-primary);
    z-index: 2;
}

#app-gradient .gr-handle:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 3px;
}

#app-gradient .gr-handle.is-dragging {
    cursor: grabbing;
}

/* ---------- 選んだ停止点の欄 ---------- */
#app-gradient .gr-stop-edit {
    display: grid;
    grid-template-columns: auto 6.5rem minmax(0, 1fr);
    align-items: end;
    gap: .75rem;
}

#app-gradient .gr-stop-edit .form-control-color {
    width: 3.5rem;
}

#app-gradient .gr-stop-edit .form-range {
    height: calc(1.5em + .5rem + 2px);
}

@media (max-width: 575.98px) {
    #app-gradient .gr-stop-edit {
        grid-template-columns: auto minmax(0, 1fr);
    }
    #app-gradient .gr-stop-alpha {
        grid-column: 1 / -1;
    }
}

/* スライダーと数値欄を横に並べる */
#app-gradient .gr-rangenum {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 5.5rem;
    align-items: center;
    gap: .75rem;
}

#app-gradient .gr-center {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

/* ---------- プリセット ---------- */
#app-gradient .gr-presets {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .4rem;
}

#app-gradient .gr-preset {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
    padding: .3rem;
    font-size: .8rem;
    white-space: nowrap;
}

#app-gradient .gr-preset-swatch {
    display: block;
    height: 28px;
    border-radius: 3px;
}

/* ---------- コード ---------- */
#app-gradient .gr-code {
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bs-body-bg);
}

#app-gradient .gr-code-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .75rem;
    background: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
}

#app-gradient .gr-code-head .btn {
    white-space: nowrap;
}

#app-gradient .gr-out {
    border: 0;
    border-radius: 0;
    resize: vertical;
    font-size: .9rem;
    background: var(--bs-body-bg);
}
