/**
 * MKK Standalone Beregner v7.5.0
 * OPTIMERET: Preview-billede fjernet. Fokus på Swatch-zoom & Betinget Logik.
 */

/* --- ADMIN HIERARKI-DRÆBER --- */
.mkk-fields-list {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
}

.mkk-field-row {
    margin-left: 0 !important;   /* Tvinger feltet helt til venstre */
    margin-right: 0 !important;
    left: 0 !important;          /* Nulstiller horisontal forskydning */
    position: relative !important;
    display: block !important;
    width: 100% !important;      /* Tvinger fuld bredde */
    clear: both !important;      /* Forhindrer felter i at ligge ved siden af hinanden */
    box-sizing: border-box !important;
}

/* Fix til Sortable Placeholder (skyggen når du rykker) */
.mkk-sortable-placeholder {
    height: 100px !important;
    background: #f0f7ff !important;
    border: 2px dashed #2271b1 !important;
    margin: 0 0 15px 0 !important; /* Ingen margin-left her heller! */
    visibility: visible !important;
    display: block !important;
    width: 100% !important;
}

/* Hoved-layout: Enkel vertikal boks */
.mkk-ultimate-wrapper {
    display: block !important; 
    max-width: 800px;
    margin: 0 auto 40px auto;
    background: #ffffff;
    border: 1px solid #e2e4e7;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Fjern preview-kolonnen helt fra visningen */
.mkk-preview-column {
    display: none !important;
}

/* --- FELTER & INDHOLD --- */
.mkk-fields-column {
    width: 100% !important;
    padding: 40px;
    background: #fff;
    box-sizing: border-box;
}

.mkk-title {
    font-size: 1.85rem;
    font-weight: 800;
    margin-top: 0; /* Overskrift helt i top */
    margin-bottom: 35px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f1;
    letter-spacing: -0.5px;
    text-align: left; /* Klassisk venstrestillet look, nu hvor billedet er væk */
    color: #1d2327;
}

/* Felt-grupper */
.mkk-field-group {
    margin-bottom: 35px;
    position: relative;
    display: block;
    width: 100%;
    clear: both; /* VIGTIGT: Forhindrer felter i at kravle op ved siden af hinanden */
}

.mkk-label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #1d2327;
}

.mkk-req-star {
    color: #d63638;
    margin-left: 3px;
}

.mkk-field-desc {
    font-size: 0.95rem;
    color: #646970;
    margin: -5px 0 15px 0;
    line-height: 1.6;
}

/* --- VIGTIGT: FIX TIL BETINGET LOGIK --- */
/* Skjuler felter der har en logik-regel som standard, så JS kan 'slideDown' dem */
.mkk-field-group[data-logic-rule]:not([data-logic-rule=""]) {
    display: none;
}

/* --- OPTIMERING AF SWATCHES (Nu hvor de er hovedfokus) --- */
.mkk-swatch-item img {
    width: 100% !important;
    /* Aspect ratio 4:5 (Bredde: 4, Højde: 5) */
    aspect-ratio: 4 / 5 !important; 
    /* Object-fit sørger for at billedet udfylder rammen uden at blive mast */
    object-fit: cover !important; 
    object-position: center;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
    display: block;
}

.mkk-swatch-item:hover img {
    transform: scale(1.02);
}

/* Gør forstørrelsesglasset mere markant */
.mkk-zoom-btn {
    opacity: 0.8 !important; /* Gør det synligt hele tiden, eller skru op for synligheden */
    background: white !important;
    border: 1px solid #e2e4e7;
}

/* --- NYE ELEMENTER: SLIDER & ANTAL (OPTIMERET) --- */

/* Range Slider - Full Width & Touch Friendly */
.mkk-range-wrap {
    margin: 25px 0;
    padding: 10px 0;
    width: 100%;
}

.mkk-range-slider {
    -webkit-appearance: none;
    width: 100% !important; /* Tvinger fuld bredde på alle skærme */
    height: 10px; /* En anelse tykkere for bedre kontrol */
    border-radius: 5px;
    background: #e2e4e7;
    outline: none;
    cursor: pointer;
    margin: 0;
}

