/* Components - Buttons, inputs, sliders, custom select */

/* Buttons */
.btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: 6px;
    font-size: var(--text-xs);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
}

.btn:hover {
    opacity: 0.8;
}

.btn:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: var(--surface-variant);
    color: var(--on-surface);
    border: 1px solid var(--border-color);
}

.play-pause-btn,
.font-size-btn,
.fullscreen-btn {
    background: var(--surface-variant);
    border: 1px solid var(--border-color);
    color: var(--on-surface);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 4px;
    font-size: var(--text-xs);
    cursor: pointer;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn {
    min-width: 32px;
    height: 32px;
}

.font-size-controls {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

/* Form elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.form-row.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
}

.form-label.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.form-label.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: var(--text-xs);
    background: var(--surface-color);
    color: var(--on-surface);
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 60px;
    height: 120px;
}

/* Custom Select with Integrated Search */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: var(--text-xs);
    background: var(--surface-color);
    color: var(--on-surface);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s ease;
}

.custom-select-trigger:hover {
    border-color: var(--primary-color);
}

.custom-select-trigger.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

.custom-select-arrow {
    margin-left: 8px;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.custom-select-trigger.active .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    max-height: 320px;
    overflow: hidden;
    flex-direction: column;
}

.custom-select-dropdown.active {
    display: flex;
}

.custom-select-search {
    width: 100%;
    padding: 8px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-xs);
    background: var(--surface-color);
    color: var(--on-surface);
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.custom-select-search:focus {
    outline: none;
    opacity: 1;
    background: var(--surface-variant);
}

.custom-select-options {
    overflow-y: auto;
    max-height: 280px;
}

.custom-select-option {
    padding: 8px;
    font-size: var(--text-xs);
    cursor: pointer;
    transition: background 0.1s ease;
}

.custom-select-option:hover {
    background: var(--primary-color);
    color: white;
}

.custom-select-option.selected {
    background: var(--surface-variant);
    font-weight: 600;
}

.custom-select-option.separator {
    padding: 4px 8px;
    font-size: 10px;
    color: var(--text-secondary);
    cursor: default;
    border-bottom: 1px solid var(--border-color);
}

.custom-select-option.separator:hover {
    background: transparent;
    color: var(--text-secondary);
}

/* Sliders */
.slider-container {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

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

.slider:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
    background: var(--text-secondary);
}

.slider:disabled::-moz-range-thumb {
    cursor: not-allowed;
    background: var(--text-secondary);
}

.slider-value {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--primary-color);
    min-width: 50px;
    text-align: center;
}

.slider-disabled {
    color: var(--text-secondary);
}

.editable-value {
    cursor: text;
    border-radius: 3px;
    padding: 2px 4px;
    transition: background-color 0.2s ease;
}

.editable-value:hover {
    background-color: rgba(0, 122, 255, 0.1);
}

.editable-value:focus {
    outline: none;
    background-color: rgba(0, 122, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}
