/*
© 2025 Sharon Aicler (saichler@gmail.com)

Layer 8 Ecosystem is licensed under the Apache License, Version 2.0.
*/
/* Extended Form Field Styles: toggle, slider, tags, multiselect, richtext */

/* ========================================
   TOGGLE SWITCH
   ======================================== */
.l8-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.l8-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.l8-toggle-track {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    background: var(--layer8d-border, #cbd5e0);
    border-radius: 11px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.l8-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--layer8d-bg-white, #fcfbf8);
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.l8-toggle-input:checked + .l8-toggle-track {
    background: var(--layer8d-primary, #4299e1);
}

.l8-toggle-input:checked + .l8-toggle-track .l8-toggle-thumb {
    transform: translateX(18px);
}

.l8-toggle-input:focus + .l8-toggle-track {
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3);
}

.l8-toggle-input:disabled + .l8-toggle-track {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   SLIDER / RANGE
   ======================================== */
.l8-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.l8-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--layer8d-border, #cbd5e0);
    border-radius: 3px;
    outline: none;
}

.l8-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--layer8d-primary, #4299e1);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--layer8d-bg-white, #fcfbf8);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.l8-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--layer8d-primary, #4299e1);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--layer8d-bg-white, #fcfbf8);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.l8-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.l8-slider-value {
    min-width: 36px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--layer8d-text-dark, #2d3748);
    background: var(--layer8d-bg-input, #f1f5f9);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ========================================
   TAGS / CHIPS INPUT
   ======================================== */
.l8-tags-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.l8-tags-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 24px;
}

.l8-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--layer8d-primary, #4299e1);
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.4;
}

.l8-tag-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.8;
}

.l8-tag-remove:hover {
    opacity: 1;
}

.l8-tags-input {
    border: 1px solid var(--layer8d-border, #cbd5e0);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    outline: none;
}

.l8-tags-input:focus {
    border-color: var(--layer8d-primary, #4299e1);
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.2);
}

/* ========================================
   MULTI-SELECT DROPDOWN
   ======================================== */
.l8-multiselect-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.l8-multiselect-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 24px;
}

.l8-multiselect-trigger {
    border: 1px solid var(--layer8d-border, #cbd5e0);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    background: var(--layer8d-bg-input, #efeae1);
    color: var(--layer8d-text-muted, #718096);
}

.l8-multiselect-trigger:hover {
    border-color: var(--layer8d-primary, #4299e1);
}

.l8-multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--layer8d-bg-card, #fdfbf7);
    border: 1px solid var(--layer8d-border, #cbd5e0);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.l8-multiselect-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

.l8-multiselect-option:hover {
    background: var(--layer8d-bg-hover, #f7fafc);
}

/* ========================================
   RICH TEXT EDITOR
   ======================================== */
.l8-richtext-wrapper {
    border: 1px solid var(--layer8d-border, #cbd5e0);
    border-radius: 4px;
    overflow: hidden;
}

.l8-richtext-toolbar {
    display: flex;
    gap: 2px;
    padding: 4px 6px;
    background: var(--layer8d-bg-input, #f1f5f9);
    border-bottom: 1px solid var(--layer8d-border, #cbd5e0);
}

.l8-richtext-toolbar button {
    background: none;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--layer8d-text-dark, #2d3748);
    min-width: 28px;
}

.l8-richtext-toolbar button:hover {
    background: var(--layer8d-bg-hover, #e2e8f0);
    border-color: var(--layer8d-border, #cbd5e0);
}

.l8-richtext-editor {
    min-height: 100px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.5;
    outline: none;
    overflow-y: auto;
    max-height: 300px;
}

.l8-richtext-editor:focus {
    box-shadow: inset 0 0 0 1px var(--layer8d-primary, #4299e1);
}

.l8-richtext-editor ul, .l8-richtext-editor ol {
    padding-left: 20px;
    margin: 4px 0;
}

.l8-richtext-editor li {
    margin: 2px 0;
}
