/**
 * Panel, button and utility styles.
 * These rules must not depend on the site template.
 */

.vi-toggle,
.vi-toggle *,
.vi-panel,
.vi-panel * {
    box-sizing: border-box;
}

/* Button */
.vi-toggle {
    position: fixed;
    bottom: 20px;
    z-index: 99990;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border: 2px solid #1a1a1a;
    border-radius: 8px;
    background: #fff;
    color: #1a1a1a;
    font: 600 14px/1.2 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.vi-toggle--right {
    right: 20px;
}

.vi-toggle--left {
    left: 20px;
}

.vi-toggle:hover {
    background: #f2f2f2;
}

.vi-toggle:focus-visible {
    outline: 3px solid #0b5fff;
    outline-offset: 2px;
}

.vi-toggle[hidden] {
    display: none !important;
}

.vi-toggle__icon {
    display: inline-flex;
    flex: 0 0 auto;
}

/* Dialog */
.vi-panel {
    position: fixed;
    inset: 0;
    z-index: 100000;
    width: min(560px, calc(100vw - 24px));
    max-height: min(90vh, 760px);
    margin: auto;
    padding: 0;
    overflow: auto;
    border: 1px solid #767676;
    border-radius: 12px;
    background: #fff !important;
    color: #111 !important;
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.vi-panel:not([open]) {
    display: none;
}

.vi-panel--open {
    display: block !important;
}

.vi-panel::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.vi-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #d0d0d0;
    background: #fff !important;
}

.vi-panel__title {
    margin: 0;
    color: #111 !important;
    font-size: 1.25rem;
    line-height: 1.3;
}

.vi-panel__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #767676;
    border-radius: 8px;
    background: #fff !important;
    color: #111 !important;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.vi-panel__close:hover {
    background: #f2f2f2 !important;
}

.vi-panel__form {
    padding: 8px 20px 20px;
}

.vi-field {
    margin: 0;
    padding: 16px 0;
    border: 0;
    border-bottom: 1px solid #e2e2e2;
}

.vi-field:last-of-type {
    border-bottom: 0;
}

.vi-field__legend {
    padding: 0;
    margin-bottom: 10px;
    color: #111 !important;
    font-size: 1rem;
    font-weight: 700;
}

.vi-options {
    display: grid;
    gap: 4px;
}

.vi-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 6px 8px;
    border-radius: 8px;
    color: #111 !important;
    cursor: pointer;
}

.vi-option:hover {
    background: #f2f2f2;
}

.vi-option:focus-within {
    outline: 2px solid #0b5fff;
    outline-offset: 1px;
}

.vi-option input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #0b5fff;
}

.vi-option--scheme {
    display: grid;
    grid-template-columns: 20px 40px 1fr;
    align-items: center;
}

.vi-swatch {
    display: inline-block;
    width: 38px;
    height: 26px;
    border: 1px solid #767676;
    border-radius: 4px;
}

.vi-swatch--wb {
    background: #fff;
    color: #000;
    box-shadow: inset 0 0 0 8px #fff, inset 0 0 0 10px #000;
}

.vi-swatch--bw {
    background: #000;
    box-shadow: inset 0 0 0 8px #000, inset 0 0 0 10px #fff;
}

.vi-swatch--blue {
    background: #9dd1ff;
    box-shadow: inset 0 0 0 8px #9dd1ff, inset 0 0 0 10px #063462;
}

.vi-swatch--yellow {
    background: #ffff00;
    box-shadow: inset 0 0 0 8px #ffff00, inset 0 0 0 10px #000;
}

.vi-swatch--green {
    background: #000;
    box-shadow: inset 0 0 0 8px #000, inset 0 0 0 10px #00ff00;
}

.vi-swatch--beige {
    background: #f5f5dc;
    box-shadow: inset 0 0 0 8px #f5f5dc, inset 0 0 0 10px #8b4513;
}

.vi-panel__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
}

.vi-panel__actions button {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid #767676;
    border-radius: 8px;
    font: 600 15px/1.2 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    cursor: pointer;
}

.vi-reset {
    background: #fff !important;
    color: #111 !important;
}

.vi-apply {
    background: #0b5fff !important;
    border-color: #0b5fff !important;
    color: #fff !important;
}

.vi-reset:hover {
    background: #f2f2f2 !important;
}

.vi-apply:hover {
    background: #084ad0 !important;
}

.vi-panel button:focus-visible,
.vi-panel input:focus-visible {
    outline: 3px solid #0b5fff;
    outline-offset: 2px;
}

/* Screen reader only live region */
.vi-live {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Images off mode */
html.vi-no-images img[data-vi-img="1"] {
    display: none !important;
}

/* Images greyscale mode */
html.vi-gray-images img {
    filter: grayscale(1) !important;
}

html.vi-no-images [style*="background-image"] {
    background-image: none !important;
}

.vi-alt-text {
    display: inline-block;
    margin: 0.35em 0;
    padding: 0.3em 0.6em;
    border: 1px dashed currentColor;
    border-radius: 4px;
    font-size: 0.95em;
    line-height: 1.4;
}

/* Mobile and print */
@media (max-width: 767px) {
    .vi-toggle {
        bottom: 12px;
        font-size: 13px;
    }

    .vi-toggle--right {
        right: 12px;
    }

    .vi-toggle--left {
        left: 12px;
    }

    .vi-toggle--no-mobile {
        display: none !important;
    }
}

@media print {
    .vi-toggle,
    .vi-panel {
        display: none !important;
    }
}