/* Slider-knappen (Thumb) - Gort større til mobil-fingre */
.mkk-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2271b1;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    transition: transform 0.1s ease;
}

.mkk-range-slider:active::-webkit-slider-thumb {
    transform: scale(1.15); /* Feedback når man rører den */
}

.mkk-range-value {
    display: block; /* Flytter tallet ned under slideren for bedre plads på mobil */
    margin-top: 12px;
    font-weight: 800;
    color: #2271b1;
    font-size: 1.1rem;
}

/* Antal (+/-) vælger - Moderne sammenhængende design */
.mkk-quantity-selector {
    display: inline-flex; /* Samler knapperne i én blok */
    align-items: stretch;
    height: 48px;
    border: 2px solid #e2e4e7;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    margin-top: 10px;
}

.mkk-qty-btn {
    width: 48px;
    border: none;
    background: #f8f9fa;
    color: #1d2327;
    font-size: 1.4rem;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.mkk-qty-btn:hover {
    background: #eee;
    color: #2271b1;
}

.mkk-qty-input {
    width: 55px;
    text-align: center;
    font-weight: 800;
    font-size: 1.1rem;
    border: none;
    border-left: 1px solid #e2e4e7;
    border-right: 1px solid #e2e4e7;
    background: #fff;
    padding: 0;
    margin: 0;
    /* Fjerner de små pile i browseren */
    -moz-appearance: textfield;
}

.mkk-qty-input::-webkit-outer-spin-button,
.mkk-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Responsiv tilpasning af antalvælger på de mindste skærme */
@media (max-width: 400px) {
    .mkk-quantity-selector {
        display: flex; /* Gør den bredere på meget små skærme */
        width: 100%;
    }
    .mkk-qty-btn {
        flex: 1;
    }
    .mkk-qty-input {
        flex: 1;
    }
}

/* Pris-breakdown styling */
.mkk-summary-item .mkk-item-price {
    font-weight: 600;
    color: #1d2327;
}

.mkk-vat-line {
    font-size: 0.85rem;
    color: #646970;
    margin-top: 4px;
    font-weight: normal;
    text-align: right;
    display: block; /* Vises kun hvis admin har slået det til */
}

/* --- RESPONSIVITET --- */
@media (max-width: 600px) {
    .mkk-fields-column {
        padding: 25px;
    }
    .mkk-title {
        font-size: 1.5rem;
    }
}

/* --- FORM ELEMENTER STYLING --- */

/* Dropdown / Select */
.mkk-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e4e7;
    border-radius: 10px;
    background-color: #fff;
    font-size: 1rem;
    color: #3c434a;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    transition: all 0.2s ease;
}

.mkk-select:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

/* Tekstfelter */
.mkk-input-text {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e4e7;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.mkk-input-text:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

/* --- IMAGE SWATCHES GRID --- */
.mkk-swatches-grid {
    display: grid;
    gap: 15px; /* Lidt mere luft giver et renere look */
}

.mkk-swatch-item {
    cursor: pointer;
    border: 2px solid #e2e4e7;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Sikrer at indholdet starter fra toppen */
    overflow: hidden; /* Holder alt pænt indenfor de runde hjørner */
}

.mkk-swatch-label {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    color: #1d2327;
}

.mkk-swatch-label small {
    display: block;
    color: #646970;
    font-weight: normal;
    margin-top: 4px;
    font-size: 0.85rem;
}

/* Hover effekter */
.mkk-swatch-item:hover {
    border-color: #8c8f94;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.mkk-swatch-item:hover img {
    transform: scale(1.03); /* Diskret zoom på selve billedet ved hover */
}

/* Aktiv tilstand (Valgt) */
.mkk-swatch-item.active {
    border-color: #2271b1;
    background-color: #f0f7ff;
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.15);
}

/* Tjek-ikon i hjørnet når valgt */
.mkk-swatch-item.active::after {
    content: "\f147";
    font-family: dashicons;
    position: absolute;
    top: 8px;
    right: 8px;
    background: #2271b1;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 2px solid #fff;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Zoom knap (Search ikon) */
.mkk-zoom-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255,255,255,0.95);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    transition: all 0.2s ease;
    color: #1d2327;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.mkk-swatch-item:hover .mkk-zoom-btn {
    opacity: 1;
}

