/* ============================================
   FEEDBACK SYSTEM STYLES
   TruVerifAI - Feedback Collection Feature
   ============================================ */

/* ============================================
   FEEDBACK BUTTONS (Thumbs Up/Down)
   ============================================ */

.feedback-buttons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid var(--border-medium);
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-tertiary);
}

.feedback-btn:hover:not(.voted):not(.disabled) {
    background: var(--bg-secondary);
    border-color: var(--border-medium);
    color: var(--text-secondary);
}

.feedback-btn:active:not(.voted):not(.disabled) {
    transform: scale(0.95);
}

.feedback-btn.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Thumbs Up - Success green when voted */
.feedback-btn.thumbs-up.voted {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.feedback-btn.thumbs-up:hover:not(.voted):not(.disabled) {
    color: var(--success);
    border-color: var(--success);
}

/* Thumbs Down - Error red when voted */
.feedback-btn.thumbs-down.voted {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

.feedback-btn.thumbs-down:hover:not(.voted):not(.disabled) {
    color: var(--error);
    border-color: var(--error);
}

/* Icon inside feedback button */
.feedback-btn i,
.feedback-btn svg {
    width: 16px;
    height: 16px;
}

/* Feedback thank you message */
.feedback-thanks {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: 8px;
    animation: feedbackFadeIn 0.3s ease;
}

@keyframes feedbackFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   FEEDBACK MODAL (Comment on Thumbs Down)
   ============================================ */

.feedback-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay, rgba(0, 0, 0, 0.5));
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.2s ease;
}

.feedback-modal-overlay.active {
    display: flex;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.feedback-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal closing animation */
.feedback-modal-overlay.closing {
    animation: modalFadeOut 0.2s ease forwards;
}

.feedback-modal-overlay.closing .feedback-modal,
.feedback-modal-overlay.closing .bug-report-modal {
    animation: modalSlideOut 0.2s ease forwards;
}

.bug-report-modal-overlay.closing {
    animation: modalFadeOut 0.2s ease forwards;
}

.bug-report-modal-overlay.closing .bug-report-modal {
    animation: modalSlideOut 0.2s ease forwards;
}

@keyframes modalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

.feedback-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-medium);
}

.feedback-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all 0.2s;
}

.feedback-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.feedback-modal-body {
    padding: 24px;
}

.feedback-type-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.feedback-type-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-type-option:hover {
    border-color: var(--brand-primary);
    background: var(--brand-primary-bg);
}

.feedback-type-option.selected {
    border-color: var(--brand-primary);
    background: var(--brand-primary-bg);
}

.feedback-type-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

.feedback-type-option label {
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
}

.feedback-comment-section {
    margin-top: 20px;
}

.feedback-comment-section label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.feedback-comment-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    resize: vertical;
    transition: border-color 0.2s;
}

.feedback-comment-textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-bg);
}

.feedback-comment-textarea::placeholder {
    color: var(--text-tertiary);
}

.feedback-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-medium);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.feedback-btn-secondary {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-dark);
}

