/* ==========================================================================
   COMPONENTS - Buttons, Cards, Form Controls
   ========================================================================== */

/* Allgemeiner, eckiger Button-Stil */
button,
select,
input,
textarea{
    font: inherit;
    color: inherit;
}

button{
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pill-Buttons = rechteckig mit klarer Border */
.pill{
    border: 1px solid var(--hairline);
    border-radius: 4px;
    background: transparent;
    color: var(--paper);
    min-width: 0;
    padding: 10px 14px;
    cursor: pointer;
    transition: transform .12s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.pill:hover{
    transform: translateY(-1px);
    border-color: var(--hairline);
    background: transparent;
    box-shadow: none;
}

.pill:active{
    transform: translateY(0);
}

.pill.selected{
    border-color: var(--primary);
    background: transparent;
    box-shadow: none;
}

/* Deaktiviert sichtbar machen */
.is-disabled,
button[disabled],
[aria-disabled="true"]{
    opacity: .2;
    pointer-events: none;
    filter: grayscale(20%);
}

/* Form */
.form .control{ margin-bottom: 14px; }
.form label{
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--paper);
}
.form .value{ color: var(--ink-2); }
.form input[type="range"]{ width: 100%; }

.form input[type="range"],
#panel-editor input[type="range"]{
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 999px;
    background: var(--glow-primary-soft);
    box-shadow: inset 0 0 0 1px rgba(var(--shadow-rgb), 0.18);
}

.form input[type="range"]::-webkit-slider-runnable-track,
#panel-editor input[type="range"]::-webkit-slider-runnable-track{
    height: 4px;
    border-radius: 999px;
    background: var(--glow-primary-soft);
}

.form input[type="range"]::-webkit-slider-thumb,
#panel-editor input[type="range"]::-webkit-slider-thumb{
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--outline-contrast);
    box-shadow: 0 4px 12px var(--glow-primary-medium);
    margin-top: -4px;
    transition: transform .15s ease;
}

.form input[type="range"]::-webkit-slider-thumb:active,
#panel-editor input[type="range"]::-webkit-slider-thumb:active{
    transform: scale(0.94);
}

.form input[type="range"]::-moz-range-track,
#panel-editor input[type="range"]::-moz-range-track{
    height: 4px;
    border-radius: 999px;
    background: var(--glow-primary-soft);
}

.form input[type="range"]::-moz-range-thumb,
#panel-editor input[type="range"]::-moz-range-thumb{
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--outline-contrast);
    box-shadow: 0 4px 12px var(--glow-primary-medium);
    transition: transform .15s ease;
}

.form input[type="range"]::-moz-range-thumb:active,
#panel-editor input[type="range"]::-moz-range-thumb:active{
    transform: scale(0.94);
}

/* Dropdowns & Zahleneingaben im Umgebungs-Panel */
#panel-editor select.pill,
#panel-editor input.pill,
select.pill{
    background: transparent;
    color: var(--ink);
    border-color: var(--hairline);
    box-shadow: none;
}

#panel-editor select.pill.level-select{
    padding: 6px 10px;
    font-size: 12px;
    min-height: 30px;
}

#panel-editor input.pill::placeholder{
    color: var(--ink-2);
}

select.pill{
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--ink) 50%),
        linear-gradient(-45deg, transparent 50%, var(--ink) 50%),
        linear-gradient(90deg, transparent 50%, transparent 50%);
    background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%, 100% 0;
    background-size: 6px 6px, 6px 6px, 2.5rem 100%;
    background-repeat: no-repeat;
    padding-right: 2.75rem;
}

#panel-editor select.pill:focus,
select.pill:focus{
    border-color: var(--primary);
    outline: none;
    box-shadow: none;
}

select.pill option,
select.pill optgroup{
    background-color: var(--control-surface-strong) !important;
    color: var(--ink);
}

select.pill option:hover,
select.pill option:focus{
    background-color: var(--primary-hover) !important;
    color: var(--ink) !important;
}

select.pill option:checked,
select.pill option:checked:hover,
select.pill option:checked:focus{
    background-color: var(--primary) !important;
    color: var(--paper) !important;
}

select.pill option:is(:hover, :focus)::selection{
    background: var(--primary-hover);
    color: var(--ink);
}

/* Reusable rows */
.row{ display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.row.wrap{ flex-wrap: wrap; }
.row.spaced{ justify-content: space-between; }
.row-label{
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Environment panel layout */
#panel-editor .panel-content{
    padding: 3px 2px;
    font-size: 15px;
}

#editor-tabs{
    padding: 6px 6px 4px;
    border-radius: 10px;
    background: var(--control-surface);
}

#editor-tabs .editor-tab-list{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 2px;
    padding: 0 2px;
    border: none;
    background: none;
}

#editor-tabs .editor-tab-btn{
    flex: 1 1 0;
    min-width: 0;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 8px 6px;
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    text-align: center;
    position: relative;
    font-weight: 600;
    opacity: 1;
}

#editor-tabs .editor-tab-btn:not(.active){
    opacity: 0.35;
    color: rgba(var(--ink-rgb), 0.5);
    font-weight: 500;
}

#editor-tabs .editor-tab-btn.active{
    border-bottom-color: var(--primary);
    color: var(--paper);
    font-weight: 700;
    opacity: 1;
    text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.35);
}

#editor-tabs .editor-tab-btn.active:hover{
    border-bottom-color: var(--primary);
    color: var(--paper);
}

#editor-tabs .editor-tab-btn:not(.active):hover{
    border-bottom-color: rgba(var(--primary-rgb), 0.4);
    color: rgba(var(--ink-rgb), 0.7);
    opacity: 0.55;
}

#panel-editor .editor-tab-panel{
    padding: 4px 0 0;
    border: none;
    border-radius: 0;
    background: none;
}

#panel-editor .widget-frame{
    padding: 4px 0;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
}

#panel-editor .config-block + .config-block{
    margin-top: 20px;
}

#panel-editor .widget-frame.widget-frame-plain{
    background: none;
    border: none;
    box-shadow: none;
}

#panel-editor .widget-frame + .widget-frame{
    margin-top: 30px;
    border-top: none;
}

#panel-editor .widget-frame > h3{
    margin: 0 0 10px 0;
    font-size: 10.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-2);
}

#panel-editor .pill{
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#panel-editor .row{
    flex-wrap: wrap;
}

#panel-editor .row-label{
    flex-wrap: wrap;
    gap: 10px;
    font-weight: 600;
    color: var(--paper);
}

@media (max-width: 540px){
    .pill{
        white-space: normal;
        line-height: 1.3;
        flex-wrap: wrap;
        justify-content: flex-start;
        text-align: left;
    }
}