.mkk-zoom-btn:hover {
    background: #fff;
    transform: scale(1.1);
}

/* --- OPSUMMERING & PRIS --- */
.mkk-calculation-summary {
    margin: 40px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 14px;
    border: 1px solid #e2e4e7;
}

.mkk-summary-box h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #1d2327;
}

.mkk-summary-list {
    margin-bottom: 20px;
    padding: 0;
    list-style: none;
}

.mkk-summary-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #dee2e6;
}

.mkk-summary-item:last-child {
    border-bottom: none;
}

.mkk-total-price-display {
    font-size: 1.3rem;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #1d2327;
}

.mkk-total-price-display span {
    color: #2271b1;
    font-size: 2.2rem;
}

/* --- LEAD FORMULAR --- */
.mkk-lead-form {
    margin-top: 40px;
    padding-top: 35px;
    border-top: 3px solid #f0f0f1;
}

.mkk-lead-form h3 {
    margin-bottom: 25px;
    font-size: 1.3rem;
    font-weight: 800;
}

.mkk-lead-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.mkk-lead-input-wrap {
    margin-bottom: 5px;
}

#mkk-lead-name { grid-column: span 2; }

.mkk-lead-form input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e2e4e7;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.mkk-lead-form input:focus {
    border-color: #2271b1;
    outline: none;
}

.mkk-submit-lead {
    width: 100%;
    padding: 20px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(34, 113, 177, 0.2);
}

.mkk-submit-lead:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 113, 177, 0.3);
    filter: brightness(1.1);
}

.mkk-submit-lead:active {
    transform: translateY(0);
}

.mkk-privacy-note {
    font-size: 0.8rem;
    color: #8c8f94;
    text-align: center;
    margin-top: 15px;
}

/* Success besked */
.mkk-success-msg {
    padding: 40px;
    text-align: center;
    background: #f0fdf4;
    border: 2px solid #22c55e;
    border-radius: 16px;
    color: #166534;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* --- VALIDERING & FEJL --- */
.mkk-error-msg {
    color: #d63638;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 8px;
    display: none;
}

.mkk-error .mkk-error-msg {
    display: block;
}

.mkk-error select, 
.mkk-error input[type="text"] {
    border-color: #d63638;
    background-color: #fff8f7;
}

.mkk-error .mkk-swatches-grid {
    padding: 10px;
    border: 2px solid #d63638;
    border-radius: 14px;
    background: #fff8f7;
}

/* Lightbox */
#mkk-lightbox {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

#mkk-lightbox img {
    max-width: 90%;
    max-height: 85%;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    border: 3px solid #fff;
}

.mkk-close-lightbox {
    position: absolute;
    top: 30px; right: 40px;
    color: #fff; font-size: 50px; cursor: pointer;
    line-height: 1;
}

/* --- RESPONSIVITET --- */

/* Tablet og mindre Desktop */
@media (max-width: 992px) {
    .mkk-ultimate-wrapper {
        max-width: 95%; /* Giver lidt luft i siderne på tablets */
        margin: 20px auto;
    }
}

/* Mobil (Telefoner) */
@media (max-width: 600px) {
    .mkk-fields-column {
        padding: 20px; /* Mindre padding så der er plads til indholdet */
    }

    .mkk-title {
        font-size: 1.5rem; /* Mindre titel på mobilen */
        margin-bottom: 25px;
    }

    /* Tvinger swatches til at være 2 kolonner på mobilen, 
       uanset hvad der er valgt i admin, for at bevare 4:5 formatet pænt */
    .mkk-swatches-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .mkk-swatch-item {
        padding: 8px;
    }

    .mkk-swatch-item img {
        margin-bottom: 6px;
    }

    /* Lead-formular felter stables ovenpå hinanden */
    .mkk-lead-fields {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #mkk-lead-name {
        grid-column: auto;
    }

    /* Pris-displayet stables vertikalt og centreres */
    .mkk-total-price-display {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .mkk-total-price-display span {
        font-size: 1.8rem;
    }

    .mkk-submit-lead {
        padding: 18px;
        font-size: 1.1rem;
    }
}