/* =====================================================
   Feedback Widget Styles
   AWS GovCloud Compliant Feedback Collection System
   2026-07-29: re-themed from indigo to the Help & Support
   Sky palette (#0284c7 family) + v2026 tokens.
   ===================================================== */

/* Feedback Button (Floating) */
.feedback-button {
    position: fixed;
    /* LEFT vertical stack (EH 2026-09-02 reorder): accessiBe bottom:44 (clears the ~40px bar),
       feedback bottom:108, guides ON TOP at bottom:172 (conditional widget
       topmost — no mid-stack hole when absent). left:9 centers the 52px
       button on the 70px icon rail's column, matching the nav above. */
    bottom: 108px;
    left: 9px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 20px;
}

.feedback-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.45);
}

.feedback-button.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(2, 132, 199, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(2, 132, 199, 0);
    }
}

/* Feedback Modal Overlay */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 9999;
    display: none;
    animation: fadeIn 0.3s ease;
}

.feedback-overlay.active {
    display: block;
}

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

/* Feedback Modal */
.feedback-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 760px; /* was 600 — EH 2026-08-31: "a bit wider" */
    max-height: 90vh;
    overflow: hidden;
    z-index: 10000;
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

.feedback-modal.active {
    display: block;
}

@keyframes slideIn {
    from {
        transform: translate(-50%, -48%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

/* Modal Header */
.feedback-header {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.feedback-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.feedback-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Modal Body */
.feedback-body {
    padding: 20px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

/* Progress Steps */
.feedback-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 0 20px;
}

.feedback-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.feedback-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #e2e8f0;
    z-index: -1;
}

.feedback-step.active:not(:last-child)::after,
.feedback-step.completed:not(:last-child)::after {
    background: #059669;
}

.step-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 5px;
    transition: all 0.3s;
}

.feedback-step.active .step-circle {
    background: #0284c7;
    color: white;
    transform: scale(1.1);
}

.feedback-step.completed .step-circle {
    background: #059669;
    color: white;
}

.step-label {
    font-size: 12px;
    color: #64748b;
}

.feedback-step.active .step-label,
.feedback-step.completed .step-label {
    color: #1e293b;
    font-weight: 500;
}

/* Form Controls */
.feedback-form-group {
    margin-bottom: 20px;
}

.feedback-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1e293b;
    font-size: 14px;
}

.feedback-label .required {
    color: #dc2626;
}

.feedback-input,
.feedback-textarea,
.feedback-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.feedback-input:focus,
.feedback-textarea:focus,
.feedback-select:focus {
    border-color: #0284c7;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(2, 132, 199, 0.15);
}

.feedback-textarea {
    min-height: 100px;
    resize: vertical;
}

.feedback-select {
    cursor: pointer;
}

/* Radio and Checkbox Groups */
.feedback-radio-group,
.feedback-checkbox-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.feedback-radio-label,
.feedback-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.feedback-radio-label input,
.feedback-checkbox-label input {
    margin-right: 6px;
}

/* Screenshot Section */
.screenshot-container {
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background: #f8fafc;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.screenshot-container.has-screenshot {
    border-color: #059669;
    background: #ecfdf5;
}

.screenshot-preview {
    max-width: 100%;
    max-height: 300px;
    margin: 10px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.screenshot-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

/* Annotation Canvas */
.annotation-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    display: none;
}

.annotation-container.active {
    /* Center fabric's .canvas-container wrapper (the in-flow child; the
       toolbar is absolute). Top padding keeps the canvas clear of the toolbar. */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 90px 16px 16px;
}

.annotation-toolbar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 14px;
    padding: 10px;
    display: flex;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10002;
}

.annotation-tool {
    width: 40px;
    height: 40px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 18px;
}

.annotation-tool:hover {
    border-color: #0284c7;
    background: #f0f9ff;
}

.annotation-tool.active {
    background: #0284c7;
    color: white;
    border-color: #0284c7;
}

.annotation-tool.separator {
    width: 1px;
    background: #e2e8f0;
    cursor: default;
    padding: 0;
}

.color-picker {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#annotation-canvas {
    /* NO layout/position/transform rules here: fabric.js wraps this canvas in
       .canvas-container and overlays an upper drawing canvas at the same spot.
       Any offset applied to this element moves the screenshot layer without the
       drawing layer (it shoved the image off-screen). Centering is handled by
       the flex rules on .annotation-container.active above. */
    cursor: crosshair;
    display: block;
}

/* Button Styles */
.feedback-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-btn-primary {
    background: #0284c7;
    color: white;
}

.feedback-btn-primary:hover {
    background: #075985;
}

.feedback-btn-secondary {
    background: white;
    color: #64748b;
    border: 2px solid #e2e8f0;
    padding: 8px 18px;
}

.feedback-btn-secondary:hover {
    border-color: #cbd5e1;
    color: #1e293b;
}

.feedback-btn-success {
    background: #059669;
    color: white;
}

.feedback-btn-success:hover {
    background: #047857;
}

.feedback-btn-outline {
    background: white;
    color: #0284c7;
    border: 1px solid #0284c7;
}

