/**
 * Theme Switcher – estilos del widget.
 */

/* --- Wrapper para colocar el widget en línea --- */
.theme-selector-wrapper {
    display: flex;
    align-items: center;
    margin-right: 1rem;
}

/* --- Píldora contenedora --- */
.theme-toggle-pill {
    display: flex;
    position: relative;
    background-color: var(--theme-switcher-bg, #f8f9fa);
    border: 1px solid var(--theme-switcher-border, #dee2e6);
    border-radius: 50rem;
    padding: 3px;
    align-items: center;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 140px;
}

[data-theme='dark'] .theme-toggle-pill {
    --theme-switcher-bg: #343a40;
    --theme-switcher-border: #495057;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* --- Slider deslizante --- */
.theme-toggle-slider {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc((100% - 6px) / 3);
    background-color: var(--theme-switcher-slider-bg, #ffffff);
    border-radius: 50rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] .theme-toggle-slider {
    --theme-switcher-slider-bg: #495057;
}

.theme-toggle-pill[data-active-theme='light'] .theme-toggle-slider {
    transform: translateX(0);
}

.theme-toggle-pill[data-active-theme='auto'] .theme-toggle-slider {
    transform: translateX(100%);
}

.theme-toggle-pill[data-active-theme='dark'] .theme-toggle-slider {
    transform: translateX(200%);
}

/* --- Botones de opción --- */
.theme-option {
    position: relative;
    z-index: 2;
    background: transparent;
    border: none;
    border-radius: 50rem;
    padding: 6px 0;
    margin: 0;
    cursor: pointer;
    color: var(--theme-switcher-icon-color, #212529);
    transition: color 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    opacity: 0.6;
}

.theme-option i,
.theme-option svg {
    width: 16px;
    height: 16px;
}

.theme-option:hover {
    opacity: 1;
}

.theme-option.active {
    color: var(--theme-switcher-active-color, #199daa);
    opacity: 1;
}

[data-theme='dark'] .theme-option {
    --theme-switcher-icon-color: #ffffff;
}

[data-theme='dark'] .theme-option.active {
    color: var(--theme-switcher-active-color, #199daa);
}

/* --- Dropdown Mode --- */
.theme-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.theme-dropdown-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--theme-switcher-icon-color, #212529);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.theme-dropdown-toggle:hover {
    background-color: var(--theme-switcher-bg, #f8f9fa);
}

[data-theme='dark'] .theme-dropdown-toggle {
    color: #ffffff;
}

[data-theme='dark'] .theme-dropdown-toggle:hover {
    background-color: #343a40;
}

.theme-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: var(--theme-switcher-bg, #ffffff);
    border: 1px solid var(--theme-switcher-border, #dee2e6);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 150px;
    display: none;
    flex-direction: column;
    z-index: 1000;
    padding: 4px;
}

.theme-dropdown-wrapper.open .theme-dropdown-menu {
    display: flex;
}

[data-theme='dark'] .theme-dropdown-menu {
    --theme-switcher-bg: #212529;
    --theme-switcher-border: #495057;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

.theme-dropdown-menu .theme-option {
    justify-content: flex-start;
    padding: 8px 12px;
    border-radius: 4px;
    opacity: 0.8;
}

.theme-dropdown-menu .theme-option:hover {
    background-color: var(--theme-switcher-hover-bg, #f1f3f5);
}

[data-theme='dark'] .theme-dropdown-menu .theme-option:hover {
    --theme-switcher-hover-bg: #343a40;
}

.theme-option-label {
    margin-left: 10px;
    font-size: 14px;
}