/**
 * Global bug report trigger and modal.
 */

.fe-bug-trigger {
    position: fixed;
    bottom: 70px;
    left: 20px;
    z-index: 9990;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--fe-surface);
    border: 1px solid var(--fe-border);
    border-radius: var(--fe-radius-pill);
    box-shadow: var(--fe-shadow-xs);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--fe-text);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.fe-bug-trigger svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.fe-bug-trigger:hover {
    border-color: var(--fe-border-strong);
    color: var(--fe-text-strong);
    box-shadow: var(--fe-shadow-sm);
    transform: translateY(-1px);
}

.fe-bug-trigger:focus-visible,
.fe-bug-modal__close:focus-visible,
.fe-bug-submit:focus-visible {
    outline: var(--fe-focus-ring-width) solid var(--fe-focus-color);
    outline-offset: var(--fe-focus-ring-offset);
}

.fe-bug-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.fe-bug-modal[hidden] {
    display: none;
}

.fe-bug-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
}

.fe-bug-modal__panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    padding: 24px;
    background: var(--fe-surface-raised);
    border-radius: var(--fe-radius-panel) var(--fe-radius-panel) 0 0;
    box-shadow: var(--fe-shadow-overlay);
    font-family: var(--fe-font-sans);
}

.fe-bug-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.fe-bug-modal__title {
    color: var(--fe-text-strong);
    font-size: 16px;
    font-weight: 700;
}

.fe-bug-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--fe-text);
    background: var(--fe-surface-sunken);
    border: 1px solid var(--fe-border);
    border-radius: var(--fe-radius-control);
    cursor: pointer;
}

.fe-bug-modal__close svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.fe-bug-modal__close:hover {
    color: var(--fe-text-strong);
    background: var(--fe-surface-hover);
    border-color: var(--fe-border-strong);
}

.fe-bug-label {
    display: block;
    margin: 14px 0 6px;
    color: var(--fe-text);
    font-size: 13px;
    font-weight: 600;
}

.fe-bug-label:first-of-type {
    margin-top: 0;
}

.fe-bug-textarea,
.fe-bug-input {
    box-sizing: border-box;
    width: 100%;
    padding: 10px 12px;
    color: var(--fe-input-text);
    background: var(--fe-input-bg);
    border: 1px solid var(--fe-input-border);
    border-radius: var(--fe-radius-control);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.fe-bug-textarea:focus,
.fe-bug-input:focus {
    outline: var(--fe-focus-ring-width) solid var(--fe-focus-color);
    outline-offset: var(--fe-focus-ring-offset);
    border-color: var(--fe-focus-color);
}

.fe-bug-form__footer {
    margin-top: 16px;
}

.fe-bug-submit {
    width: 100%;
    padding: 11px;
    color: var(--fe-text-on-accent);
    background: var(--fe-text-strong);
    border: 0;
    border-radius: var(--fe-radius-control);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
}

.fe-bug-submit:hover {
    background: color-mix(in srgb, var(--fe-text-strong) 88%, #000);
}

.fe-bug-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fe-bug-feedback {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--fe-radius-sm);
    font-size: 13px;
    text-align: center;
}

.fe-bug-feedback--success {
    color: var(--fe-success-text);
    background: var(--fe-success-bg);
}

.fe-bug-feedback--error {
    color: var(--fe-error-text);
    background: var(--fe-error-bg);
}

@media (min-width: 540px) {
    .fe-bug-modal {
        align-items: center;
    }

    .fe-bug-modal__panel {
        margin: 20px;
        border-radius: 16px;
    }
}

@media (max-width: 640px) {
    .fe-bug-trigger {
        left: 16px !important;
        bottom: 72px !important;
        justify-content: center;
        width: 42px;
        height: 42px;
        padding: 0;
        gap: 0;
        border-radius: var(--fe-radius-control);
        font-size: 0;
    }

    .fe-bug-trigger svg {
        width: 17px;
        height: 17px;
    }
}