.feedback-btn-outline:hover {
    background: #0284c7;
    color: white;
}

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

/* Modal Footer */
.feedback-footer {
    padding: 15px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-footer-left,
.feedback-footer-right {
    display: flex;
    gap: 10px;
}

/* Loading Spinner */
.feedback-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(2, 132, 199, 0.3);
    border-radius: 50%;
    border-top-color: #0284c7;
    animation: spin 1s ease-in-out infinite;
}

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

.feedback-loading {
    text-align: center;
    padding: 40px;
}

.feedback-loading .feedback-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
}

/* Success/Error Messages */
.feedback-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.feedback-message-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.feedback-message-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.feedback-message-info {
    background: #eff6ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
}

.feedback-message i {
    margin-right: 10px;
    font-size: 18px;
}

/* Help Text */
.feedback-help-text {
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
}

/* Character Counter */
.feedback-char-counter {
    text-align: right;
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
}

.feedback-char-counter.warning {
    color: #d97706;
}

.feedback-char-counter.danger {
    color: #dc2626;
}

/* Console Logs Display */
.console-logs-container {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 8px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.console-log-entry {
    padding: 2px 0;
    border-bottom: 1px solid #333;
}

.console-log-error {
    color: #f48771;
}

.console-log-warn {
    color: #cca700;
}

.console-log-info {
    color: #75beff;
}

/* Metadata Display */
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 12px;
}

.metadata-item {
    display: flex;
    align-items: center;
}

.metadata-label {
    font-weight: 500;
    margin-right: 5px;
    color: #1e293b;
}

.metadata-value {
    color: #64748b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .feedback-modal {
        width: 95%;
        max-width: none;
    }

    .feedback-steps {
        padding: 0 10px;
    }

    .step-label {
        font-size: 10px;
    }

    .metadata-grid {
        grid-template-columns: 1fr;
    }

    .feedback-footer {
        flex-direction: column;
        gap: 10px;
    }

    .feedback-footer-left,
    .feedback-footer-right {
        width: 100%;
        justify-content: center;
    }
}

/* Accessibility */
.feedback-modal:focus,
.feedback-btn:focus,
.annotation-tool:focus {
    outline: 2px solid #0284c7;
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Dark mode RETIRED 2026-09-16 (EH: the widget must match the rest of the
   portal, which is light-only; a portal-wide light/dark theme is planned in
   plans/LIGHT-DARK-THEME-PLAN.md — the widget joins that, not its own
   prefers-color-scheme rule).
/* Dark Mode Support (optional) * /
@media (prefers-color-scheme: dark) {
    .feedback-modal {
        background: #2d3748;
        color: #e2e8f0;
    }

    .feedback-input,
    .feedback-textarea,
    .feedback-select {
        background: #374151;
        color: #e2e8f0;
        border-color: #4b5563;
    }

    .feedback-label {
        color: #e2e8f0;
    }

    .screenshot-container {
        background: #374151;
        border-color: #4b5563;
    }

    .feedback-footer {
        background: #374151;
        border-color: #4b5563;
    }
}

*/

/* =====================================================
   Launcher (EH 2026-09-16): "How Can We Help?" — three
   tiles, centered descriptions; chat + ticket panes.
   ===================================================== */
.feedback-choose-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 6px 0 4px;
}
@media (max-width: 640px) {
    .feedback-choose-grid { grid-template-columns: 1fr; }
}
.feedback-choose-tile {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 26px 16px 22px;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}
.feedback-choose-tile:hover,
.feedback-choose-tile:focus {
    border-color: #0284c7;
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.15);
    transform: translateY(-2px);
    outline: none;
}
.feedback-choose-tile i {
    display: inline-flex; align-items: center; justify-content: center;
    width: 96px; height: 96px; border-radius: 50%;
    background: #e0f2fe; color: #0284c7; line-height: 1;   /* size = the fa-3x class on the <i> */
    margin: 0 auto 6px;
}
.feedback-choose-tile:hover i,
.feedback-choose-tile:focus i { background: #0284c7; color: #fff; }
.feedback-choose-name { font-size: 16px; font-weight: 700; color: #0f172a; }
.feedback-choose-desc { font-size: 13px; color: #64748b; line-height: 1.45; }

/* Chat with Support */
.fb-chat-log {
    height: 320px;
    overflow-y: auto;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fb-chat-msg {
    max-width: 85%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
.fb-chat-msg.user { align-self: flex-end; background: #0284c7; color: #fff; }
.fb-chat-msg.agent { align-self: flex-start; background: #fff; border: 1px solid #e2e8f0; color: #1e293b; }
.fb-chat-msg.system { align-self: center; background: transparent; color: #64748b; font-style: italic; font-size: 12px; }
.fb-chat-meta { font-size: 11px; opacity: 0.75; margin-bottom: 3px; font-weight: 600; }
.fb-chat-status { font-size: 12px; color: #64748b; margin: 8px 2px; }
.fb-chat-send { display: flex; gap: 8px; align-items: stretch; margin-top: 4px; }
.fb-chat-send textarea { flex: 1; resize: none; min-height: 44px; }
