/* Author: Tobalt — https://tobalt.lt
 *
 * Scoped styling for the report submission form mounted inside the
 * chat dialog (.tcb-dialog → .tobalt-chatbot-report-form). Inherits
 * the .tcb-root CSS variables (--tcb-accent, --tcb-border, --tcb-radius)
 * defined in chatbot.css, so the form automatically picks up the
 * site's accent color without duplicating the brand palette.
 */

.tobalt-chatbot-report-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    max-height: 70vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.4;
    color: var(--tcb-bot-text, #212529);
}

.tobalt-chatbot-report-form h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--tcb-bot-text, #212529);
}

.tobalt-chatbot-report-form .tcb-form-intro {
    margin: 0 0 8px 0;
    color: #6c757d;
    font-size: 13px;
}

/* Field labels — vertical (label text above input) */
.tobalt-chatbot-report-form label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-weight: 500;
    font-size: 13px;
}

/* Checkbox-style labels — horizontal, with checkbox inline */
.tobalt-chatbot-report-form label.tcb-checkbox {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400;
    font-size: 13px;
    cursor: pointer;
}

.tobalt-chatbot-report-form label.tcb-checkbox input {
    margin-top: 2px;
    flex-shrink: 0;
}

/* v0.12.6 — many client themes (frisk, hello-elementor variants) hide native
 * checkboxes + radios globally via `input[type="checkbox"|"radio"] { display: none }`
 * to swap in custom-styled replacements. Those themes don't render replacements
 * inside our widget, so the inputs become invisible-but-clickable — a bad UX trap.
 * Force-show native inputs at chatbot scope; high specificity to beat theme rules.
 */
.tobalt-chatbot-report-form input[type="checkbox"],
.tobalt-chatbot-report-form input[type="radio"] {
    display: inline-block;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    opacity: 1;
    position: static;
    pointer-events: auto;
    accent-color: var(--tcb-accent, #00ab8e);
}

/* Form controls */
.tobalt-chatbot-report-form input[type="text"],
.tobalt-chatbot-report-form input[type="email"],
.tobalt-chatbot-report-form input[type="tel"],
.tobalt-chatbot-report-form input[type="date"],
.tobalt-chatbot-report-form select,
.tobalt-chatbot-report-form textarea {
    padding: 7px 9px;
    border: 1px solid var(--tcb-border, #dee2e6);
    border-radius: 4px;
    font: inherit;
    background: #ffffff;
    color: var(--tcb-bot-text, #212529);
}

.tobalt-chatbot-report-form input:focus,
.tobalt-chatbot-report-form select:focus,
.tobalt-chatbot-report-form textarea:focus {
    outline: 2px solid var(--tcb-accent, #00ab8e);
    outline-offset: 1px;
    border-color: var(--tcb-accent, #00ab8e);
}

.tobalt-chatbot-report-form textarea {
    min-height: 90px;
    resize: vertical;
    font-family: inherit;
}

/* Invalid field highlight (from server validator response) */
.tobalt-chatbot-report-form .tcb-invalid {
    border-color: #c0392b;
    background: #fff5f4;
}

/* Fieldsets */
.tobalt-chatbot-report-form fieldset {
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Reporter fields fieldset — same vertical stack but slightly tighter */
.tobalt-chatbot-report-form fieldset.tcb-reporter-fields {
    gap: 8px;
}

/* Urgency fieldset — horizontal radio row */
.tobalt-chatbot-report-form fieldset.tcb-urgency {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 14px;
}

.tobalt-chatbot-report-form fieldset.tcb-urgency legend {
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 4px;
    width: 100%;
    padding: 0;
}

.tobalt-chatbot-report-form fieldset.tcb-urgency label {
    flex-direction: row;
    align-items: center;
    gap: 5px;
    font-weight: 400;
    cursor: pointer;
}

/* Action buttons row — right aligned */
.tobalt-chatbot-report-form .tcb-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--tcb-border, #dee2e6);
}

.tobalt-chatbot-report-form .tcb-actions button {
    padding: 9px 18px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font: inherit;
    font-weight: 500;
    transition: filter 0.12s ease, background-color 0.12s ease;
}

.tobalt-chatbot-report-form .tcb-actions .tcb-cancel {
    background: #f1f3f5;
    color: #495057;
}

.tobalt-chatbot-report-form .tcb-actions .tcb-cancel:hover {
    background: #e9ecef;
}

.tobalt-chatbot-report-form .tcb-actions .tcb-submit {
    background: var(--tcb-accent, #00ab8e);
    color: var(--tcb-accent-text, #ffffff);
}

.tobalt-chatbot-report-form .tcb-actions .tcb-submit:hover {
    filter: brightness(0.92);
}

.tobalt-chatbot-report-form .tcb-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error summary at top of form */
.tobalt-chatbot-report-form .tcb-error-summary {
    background: #fcebea;
    color: #8a1f11;
    padding: 9px 11px;
    border-radius: 4px;
    border-left: 3px solid #c0392b;
    font-size: 13px;
    font-weight: 500;
}

/* Mobile — extend max height since chat dialog is full-screen on small screens */
@media (max-width: 600px) {
    .tobalt-chatbot-report-form {
        max-height: calc(100vh - 80px);
        padding: 12px;
    }
    .tobalt-chatbot-report-form fieldset.tcb-urgency {
        gap: 10px;
    }
}
