/* RGBW ovladac - barvy jen pres promenne z css/style.css (svetly / tmavy motiv) */

/* --- Nahled barvy (kolecko): vlevo RGB (--rgb), vpravo bily kanal (pruhlednost --wa) --- */
.RGBWCtlSwatch {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: var(--rgb, var(--off));
    box-shadow: 0 0 0 1px var(--line) inset;
    transition: box-shadow .3s;
}

.RGBWCtlSwatch.RGBWCtlUseW::before,
.RGBWCtlSwatch.RGBWCtlUseW::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    right: 0;
}

.RGBWCtlSwatch.RGBWCtlUseW::before {
    background: var(--off);
}

.RGBWCtlSwatch.RGBWCtlUseW::after {
    background: #ffffff;
    opacity: var(--wa, 0);
}

/* --- main.html: karta v seznamu --- */
.RGBWCtlItem {
    padding: 8px 12px;
}

.RGBWCtlHead {
    display: flex;
    align-items: center;
    gap: 12px;
}

.RGBWCtlHead .ItemIconBox,
.RGBWCtlText {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.RGBWCtlText {
    flex: 1;
    min-width: 0;
}

.RGBWCtlName {
    font-size: var(--item-name-fs);
    font-weight: var(--item-name-fw);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.RGBWCtlDesc {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: var(--item-desc-fs);
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
}

.RGBWCtlDesc span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.RGBWCtlDesc i {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dot, currentColor);
}

.RGBWCtlItem.ItemOn .RGBWCtlDesc {
    color: var(--text);
}

.RGBWCtlHead .RGBWCtlSwatch {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ItemOn .RGBWCtlHead .RGBWCtlSwatch {
    box-shadow: 0 0 0 1px var(--line) inset, 0 0 12px var(--glow, transparent);
}

.RGBWCtlQuickOpen .RGBWCtlHead .RGBWCtlSwatch {
    box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent);
}

.RGBWCtlItem .Toggle,
.RGBWCtlHero .Toggle {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Rychla volba nalad - rozbali se pod kartou */
.RGBWCtlQuick {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.RGBWCtlQuickOpen .RGBWCtlQuick {
    display: flex;
}

.RGBWCtlChip {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 10px 5px 5px;
    border-radius: 16px;
    background: var(--hover);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border: 1px solid transparent;
    transition: border-color .15s, transform .1s;
}

.RGBWCtlChip span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.RGBWCtlChip .RGBWCtlSwatch {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
}

.RGBWCtlChip:active {
    transform: scale(.95);
}

.RGBWCtlChip.RGBWCtlSceneOn {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- Podstranky --- */
.RGBWCtlLayout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.RGBWCtlLayout > .ItemObject {
    margin-bottom: 0;
}

.RGBWCtlLabel {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 6px 4px 0;
}

/* Stav */
.RGBWCtlHero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 14px 16px;
}

.RGBWCtlLamp {
    flex: 0 0 76px;
    height: 76px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 50% 45%, var(--lamp, var(--line)) 0%, var(--lamp, var(--line)) 45%, transparent 72%);
    transition: background .3s;
}

.RGBWCtlLamp svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4));
}

.RGBWCtlOff .RGBWCtlLamp {
    background: radial-gradient(circle, var(--line) 0%, var(--line) 45%, transparent 72%);
}

.RGBWCtlOff .RGBWCtlLamp svg {
    stroke: var(--muted);
    filter: none;
}

.RGBWCtlHeroText {
    flex: 1;
    min-width: 0;
}

