/* KHL Image Configurator — Frontend CSS */

.khl-image-configurator {
    margin: 20px 0;
    font-family: inherit;
}

/* Preview + Ruler — stijl: gestippelde lijnen met labels buiten */
.khl-image-preview-wrap {
    display: inline-block;
    margin: 40px 0 20px 0; /* extra ruimte bovenaan voor ruler label */
    position: relative;
}

/* Ruler boven: gestippelde lijn boven de afbeelding */
.khl-image-ruler-top {
    position: relative;
    height: 24px;
    margin-bottom: 4px;
    /* breedte via JS */
}
.khl-image-ruler-top::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    border-top: 2px dashed #555;
}
.khl-image-ruler-top::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    border-left: 2px solid #555;
}
.khl-ruler-width-label {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    background: transparent;
}
/* Rechter eindstreep ruler top */
.khl-image-ruler-top-end {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    border-right: 2px solid #555;
}

.khl-image-preview-row {
    display: flex;
    align-items: flex-start;
}

/* Ruler top staat BOVEN de img, uitgelijnd met de img (niet met ruler-left) */
.khl-image-ruler-top-wrap {
    display: flex;
    /* Uitlijnen met start van de SVG: gebruik dezelfde offset als de linker ruler + gap.
       Vermijd hardcoded 28px (kan fout lopen bij theme CSS/box-sizing). */
    margin-left: calc(24px + 4px);
}

/* Ruler links: gestippelde lijn links van de afbeelding */
.khl-image-ruler-left {
    position: relative;
    width: 24px;
    margin-right: 4px;
    flex-shrink: 0;
    /* hoogte via JS */
}

/* Zorg dat de linker ruler exact bovenaan de SVG begint, niet mee-centeren door flex/line-height */
.khl-image-preview-row {
    align-items: flex-start;
}

.khl-image-preview-box,
.khl-image-ruler-left {
    align-self: flex-start;
}
.khl-image-ruler-left::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    border-left: 2px dashed #555;
}
.khl-image-ruler-left::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    border-top: 2px solid #555;
}
.khl-ruler-height-label {
    position: absolute;
    top: 50%;
    right: -4px;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: center center;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    left: -30px;
}
/* Ondereindstreep ruler links */
.khl-image-ruler-left-end {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    border-bottom: 2px solid #555;
}

/* Geen witte box */
.khl-image-preview-box {
    background-color: #e0e0e0;
    /* Light checkerboard by default */
    background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMCAxMEgxMFYyMEgwVjEwWk0xMCAwSDIwVjEwSDEwVjBaIiBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIwLjA1Ii8+PC9zdmc+");
    background-size: 20px 20px;
    background-repeat: repeat;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    flex-shrink: 0;
    overflow: visible;
}

.khl-image-preview-box.khl-checker-dark{
    /* Darker checkerboard for light/white designs */
    background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMCAxMEgxMFYyMEgwVjEwWk0xMCAwSDIwVjEwSDEwVjBaIiBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIwLjE1Ii8+PC9zdmc+");
}

/* Inline SVG container */
.khl-image-svg {
    display: block;
    line-height: 0;
}

.khl-image-svg svg {
    display: block;
    max-width: 300px;
    max-height: 300px;
    width: 100%;
    height: auto;
}

/* Fields */
.khl-image-fields {
    margin-top: 16px;
}

.khl-image-field {
    margin-bottom: 16px;
}

.khl-image-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #333;
}

/* Alleen voor labels “Vinyltype” en “Kleur” (niet voor afbeelding/overige velden) */
.khl-inline-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-align: left;
}

.khl-select,
.khl-input {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
}

/* Vinyl dropdown: show clear up/down arrows (like other configurator) */
select#khl_vinyl_type.khl-select{
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path d='M4 6l4-4 4 4' fill='none' stroke='%23666' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/><path d='M4 10l4 4 4-4' fill='none' stroke='%23666' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}

.khl-select:focus,
.khl-input:focus {
    border-color: #e63329;
    outline: none;
    box-shadow: 0 0 0 2px rgba(230,51,41,0.1);
}

/* Dimensies */
.khl-image-dimensions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.khl-dim-field {
    flex: 1;
    min-width: 120px;
}

.khl-dim-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #333;
}

.khl-width-display {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f5f5f5;
    font-size: 14px;
    color: #555;
    max-width: 300px;
}

/* Kleurswatches */
.khl-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 36px;
}

.khl-color-placeholder {
    font-size: 13px;
    color: #999;
    font-style: italic;
}

.khl-color-swatch {
    width: 44px;
    height: 28px;
    border-radius: 0;
    border: solid 1px rgba(0, 0, 0, 0.2);
    box-shadow: 1px 1px 8px #888888;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    display: inline-block;
    transition: border-color 0.15s, transform 0.15s;
    position: relative;
}

.khl-color-swatch:hover {
    border-color: #999;
    transform: scale(1.05);
}

.khl-color-swatch.selected {
    border-color: #e63329;
    box-shadow: 0 0 0 2px #e63329;
    transform: scale(1.05);
}

/* Prijsbox */
.khl-image-price-box {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f0f7ff;
    border: 1px solid #c0d8f0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 300px;
}

.khl-price-label {
    font-size: 14px;
    color: #555;
    font-weight: 600;
}

.khl-price-value {
    font-size: 22px;
    font-weight: 700;
    color: #e63329;
}

/* Spiegelbeeld toggle */
.khl-mirror-field {
    margin-top: 8px;
}
.khl-mirror-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    user-select: none;
}
.khl-mirror-toggle {
    display: inline-flex;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.khl-mirror-toggle.active {
    background: #e63329;
}
.khl-mirror-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.khl-mirror-toggle.active .khl-mirror-knob {
    transform: translateX(20px);
}

/* Achtergrondkleur swatches */
.khl-bg-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
}
.khl-bg-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    position: relative;
    transition: border-color 0.15s, transform 0.15s;
    overflow: hidden;
}
.khl-bg-swatch:hover {
    border-color: #999;
    transform: scale(1.1);
}
.khl-bg-swatch.khl-bg-active {
    border-color: #e63329;
    box-shadow: 0 0 0 2px #e63329;
}

/* Zoom knop */
.khl-zoom-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #555;
    transition: border-color 0.15s;
}
.khl-zoom-btn:hover {
    border-color: #e63329;
    color: #e63329;
}

/* Zoom overlay */
.khl-zoom-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.khl-zoom-box {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    min-width: 300px;
}
.khl-zoom-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    line-height: 1;
}
.khl-zoom-close:hover { color: #e63329; }
.khl-zoom-svg {
    padding: 20px;
    border-radius: 4px;
    min-width: 200px;
    min-height: 100px;
}
.khl-zoom-note {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin-top: 12px;
    font-style: italic;
}

/* Tooltip icoon */
.khl-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #999;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 5px;
    vertical-align: middle;
    line-height: 1;
    flex-shrink: 0;
}
.khl-tooltip-icon:hover {
    background: #e63329;
}

/* Responsive */
@media (max-width: 480px) {
    .khl-image-dimensions {
        flex-direction: column;
        gap: 12px;
    }
    .khl-select,
    .khl-input {
        max-width: 100%;
    }
}
