/* =====================================================================
   Common/Shared Styles for Cart & Checkout
   Participant Editor, Icons, Hard Overrides
   ===================================================================== */

/* =====================================================================
   Participant editor
   ===================================================================== */

.kufer-meta-editor {
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: transparent;
}

.kufer-meta-editor,
.kufer-meta-editor * {
    box-sizing: border-box;
}

.kufer-participant-card {
    border: 1px solid #d8dde3;
    border-radius: 12px;
    background: #fff;
    padding: 9px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.kufer-participant-card:hover {
    border-color: #b5c7da;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.09);
}

.kufer-participant-label {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #123a5a;
    background: linear-gradient(135deg, #d7ecff, #b8ddff);
    border: 1px solid #9fcbee;
    flex: 0 0 auto;
}

.kufer-participant-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.kufer-participant-toggle {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.kufer-participant-toggle:focus-visible {
    outline: 2px solid #1f6aa5;
    outline-offset: 2px;
    border-radius: 8px;
}

.kufer-participant-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.kufer-participant-meta {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
}

.kufer-participant-summary {
    padding: 5px 8px;
    border: 1px solid #d5dee8;
    background: #f7fafc;
    color: #2f4554;
    font-size: 12px;
    border-radius: 8px;
    line-height: 1.35;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kufer-summary-main {
    font-weight: 700;
    color: #18384f;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kufer-summary-contact {
    color: #526879;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kufer-summary-children {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #c7d8ea;
    background: #eaf3fc;
    font-size: 11px;
    font-weight: 700;
    color: #265072;
    flex: 0 0 auto;
}

.kufer-summary-child-surcharge {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #f0cc8e;
    background: #fff7e8;
    font-size: 11px;
    font-weight: 700;
    color: #8a5a00;
    flex: 0 0 auto;
}

.kufer-participant-edit {
    display: block;
    height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
    margin-top: 0;
}

.kufer-participant-card.is-editing .kufer-participant-edit {
    height: auto;
    overflow: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    margin-top: 10px;
}

.kufer-participant-card.is-editing .kufer-participant-summary {
    background: #eef6ff;
    border-color: #b7d2f0;
}


.kufer-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.kufer-grid .kufer-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    grid-column: span 4;
}

.kufer-field.kufer-field-kufer_firstname,
.kufer-field.kufer-field-kufer_lastname,
.kufer-field.kufer-field-kufer_birthdate {
    grid-column: span 4;
}

.kufer-field.kufer-field-kufer_email,
.kufer-field.kufer-field-kufer_phone {
    grid-column: span 6;
}

.kufer-field.kufer-field-kufer_street {
    grid-column: span 9;
}

.kufer-field.kufer-field-kufer_housenumber {
    grid-column: span 3;
}

.kufer-field.kufer-field-kufer_zip {
    grid-column: span 3;
}

.kufer-field.kufer-field-kufer_city {
    grid-column: span 9;
}

.kufer-field-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1.2;
    color: #2e4455;
    font-weight: 600;
}

.kufer-required-mark {
    color: #c53333;
    font-weight: 700;
}

.kufer-grid input {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    font-size: 14px;
    line-height: 1.25;
    margin: 0;
}

.kufer-field.is-invalid input,
.kufer-field.is-invalid select,
.kufer-field.is-invalid textarea,
.kufer-input-invalid {
    border-color: #d64545 !important;
    box-shadow: 0 0 0 1px rgba(214, 69, 69, 0.18) !important;
}

.kufer-field.is-invalid input:focus,
.kufer-field.is-invalid select:focus,
.kufer-field.is-invalid textarea:focus,
.kufer-input-invalid:focus {
    outline: none;
    border-color: #b52828 !important;
    box-shadow: 0 0 0 2px rgba(214, 69, 69, 0.28) !important;
}

.kufer-summary-contact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.kufer-summary-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #526879;
    font-size: 11px;
    min-width: 0;
    max-width: 100%;
}

.kufer-summary-contact-icon {
    width: 13px;
    height: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #486073;
    flex: 0 0 auto;
}

.kufer-summary-contact-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.kufer-children {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #d6dae0;
}

.kufer-discount-debug {
    margin-top: 8px;
    padding: 7px 9px;
    border: 1px dashed #e3b13f;
    background: #fff9ed;
    color: #734d00;
    font-size: 12px;
    line-height: 1.35;
    border-radius: 6px;
    word-break: break-word;
}

.kufer-children-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.kufer-children-surcharge-note {
    font-size: 11px;
    color: #8a5a00;
    background: #fff7e8;
    border: 1px solid #f0cc8e;
    border-radius: 999px;
    padding: 2px 8px;
    margin-left: auto;
}

.kufer-children-label {
    font-size: 12px;
    color: #516372;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kufer-child-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    grid-template-rows: repeat(2, auto);
    grid-template-areas:
        "firstname lastname remove"
        "birthdate gender remove";
    gap: 6px 8px;
    margin: 0;
    padding: 6px 0;
    align-items: end;
}

.kufer-child-row + .kufer-child-row {
    border-top: 1px solid #e6edf4;
    margin-top: 4px;
}

.kufer-child-row .kufer-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    margin: 0;
}

.kufer-child-row .kufer-child-field-firstname,
.kufer-child-row .kufer-child-field-lastname,
.kufer-child-row .kufer-child-field-birthdate,
.kufer-child-row .kufer-child-field-gender {
    grid-column: span 1;
}

.kufer-child-row .kufer-child-field-firstname {
    grid-area: firstname;
}