.RGBWCtlBig {
    font-size: 20px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.RGBWCtlSub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

/* Editor */
.RGBWCtlEditor {
    padding: 14px;
}

.RGBWCtlSeg {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 12px;
    background: var(--line);
}

.RGBWCtlSeg span {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, color .15s;
}

.RGBWCtlSeg span.RGBWCtlSegOn {
    background: var(--card);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.RGBWCtlWheel {
    display: flex;
    justify-content: center;
    padding: 14px 0 4px;
}

.RGBWCtlSliderName {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin: 12px 0 -4px 28px;
}

.RGBWCtlSlider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.RGBWCtlSlider svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.RGBWCtlVal {
    flex: 0 0 50px;
    text-align: right;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Barevne drahy posuvniku - prebiji vyplnenou drahu z css/style.css */
.RGBWCtlSlider .Range::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 4px;
    background: var(--track);
    box-shadow: 0 0 0 1px var(--line) inset;
}

.RGBWCtlSlider .Range::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: var(--track);
}

.RGBWCtlSlider .Range::-moz-range-progress {
    background: transparent;
}

.RGBWCtlSlider .Range::-webkit-slider-thumb {
    margin-top: -8px;
}

.RGBWCtlRangeKelvin {
    --track: linear-gradient(to right, #ffa757, #ffd2a6, #fff1e6, #f0f1ff, #d6e1ff);
}

.RGBWCtlRangeBright {
    --track: linear-gradient(to right, #000000, var(--hue, #ffffff));
}

.RGBWCtlRangeWhite {
    --track: linear-gradient(to right, var(--off), #ffffff);
}

/* Predvolby teploty bile */
.RGBWCtlPresets {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.RGBWCtlPresets span {
    flex: 1;
    height: 30px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 600;
    color: #3b3b3b;
    box-shadow: 0 0 0 1px var(--line) inset;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .1s;
}

.RGBWCtlPresets span:active {
    transform: scale(.95);
}

/* Cekani na server (prepnuti editoru, nalada, vypinac) */
.RGBWCtlLayout.ItemPending .RGBWCtlSeg,
.RGBWCtlLayout.ItemPending .RGBWCtlScenes {
    opacity: .6;
    transition: opacity .2s;
}

/* Nalady jako dlazdice */
.RGBWCtlScenes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
}

.RGBWCtlScene {
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 10px 8px 9px;
    text-align: center;
    border: 2px solid transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .15s, transform .1s;
}

.RGBWCtlScene:active {
    transform: scale(.96);
}

.RGBWCtlScene .RGBWCtlSwatch {
    display: block;
    width: 34px;
    height: 34px;
    margin: 0 auto 6px;
}

.RGBWCtlSceneName {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.RGBWCtlScene.RGBWCtlSceneOn {
    border-color: var(--accent);
}

.RGBWCtlScene.RGBWCtlSceneOn .RGBWCtlSceneName {
    color: var(--accent);
}

/* --- RGBWCtlOptions.html --- */
.RGBWCtlAction {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity .2s;
}

.RGBWCtlAction .RGBWCtlSwatch {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
}

.RGBWCtlActionText {
    flex: 1;
    min-width: 0;
}

.RGBWCtlActionText b {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.RGBWCtlActionText small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

/* Neni vybrana nalada - neni co aktualizovat */
.RGBWCtlAction.RGBWCtlDisabled {
    opacity: .45;
    pointer-events: none;
}

.RGBWCtlRow {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.RGBWCtlRow .RGBWCtlSwatch {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
}

.ItemObject input.RGBWCtlInput,
.ItemObject input.RGBWCtlNewName {
    flex: 1;
    min-width: 0;
    width: auto;
    margin: 0;
    padding: 8px 10px;
    font: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--hover);
    border: 1px solid transparent;
    border-radius: 9px;
    outline: none;
}

.ItemObject input.RGBWCtlInput:focus,
.ItemObject input.RGBWCtlNewName:focus {
    border-color: var(--accent);
    background: var(--card);
}

.RGBWCtlHint {
    padding: 0 14px 10px;
    font-size: 12px;
    color: var(--muted);
}

.RGBWCtlEditList .ItemObject {
    margin-bottom: 8px;
}

.RGBWCtlBtn {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: var(--muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, color .15s;
}

.RGBWCtlBtn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.RGBWCtlBtn:active {
    background: var(--hover);
}

.RGBWCtlBtn.RGBWCtlBtnMain {
    background: var(--accent);
    color: #ffffff;
}

.RGBWCtlBtn.RGBWCtlBtnHide {
    visibility: hidden;
}

/* Mazani nalady - 1. klik pozada o potvrzeni, 2. klik smaze */
.RGBWCtlBtnDel.RGBWCtlBtnConfirm {
    flex-basis: auto;
    width: auto;
    padding: 0 10px;
    background: var(--danger);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.RGBWCtlMove {
    display: flex;
    flex-direction: column;
}

.RGBWCtlMove .RGBWCtlBtn {
    height: 20px;
}

@media only screen and (hover: hover) and (pointer: fine) {
    .RGBWCtlBtn:hover:not(.RGBWCtlBtnMain):not(.RGBWCtlBtnConfirm) {
        background: var(--hover);
        color: var(--text);
    }

    .RGBWCtlBtnDel:hover:not(.RGBWCtlBtnConfirm) {
        color: var(--danger);
    }

    .RGBWCtlChip:hover:not(.RGBWCtlSceneOn),
    .RGBWCtlScene:hover:not(.RGBWCtlSceneOn) {
        border-color: var(--line);
    }
}
