/* Debug Recorder Widget */
#debug-recorder-widget {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 2147483647;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
}

/* Idle bug icon */
#debug-recorder-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #555;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: opacity 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    padding: 0;
}

#debug-recorder-btn:hover {
    opacity: 1;
}

#debug-recorder-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Recording state */
#debug-recorder-widget.recording #debug-recorder-btn {
    background: #e53e3e;
    opacity: 1;
    animation: debug-pulse 1.5s ease-in-out infinite;
}

#debug-recorder-label {
    display: none;
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: #e53e3e;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 500;
}

#debug-recorder-widget.recording #debug-recorder-label {
    display: block;
}

@keyframes debug-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(229, 62, 62, 0); }
}

/* Submit modal */
#debug-recorder-modal {
    display: none;
    position: fixed;
    bottom: 60px;
    right: 16px;
    width: 320px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    padding: 16px;
    z-index: 2147483647;
}

#debug-recorder-modal.visible {
    display: block;
}

#debug-recorder-modal h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

#debug-recorder-modal textarea {
    width: 100%;
    height: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}

#debug-recorder-modal textarea:focus {
    outline: none;
    border-color: #4a90d9;
}

#debug-recorder-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

#debug-recorder-modal-actions button {
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
}

#debug-recorder-submit-btn {
    background: #4a90d9;
    color: #fff;
    border-color: #4a90d9 !important;
}

#debug-recorder-submit-btn:hover {
    background: #357abd;
}

#debug-recorder-cancel-btn {
    background: #fff;
    color: #333;
}

#debug-recorder-cancel-btn:hover {
    background: #f5f5f5;
}

/* Toast notification */
#debug-recorder-toast {
    display: none;
    position: fixed;
    bottom: 60px;
    right: 16px;
    background: #48bb78;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    z-index: 2147483647;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#debug-recorder-toast.visible {
    display: block;
}

/* Size warning nudge */
#debug-recorder-nudge {
    display: none;
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: #ed8936;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 12px;
}

#debug-recorder-widget.storage-full #debug-recorder-nudge {
    display: block;
}

#debug-recorder-widget.storage-full #debug-recorder-label {
    display: none;
}

/* List button (next to bug icon) */
#debug-recorder-list-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #555;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: opacity 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    padding: 0;
    position: fixed;
    bottom: 16px;
    right: 56px;
}

#debug-recorder-list-btn:hover {
    opacity: 1;
}

#debug-recorder-list-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Badge */
#debug-recorder-badge {
    display: none;
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e53e3e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    line-height: 16px;
    text-align: center;
}

/* List popover */
#debug-recorder-list-popover {
    display: none;
    position: fixed;
    bottom: 60px;
    right: 16px;
    width: 340px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    padding: 12px;
    z-index: 2147483647;
}

#debug-recorder-list-popover.visible {
    display: block;
}

.debug-list-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.debug-list-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #48bb78;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.debug-list-open-label {
    color: #a0aec0;
}

.debug-list-divider {
    border-top: 1px solid #eee;
    margin: 10px 0;
}

.debug-list-item {
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #f7fafc;
}

/* Dim only the specific text children of an "open / under review" session,
   so the dev-note banner above (if present) stays fully visible. Opacity on
   the parent would create a stacking context that children cannot escape. */
.debug-list-item-open .debug-list-item-desc,
.debug-list-item-open .debug-list-item-date,
.debug-list-item-open .debug-list-item-actions {
    opacity: 0.55;
}

/* Dev note banner — prominent message from the developer to the bug reporter. */
.debug-list-item-devnote {
    background: #fffbea;
    border: 1px solid #f6c66f;
    border-left: 3px solid #ed8936;
    border-radius: 4px;
    padding: 6px 8px;
    margin: 0 0 8px 0;
}

.debug-list-item-devnote-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #c05621;
    margin-bottom: 3px;
}

.debug-list-item-devnote-text {
    font-size: 12px;
    color: #2d3748;
    line-height: 1.4;
    word-break: break-word;
}

.debug-list-item-desc {
    font-size: 13px;
    color: #333;
    margin-bottom: 2px;
    word-break: break-word;
    white-space: pre-wrap;
}

.debug-list-item-date {
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
}

.debug-list-item-actions {
    display: flex;
    gap: 6px;
}

.debug-list-btn-reopen,
.debug-list-btn-close {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}

.debug-list-btn-close {
    background: #48bb78;
    color: #fff;
    border-color: #48bb78;
}

.debug-list-btn-close:hover {
    background: #38a169;
}

.debug-list-btn-reopen {
    background: #fff;
    color: #e53e3e;
    border-color: #e53e3e;
}

.debug-list-btn-reopen:hover {
    background: #fff5f5;
}

.debug-list-reopen-form {
    margin-top: 6px;
}

.debug-list-reopen-text {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 6px;
    box-sizing: border-box;
}

.debug-list-reopen-text:focus {
    outline: none;
    border-color: #e53e3e;
}

.debug-list-btn-reopen-submit {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #e53e3e;
    cursor: pointer;
    font-size: 11px;
    background: #e53e3e;
    color: #fff;
}

.debug-list-btn-reopen-submit:hover {
    background: #c53030;
}

.debug-list-btn-reopen-cancel {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    font-size: 11px;
    background: #fff;
    color: #666;
}

.debug-list-btn-reopen-cancel:hover {
    background: #f5f5f5;
}

/* Context element outline flash (applied briefly when a div is clicked during recording) */
.debug-recorder-outline-flash {
    animation: debug-recorder-outline-fade 1.2s ease-out forwards;
}

@keyframes debug-recorder-outline-fade {
    0%   { outline-color: #e53e3e; }
    100% { outline-color: rgba(229, 62, 62, 0); }
}
