/* Feedback Widget Styles */
.feedback-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--feedback-color, #4A90D9);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 22px;
    user-select: none;
    touch-action: none;
}

.feedback-widget-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.feedback-widget-btn:focus-visible {
    outline: 2px solid var(--feedback-color, #4A90D9);
    outline-offset: 3px;
}

.feedback-widget-btn.bottom-left {
    right: auto;
    left: 24px;
}

.feedback-widget-panel {
    position: fixed;
    bottom: 86px;
    right: 24px;
    width: 370px;
    max-height: 520px;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.feedback-widget-panel.bottom-left {
    right: auto;
    left: 24px;
}

.feedback-widget-panel.open {
    display: flex;
    animation: feedbackSlideUp 0.25s ease-out;
}

/* Dark theme overrides */
.feedback-widget-panel.dark-theme {
    background: #1e1e2e;
    color: #e0e0e0;
    border-color: #3a3a4a;
}

.feedback-widget-panel.dark-theme .feedback-panel-body input,
.feedback-widget-panel.dark-theme .feedback-panel-body select,
.feedback-widget-panel.dark-theme .feedback-panel-body textarea {
    background: #2a2a3a;
    color: #e0e0e0;
    border-color: #4a4a5a;
}

.feedback-widget-panel.dark-theme .feedback-panel-body label {
    color: #c0c0d0;
}

.feedback-widget-panel.dark-theme .feedback-screenshot-btns button {
    background: #2a2a3a;
    color: #e0e0e0;
    border-color: #4a4a5a;
}

.feedback-widget-panel.dark-theme .feedback-screenshot-btns button:hover {
    background: #3a3a4a;
}

.feedback-widget-panel.dark-theme .feedback-attachment-drop {
    background: #2a2a3a;
    border-color: #4a4a5a;
    color: #c0c0d0;
}

@keyframes feedbackSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.feedback-panel-header {
    padding: 14px 16px;
    background: var(--feedback-color, #4A90D9);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}

.feedback-panel-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
}

.feedback-panel-header button:hover {
    opacity: 1;
}

.feedback-panel-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.feedback-panel-body label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
    color: var(--bs-body-color, #212529);
}

.feedback-panel-body input,
.feedback-panel-body select,
.feedback-panel-body textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 10px;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    box-sizing: border-box;
}

.feedback-panel-body textarea {
    resize: vertical;
    min-height: 70px;
}

.feedback-panel-body input:focus,
.feedback-panel-body select:focus,
.feedback-panel-body textarea:focus {
    outline: none;
    border-color: var(--feedback-color, #4A90D9);
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.feedback-screenshot-section {
    margin-bottom: 10px;
}

.feedback-screenshot-btns {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.feedback-screenshot-btns button {
    flex: 1;
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: 6px;
    background: var(--bs-tertiary-bg, #f8f9fa);
    color: var(--bs-body-color, #212529);
    cursor: pointer;
    transition: background 0.15s;
}

.feedback-screenshot-btns button:hover {
    background: var(--bs-secondary-bg, #e9ecef);
}

.feedback-screenshot-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.feedback-screenshot-preview img {
    max-width: 100%;
    max-height: 100px;
    border-radius: 6px;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.feedback-screenshot-preview .remove-screenshot {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Duplicate warning */
.feedback-duplicate-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
    margin-bottom: 10px;
}

.feedback-widget-panel.dark-theme .feedback-duplicate-warning {
    background: #332b00;
    color: #ffc107;
    border-color: #665500;
}

/* Attachment section */
.feedback-attachment-section {
    margin-bottom: 10px;
}

.feedback-attachment-drop {
    border: 2px dashed var(--bs-border-color, #ced4da);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--bs-secondary-color, #6c757d);
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 8px;
    cursor: pointer;
}

.feedback-attachment-drop.dragover {
    border-color: var(--feedback-color, #4A90D9);
    background: rgba(74, 144, 217, 0.05);
}

.feedback-attachment-drop a {
    color: var(--feedback-color, #4A90D9);
    text-decoration: underline;
}

.feedback-attachment-list {
    max-height: 80px;
    overflow-y: auto;
}

.feedback-attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    font-size: 12px;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border-radius: 4px;
    margin-bottom: 4px;
}

.feedback-att-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.feedback-att-remove {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 14px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.feedback-submit-btn {
    width: 100%;
    padding: 10px;
    background: var(--feedback-color, #4A90D9);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.feedback-submit-btn:hover {
    opacity: 0.9;
}

.feedback-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toast notification */
.feedback-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: feedbackToastIn 0.3s ease-out;
    max-width: 350px;
}

.feedback-toast.success { background: #198754; }
.feedback-toast.error { background: #dc3545; }

@keyframes feedbackToastIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Screenshot overlay */
.feedback-capture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    cursor: crosshair;
    background: rgba(0,0,0,0.3);
    touch-action: none;
}

.feedback-capture-selection {
    position: absolute;
    border: 2px dashed #4A90D9;
    background: rgba(74, 144, 217, 0.1);
}

/* Annotation Editor Overlay */
.feedback-annotation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10002;
    background: rgba(30, 30, 30, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.feedback-annotation-toolbar {
    display: flex;
    gap: 6px;
    padding: 8px 14px;
    background: #2a2a3a;
    border-radius: 8px;
    margin-bottom: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.feedback-annotation-toolbar button {
    padding: 6px 12px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #3a3a4a;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.feedback-annotation-toolbar button:hover {
    background: #4a4a5a;
}

.feedback-annotation-toolbar button.active {
    background: var(--feedback-color, #4A90D9);
    border-color: var(--feedback-color, #4A90D9);
    color: #fff;
}

.feedback-annotation-toolbar .toolbar-separator {
    width: 1px;
    height: 24px;
    background: #555;
    margin: 0 4px;
}

.feedback-annotation-toolbar input[type="color"] {
    width: 28px;
    height: 28px;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 1px;
    background: #3a3a4a;
    cursor: pointer;
}

.feedback-annotation-toolbar .ann-done-btn {
    background: #198754;
    border-color: #198754;
    color: #fff;
    font-weight: 600;
}

.feedback-annotation-toolbar .ann-done-btn:hover {
    background: #157347;
}

.feedback-annotation-toolbar .ann-cancel-btn {
    background: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.feedback-annotation-toolbar .ann-cancel-btn:hover {
    background: #5c636a;
}

.feedback-annotation-canvas-wrap {
    position: relative;
    max-width: 90vw;
    max-height: calc(100vh - 100px);
    overflow: auto;
    border: 2px solid #555;
    border-radius: 6px;
    background: #111;
}

.feedback-annotation-canvas-wrap canvas {
    display: block;
    cursor: crosshair;
}

.feedback-annotation-canvas-wrap canvas.feedback-annotation-bg {
    position: relative;
}

.feedback-annotation-canvas-wrap canvas.feedback-annotation-draw {
    position: absolute;
    top: 0;
    left: 0;
}

/* Vote button in duplicate warning */
.feedback-vote-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #856404;
    border-radius: 4px;
    background: rgba(255, 193, 7, 0.15);
    color: #856404;
    cursor: pointer;
    transition: background 0.15s;
}

.feedback-vote-btn:hover {
    background: rgba(255, 193, 7, 0.3);
}

.feedback-widget-panel.dark-theme .feedback-vote-btn {
    border-color: #ffc107;
    color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.feedback-widget-panel.dark-theme .feedback-vote-btn:hover {
    background: rgba(255, 193, 7, 0.25);
}

/* Responsive */
@media (max-width: 480px) {
    .feedback-widget-panel {
        width: calc(100vw - 24px);
        right: 12px;
        left: 12px;
        bottom: 80px;
    }
    .feedback-widget-panel.bottom-left {
        right: 12px;
    }
}