.feedback-btn-primary {
    padding: 10px 20px;
    background: var(--brand-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-btn-primary:hover {
    background: var(--brand-primary-hover);
}

.feedback-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   HELP MENU (Header Dropdown)
   ============================================ */

.help-menu-container {
    position: relative;
    display: inline-block;
}

.help-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-secondary, #fafafa);
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary, #525252);
}

.help-menu-btn:hover {
    background: var(--bg-tertiary, #f5f5f5);
    border-color: var(--border-dark, #d4d4d4);
    color: var(--text-primary, #171717);
}

.help-menu-btn.active {
    background: var(--bg-tertiary, #f5f5f5);
    border-color: var(--brand-primary, #059669);
    color: var(--brand-primary, #059669);
}

.help-menu-btn svg {
    width: 20px;
    height: 20px;
}

.help-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-primary, #ffffff);
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.help-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.help-menu-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: var(--bg-primary, #ffffff);
    border-left: 1px solid var(--border-color, #e5e5e5);
    border-top: 1px solid var(--border-color, #e5e5e5);
    transform: rotate(45deg);
}

.help-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #171717);
    cursor: pointer;
    transition: background 0.15s ease;
}

.help-menu-item:first-child {
    border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
}

.help-menu-item:last-child {
    border-radius: 0 0 var(--radius-lg, 12px) var(--radius-lg, 12px);
}

.help-menu-item:only-child {
    border-radius: var(--radius-lg, 12px);
}

.help-menu-item:hover {
    background: var(--bg-secondary, #fafafa);
}

.help-menu-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary, #525252);
    flex-shrink: 0;
}

.help-menu-item:hover svg {
    color: var(--brand-primary, #059669);
}

.help-menu-item span {
    flex: 1;
}

.help-menu-divider {
    height: 1px;
    background: var(--border-color, #e5e5e5);
    margin: 4px 0;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .help-menu-dropdown {
        right: -10px;
        min-width: 180px;
    }
    
    .help-menu-dropdown::before {
        right: 20px;
    }
}

/* ============================================
   BUG REPORT MODAL
   ============================================ */

.bug-report-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay, rgba(0, 0, 0, 0.5));
    z-index: 10001;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.2s ease;
}

.bug-report-modal-overlay.active {
    display: flex;
}

.bug-report-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

.bug-report-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-medium);
}

.bug-report-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bug-report-modal-body {
    padding: 24px;
}

.bug-form-group {
    margin-bottom: 20px;
}

.bug-form-group:last-child {
    margin-bottom: 0;
}

.bug-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.bug-form-group label .required {
    color: var(--error);
    margin-left: 2px;
}

.bug-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: border-color 0.2s;
}

.bug-form-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-bg);
}

.bug-form-input::placeholder {
    color: var(--text-tertiary);
}

.bug-form-textarea {
    min-height: 120px;
    resize: vertical;
}

.bug-severity-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bug-severity-option {
    flex: 1;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: var(--text-secondary);
}

.bug-severity-option:hover {
    border-color: var(--border-dark);
}

.bug-severity-option.selected {
    border-color: var(--brand-primary);
    background: var(--brand-primary-bg);
    color: var(--brand-primary);
}

.bug-severity-option.selected.severity-low {
    border-color: var(--info);
    background: #dbeafe;
    color: var(--info);
}

.bug-severity-option.selected.severity-medium {
    border-color: var(--warning);
    background: #fef3c7;
    color: #b45309;
}

.bug-severity-option.selected.severity-high {
    border-color: #f97316;
    background: #ffedd5;
    color: #c2410c;
}

.bug-severity-option.selected.severity-critical {
    border-color: var(--error);
    background: #fee2e2;
    color: var(--error);
}

.bug-severity-option input[type="radio"] {
    display: none;
}

.bug-context-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.bug-context-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--brand-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.bug-context-checkbox-text {
    flex: 1;
}

.bug-context-checkbox-text span {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
}

.bug-context-checkbox-text small {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.bug-email-note {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.bug-report-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-medium);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ============================================
   DARK MODE ADJUSTMENTS
   ============================================ */

[data-theme="dark"] .feedback-modal,
[data-theme="dark"] .bug-report-modal {
    border: 1px solid var(--border-medium);
}

[data-theme="dark"] .feedback-type-option,
[data-theme="dark"] .bug-severity-option,
[data-theme="dark"] .bug-context-checkbox {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .feedback-type-option:hover,
[data-theme="dark"] .feedback-type-option.selected {
    background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .help-menu-dropdown {
    border-color: var(--border-medium);
}

[data-theme="dark"] .help-menu-dropdown::before {
    background: var(--bg-primary);
    border-color: var(--border-medium);
}

[data-theme="dark"] .bug-severity-option.selected.severity-low {
    background: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .bug-severity-option.selected.severity-medium {
    background: rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .bug-severity-option.selected.severity-high {
    background: rgba(249, 115, 22, 0.2);
}

[data-theme="dark"] .bug-severity-option.selected.severity-critical {
    background: rgba(239, 68, 68, 0.2);
}