.kufer-child-row .kufer-child-field-lastname {
    grid-area: lastname;
}

.kufer-child-row .kufer-child-field-birthdate {
    grid-area: birthdate;
}

.kufer-child-row .kufer-child-field-gender {
    grid-area: gender;
}

.kufer-child-row .kufer-field-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    line-height: 1.2;
    color: #2e4455;
    font-weight: 600;
    opacity: 0.92;
}

.kufer-child-row .kufer-child-remove {
    grid-area: remove;
    align-self: end;
    justify-self: end;
}

.kufer-discount-select select {
    width: 100%;
}

.kufer-child-row input,
.kufer-child-row select {
    width: 100%;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 13px;
    line-height: 1.25;
    margin: 0;
}

.kufer-meta-editor-actions {
    display: none;
}

.kufer-icon-btn {
    border: 1px solid #d1d9e2;
    background: #f8fafc;
    color: #2f4554;
    border-radius: 999px;
    min-width: 27px;
    min-height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.kufer-save-meta {
    min-width: 34px;
    min-height: 34px;
}

.kufer-save-meta svg {
    width: 18px;
    height: 18px;
}

.kufer-save-meta:disabled {
    opacity: 0.6;
    cursor: wait;
}

.kufer-icon-btn:hover {
    background: #eef3f8;
}

.kufer-toggle-edit {
    padding: 0;
}

.kufer-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.kufer-icon-close {
    display: none;
}

.kufer-participant-card.is-editing .kufer-icon-edit {
    display: none;
}

.kufer-participant-card.is-editing .kufer-icon-close {
    display: inline-flex;
}

.kufer-save-status {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 1px solid rgba(43, 59, 74, 0.2);
    display: inline-block;
    flex: 0 0 auto;
    position: relative;
    background: #d64545;
}

.kufer-save-status.is-valid {
    background: #2faa62;
    border-color: rgba(23, 97, 53, 0.35);
}

.kufer-save-status.is-invalid,
.kufer-save-status.is-error {
    background: #d64545;
    border-color: rgba(107, 20, 20, 0.35);
}

.kufer-save-status.is-saving::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid rgba(47, 69, 84, 0.25);
    border-top-color: #123a5a;
    animation: kufer-spin 0.7s linear infinite;
    pointer-events: none;
}

@keyframes kufer-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .kufer-participant-meta {
        align-items: flex-start;
        width: 100%;
        flex-direction: column;
    }

    .kufer-participant-summary {
        white-space: normal;
        flex-wrap: wrap;
        width: 100%;
        min-width: 0;
    }

    .kufer-participant-head {
        flex-direction: column-reverse;
        align-items: flex-end;
        gap: 8px;
    }

    .kufer-participant-actions {
        width: auto;
        justify-content: flex-end;
    }

    .kufer-icon-btn {
        min-width: 30px;
        min-height: 30px;
    }

    .kufer-participant-card {
        padding: 8px;
        margin-bottom: 8px;
    }

    .kufer-participant-label {
        width: 20px;
        height: 20px;
        font-size: 10px;
        display: none;
    }

    .kufer-summary-children {
        margin-left: 0;
    }

    .kufer-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .kufer-grid .kufer-field {
        grid-column: span 3;
    }

    .kufer-field.kufer-field-kufer_street,
    .kufer-field.kufer-field-kufer_city,
    .kufer-field.kufer-field-kufer_email,
    .kufer-field.kufer-field-kufer_phone {
        grid-column: span 6;
    }

    .kufer-field.kufer-field-kufer_housenumber,
    .kufer-field.kufer-field-kufer_zip,
    .kufer-field.kufer-field-kufer_birthdate,
    .kufer-field.kufer-field-kufer_firstname,
    .kufer-field.kufer-field-kufer_lastname {
        grid-column: span 3;
    }

    .kufer-summary-contact {
        width: 100%;
    }

    .kufer-child-row {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        grid-template-areas:
            "firstname"
            "lastname"
            "birthdate"
            "gender"
            "remove";
    }

    .kufer-child-row .kufer-child-remove {
        justify-self: end;
    }
}

/* =====================================================================
   Hard Overrides (legacy kufersql compatibility)
   ===================================================================== */

.kufer-meta-editor,
body.woocommerce-checkout .kufer-meta-editor {
    margin-top: 8px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

.kufer-participant-card,
body.woocommerce-checkout .kufer-participant-card {
    border: 1px solid #d8dde3 !important;
    border-radius: 12px !important;
    background: #fff !important;
    padding: 9px !important;
    margin-bottom: 8px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

.kufer-participant-summary,
body.woocommerce-checkout .kufer-participant-summary {
    display: inline-flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 5px 8px !important;
    border: 1px solid #d5dee8 !important;
    background: #f7fafc !important;
    color: #2f4554 !important;
    border-radius: 8px !important;
    width: 100% !important;
}

.kufer-icon-btn,
body.woocommerce-checkout .kufer-icon-btn {
    border: 1px solid #d1d9e2 !important;
    background: #f8fafc !important;
    color: #2f4554 !important;
    border-radius: 999px !important;
}

.kufer-children-surcharge-note,
body.woocommerce-checkout .kufer-children-surcharge-note,
.kufer-summary-child-surcharge,
body.woocommerce-checkout .kufer-summary-child-surcharge {
    border-radius: 999px !important;
    background: #fff7e8 !important;
    border: 1px solid #f0cc8e !important;
    color: #8a5a00 !important;
}
