/* =============================================================================
   Custom Product Form — Frontend Styles
   All classes are prefixed with .qm-cp- to avoid conflicts.
   ============================================================================= */

/* ---- Form wrapper ---- */
.qm-cp-wrap {}

.qm-cp-heading {
    margin-bottom: 1.5rem;
}

/* ---- Required indicator ---- */
.qm-cp-required-indicator {
    margin-left: 0.2em;
    color: #d63638;
    font-size: 0.9em;
    line-height: 1;
}

/* ---- Error notice ---- */
.qm-cp-notice {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 1rem;
    margin-top: 0;
    font-size: 0.9rem;
    background: #fdf2f2;
    color: #c0392b;
    border: 1px solid #f5b7b1;
}

/* ---- Section (accordion-style) ---- */
.qm-cp-section {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.qm-cp-section__toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #f7f7f7;
    cursor: pointer;
    user-select: none;
    margin: 0;
    border-radius: 6px 6px 0 0;
}

.qm-cp-section__toggle:hover {
    background: #efefef;
}

.qm-cp-section__toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
}

.qm-cp-section__label {
    font-weight: 600;
    font-size: 1rem;
}

/* ---- Section fields ---- */
.qm-cp-fields {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.qm-cp-fields[hidden] {
    display: none;
}

/* ---- Form groups (label + input) ---- */
.qm-cp-group {
    margin-bottom: 1rem;
}

.qm-cp-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.qm-cp-input,
.qm-cp-select,
.qm-cp-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background-color: #fff;
    color: inherit;
    font-family: inherit;
}

.qm-cp-input:focus,
.qm-cp-select:focus,
.qm-cp-textarea:focus {
    border-color: #555;
    outline: none;
}

#qm-custom-product-form {
    --qm-cp-required-border-color: #d63638;
}

.qm-cp-input.qm-cp-field-error,
.qm-cp-select.qm-cp-field-error,
.qm-cp-textarea.qm-cp-field-error {
    border-color: var(--qm-cp-required-border-color);
    box-shadow: 0 0 0 1px var(--qm-cp-required-border-color) inset;
}

.qm-cp-input[type="number"] {
    max-width: 200px;
}

.qm-cp-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Hidden — only acts as a file-picker trigger, not displayed */
.qm-cp-file-input[hidden] {
    display: none;
}

.qm-cp-help {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: #666;
}

/* ---- Drop zone ---- */
.qm-cp-dropzone__area {
    border: 2px dashed #d0d0d0;
    border-radius: 6px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafafa;
    user-select: none;
}

.qm-cp-dropzone__area:hover,
.qm-cp-dropzone__area.is-dragging {
    border-color: #666;
    background: #f0f0f0;
}

.qm-cp-dropzone__icon {
    width: 36px;
    height: 36px;
    color: #bbb;
    display: block;
    margin: 0 auto 10px;
    pointer-events: none;
}

.qm-cp-dropzone__text {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    pointer-events: none;
}

.qm-cp-dropzone__browse {
    pointer-events: auto;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: inherit;
    color: #0073aa;
    cursor: pointer;
    text-decoration: underline;
}

.qm-cp-dropzone__browse:hover {
    color: #005177;
}

/* ---- Uploaded file list ---- */
.qm-cp-file-list {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
}

.qm-cp-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-top: 5px;
    border-radius: 4px;
    font-size: 0.875rem;
    line-height: 1.3;
}

.qm-cp-file-item--uploading {
    background: #f5f5f5;
    color: #888;
}

.qm-cp-file-item--done {
    background: #f0f7f0;
    border: 1px solid #c3dec3;
}

.qm-cp-file-item--error {
    background: #fdf2f2;
    border: 1px solid #f5b7b1;
    color: #c0392b;
}

.qm-cp-file-item__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.qm-cp-file-item__remove {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.15s;
}

.qm-cp-file-item__remove:hover {
    color: #c0392b;
}

.qm-cp-file-item__remove svg {
    width: 14px;
    height: 14px;
    display: block;
}

.qm-cp-file-item__error-msg {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: #c0392b;
}

/* Uploading spinner */
.qm-cp-file-item__spinner {
    flex-shrink: 0;
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: qm-spin 0.7s linear infinite;
}

@keyframes qm-spin {
    to { transform: rotate(360deg); }
}

/* ---- Trägerpalette sub-section ---- */
.qm-cp-traeger-fields {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding: 14px 16px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.qm-cp-traeger-fields[hidden] {
    display: none;
}

.qm-cp-subsection-heading {
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0 0 1rem;
    color: #555;
}

/* ---- Submit button ---- */
.qm-cp-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* .qm-cp-submit inherits from .qm-btn — Elementor style controls override */

/* ---- Tooltip ---- */
.qm-cp-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    vertical-align: middle;
}

.qm-cp-tooltip__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #bbb;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
}

.qm-cp-tooltip__bubble {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: normal;
    width: 220px;
    z-index: 9999;
    pointer-events: none;
}

.qm-cp-tooltip__bubble::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.qm-cp-tooltip:hover .qm-cp-tooltip__bubble {
    display: block;
}
