/* Toolbar and toggle switch styles */

/* Main toolbar container */
.toolbar {
    background: var(--bg-card);
    /* Recessed panel with industrial texture */
    background-image: radial-gradient(
        circle at 1px 1px,
        rgba(255, 255, 255, 0.02) 1px,
        transparent 0
    );
    background-size: 4px 4px;
    box-shadow:
        var(--shadow-recessed),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 18px 24px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    /* Force rows */
    gap: 20px;
    align-items: stretch;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 4px;
    justify-content: center;
}

/* Ensure Dropdowns in the first group go OVER the second group */
.toolbar-group:first-child {
    position: relative;
    z-index: 50;
}

.toolbar-group:nth-child(2) {
    position: relative;
    z-index: 5;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.control-group label {
    pointer-events: none;
}

/* The Toggles Row */
.toolbar-group:nth-child(2) {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    gap: 48px;
    justify-content: center;
    width: 100%;
}

.toolbar-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-family: "Silkscreen";
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toolbar inputs (LCD Style) */
.toolbar select,
.toolbar input[type="text"] {
    padding: 4px 10px;
    border-radius: 6px;
    border: 2px solid var(--input-border);
    /* Chunky border */

    /* LCD Screen Look */
    background: var(--bg-input);
    box-shadow:
        inset 2px 2px 6px rgba(0, 0, 0, 0.6),
        inset -1px -1px 0 rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: "DotGothic16";
    text-transform: uppercase;
    transition: all 0.2s ease;

    /* Scanline effect */
    background-image: linear-gradient(
        var(--input-scanline) 1px,
        transparent 1px
    );
    background-size: 100% 3px;
    height: 34px;
}

/* Custom Select Styling */
.toolbar select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;

    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-gold) 50%),
        linear-gradient(135deg, var(--text-gold) 50%, transparent 50%),
        linear-gradient(var(--input-scanline) 1px, transparent 1px);
    background-position:
        calc(100% - 15px) calc(50% + 2px),
        calc(100% - 10px) calc(50% + 2px),
        0 0;
    background-size:
        4px 4px,
        4px 4px,
        100% 3px;
    background-repeat: no-repeat, no-repeat, repeat;
    padding-right: 30px;
}

.toolbar input[type="text"] {
    width: 170px;
}

.toolbar input[type="text"]::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

#filter-select,
.custom-dropdown[data-for="filter-select"] {
    width: 170px;
    /* Shrunk filter box */
}

/* Focus states */
.toolbar select:focus,
.toolbar input:focus {
    outline: none;
    border-color: var(--text-gold);
    box-shadow:
        inset 2px 2px 6px rgba(0, 0, 0, 0.6),
        0 0 8px rgba(215, 153, 33, 0.2);
    background-color: var(--bg-input-focus);
}

/* Select Hover only (Buttons) */
.toolbar select:hover {
    outline: none;
    border-color: var(--text-gold);
    background-color: var(--bg-input-focus);
}

/* Toggle Switch Component (Pokedex Jewel Button) */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 4px 0;
}

.toggle-switch:hover .toggle-slider {
    box-shadow:
        inset 0 4px 8px rgba(0, 0, 0, 0.8),
        0 1px 6px rgba(255, 255, 255, 0.1);
}

.toggle-switch:hover .toggle-slider::after {
    filter: brightness(1.2);
}

.toggle-switch:hover .toggle-label {
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--jewel-well);
    /* Deep well */
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.8),
        0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dark-bg-2);
    flex-shrink: 0;
}

/* The Jewel Button */
.toggle-slider::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: linear-gradient(
        135deg,
        var(--jewel-off-start) 0%,
        var(--jewel-off-end) 100%
    );
    /* Off state */
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 2;
}

/* Active State Colors */
#mark-mode-toggle:checked + .toggle-slider::after {
    background: radial-gradient(
        circle at 30% 30%,
        var(--gruv-bright-red),
        var(--gruv-dark-red)
    );
    box-shadow:
        0 0 10px var(--gruv-dark-red),
        inset 0 1px 2px rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

#box-mark-toggle:checked + .toggle-slider::after {
    background: radial-gradient(
        circle at 30% 30%,
        var(--gruv-bright-blue),
        var(--gruv-dark-blue)
    );
    box-shadow:
        0 0 10px var(--gruv-dark-blue),
        inset 0 1px 2px rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

#shiny-toggle:checked + .toggle-slider::after {
    background: radial-gradient(
        circle at 30% 30%,
        var(--gruv-bright-yellow),
        var(--gruv-dark-yellow)
    );
    box-shadow:
        0 0 10px var(--gruv-dark-yellow),
        inset 0 1px 2px rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

/* Glass Shine on Jewel */
.toggle-slider::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 3px;
    width: 6px;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50% 50% 0 0;
    z-index: 3;
    pointer-events: none;
    transform: rotate(-15deg);
}

.toggle-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    font-family: "Silkscreen";
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.toggle-switch input:checked ~ .toggle-label {
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

/* Disabled Toggle State */
.toggle-switch.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

.toggle-switch input:disabled + .toggle-slider::after {
    background: var(--gruv-dark-bg);
    box-shadow: none;
}

/* Quick jump select */
.quick-jump-select,
.custom-dropdown[data-for="quick-jump"] {
    width: 220px;
}
