/* ===== BUG REPORT WIDGET ===== */

/* --- Floating Bug Button ---
   Permanently anchored to the LEFT of the Sidekick bubble (Sidekick at
   right:24 → bug at right:88 leaves an 8px gap between them, same shape
   they have when docked together as a horizontal pair). When Sidekick
   is hidden (student pages) the bug bubble takes the corner anchor
   instead — see .br-bubble.br-bubble-alone below. When Sidekick is in
   sidebar mode (taking the right 380px), the bug bubble shifts further
   left via the body class rule at the bottom of this file.            */
.br-bubble {
    position: fixed;
    bottom: 24px;
    right: 88px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fef2f2;
    border: 1px solid #fecaca;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    animation: br-entrance 0.4s ease-out 0.2s both;
}
.br-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16), 0 2px 4px rgba(0, 0, 0, 0.1);
}
.br-bubble:active { transform: translateY(0); }
.br-bubble .br-bubble-svg { width: 30px; height: 30px; display: block; }
/* Drop to the corner when Sidekick isn't rendered (students). */
/* When Sidekick is absent entirely (student pages), the bug bubble
   takes the natural corner anchor at right:24 instead of right:88. */
.br-bubble.br-bubble-alone { right: 24px; }
/* When Sidekick is in sidebar mode (taking the right 380px),
   shift the bug bubble to sit just left of the sidebar's left edge. */
body.tc-sidekick-mode-sidebar.tc-sidekick-panel-open .br-bubble {
    right: calc(380px + 24px);
    transition: right 0.25s ease;
}

@keyframes br-entrance {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Tooltip — sits to the LEFT of the 56px bubble. */
.br-bubble::after {
    content: 'Report a Bug';
    position: absolute;
    right: 64px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: #1f2937;
    color: #fff;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.br-bubble:hover::after { opacity: 1; }

/* --- Capturing overlay --- */
.br-capturing {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.15);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.br-capturing-flash {
    animation: br-flash 0.3s ease-out;
}
@keyframes br-flash {
    0% { background: rgba(255,255,255,0.6); }
    100% { background: rgba(255,255,255,0); }
}

/* --- Modal overlay --- */
.br-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.br-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* --- Modal card --- */
.br-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 520px;
    max-width: 94vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(12px) scale(0.97);
    transition: transform 0.25s ease;
}
.br-overlay.open .br-modal {
    transform: translateY(0) scale(1);
}

/* Header — Phase 11 restyle to match Sidekick's clean place-card aesthetic.
   Drops the amber gradient for a white card with a soft red accent strip,
   matching the bug bubble's palette without the in-your-face flash. */
.br-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: #fef2f2;
    border-bottom: 1px solid #fee2e2;
    color: #1f2937;
}
.br-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #fecaca;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}
.br-header-icon .br-header-svg { width: 24px; height: 24px; display: block; }
.br-header-text { flex: 1; }
.br-header-title { font-size: 16px; font-weight: 700; color: #111827; }
.br-header-sub { font-size: 11px; color: #6b7280; margin-top: 2px; }
.br-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.br-close:hover { opacity: 1; color: #111827; }

/* Body (scrollable) */
.br-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Screenshot preview */
.br-screenshot-wrap {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
    max-height: 260px;
}
.br-screenshot-wrap img {
    width: 100%;
    display: block;
    object-fit: contain;
    max-height: 256px;
    background: #f3f4f6;
}
.br-screenshot-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Description field */
.br-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    display: block;
}
.br-desc-wrap {
    position: relative;
    margin-bottom: 16px;
}
.br-desc {
    width: 100%;
    min-height: 100px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px 44px 12px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.br-desc:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.br-desc::placeholder { color: #9ca3af; }

/* Mic button inside textarea */
.br-mic {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.15s;
}
.br-mic:hover { background: #f9fafb; border-color: #9ca3af; }
.br-mic.recording {
    background: #fee2e2;
    border-color: #ef4444;
    animation: br-mic-pulse 1s infinite;
}
@keyframes br-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Metadata info */
.br-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.br-meta-tag {
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer */
.br-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}
.br-btn-cancel {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.br-btn-cancel:hover { background: #f3f4f6; }

.br-btn-submit {
    padding: 9px 22px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.br-btn-submit:hover { opacity: 0.9; }
.br-btn-submit:active { transform: scale(0.97); }
.br-btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Sending spinner */
.br-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: br-spin 0.6s linear infinite;
    display: none;
}
.br-btn-submit.sending .br-spinner { display: block; }
.br-btn-submit.sending .br-btn-label { display: none; }

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

/* Success state */
.br-success {
    text-align: center;
    padding: 32px 20px;
}
.br-success-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.br-success-title {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
    margin-bottom: 6px;
}
.br-success-msg {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 16px;
}
.br-success-link {
    display: inline-block;
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
}
.br-success-link:hover { text-decoration: underline; }

/* Error state */
.br-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: #991b1b;
    margin-bottom: 12px;
    display: none;
}
.br-error.visible { display: block; }

/* --- Phase 11: file upload dropzone + chips --- */
.br-dropzone {
    border: 1.5px dashed #d1d5db;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
    background: #f9fafb;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.br-dropzone.br-dropzone-hover {
    border-color: #dc2626;
    background: #fef2f2;
}
.br-dropzone-prompt {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
    flex-wrap: wrap;
}
.br-dropzone-icon { font-size: 20px; }
.br-dropzone-pick {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.br-dropzone-pick:hover { background: #f3f4f6; border-color: #9ca3af; }
.br-dropzone-hint {
    width: 100%;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.br-attached-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.br-attached-list:empty { margin-top: 0; }
.br-attached-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    color: #1f2937;
    max-width: 100%;
}
.br-attached-chip-icon { font-size: 13px; flex-shrink: 0; }
.br-attached-chip-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.br-attached-chip-size { color: #9ca3af; font-size: 11px; flex-shrink: 0; }
.br-attached-chip-remove {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    flex-shrink: 0;
}
.br-attached-chip-remove:hover { color: #dc2626; }
