/* =====================================================
   Basher Feedback Widget — Matches Basher Design
   Primary: #1166A6  |  BG: #f5f7fa  |  Text: #2d3748
   ===================================================== */

@media print {
    .fbw-trigger,
    #fbw-popup-container,
    #fbw-popup-content,
    .fbw-popup { display: none !important; }
}

#fbw-popup-content { display: none; }

/* --- Floating Trigger Button (circle — matches go-to-top) --- */
.fbw-trigger {
    position: fixed;
    bottom: 8px;
    z-index: 9990;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #1166A6;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(17, 102, 166, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    outline: none;
    user-select: none;
}

/* LTR: button to the LEFT of go-to-top (right: 15px + 46px + 6px gap) */
[dir="ltr"] .fbw-trigger { right: 67px; left: auto; }
/* RTL: button on the opposite side from go-to-top */
[dir="rtl"] .fbw-trigger { left: 15px; right: auto; }

.fbw-trigger:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(17, 102, 166, 0.5);
    background: #0d5490;
}

.fbw-trigger:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(17, 102, 166, 0.3);
}

.fbw-trigger .fbw-icon { font-size: 18px; color: #fff; }

@keyframes fbwPulseRing {
    0%   { transform: scale(1);   opacity: 0.5; }
    70%  { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1.6); opacity: 0; }
}

.fbw-trigger::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(17, 102, 166, 0.3);
    animation: fbwPulseRing 4s ease-out infinite;
    pointer-events: none;
}

/* --- Popup Overrides --- */
.fbw-popup .dx-popup-content { padding: 0 !important; overflow: hidden; border-radius: 12px; }
.fbw-popup .dx-overlay-content {
    border-radius: 12px !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15) !important;
    border: 1px solid #d1dde8;
}

/* --- Popup Inner --- */
.fbw-popup-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    font-family: "Baloo Bhaijaan 2", "Segoe UI", sans-serif;
}

/* Header */
.fbw-header {
    background: #1166A6;
    padding: 16px 20px 13px;
    color: #fff;
    flex-shrink: 0;
}

.fbw-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.fbw-header-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 2px;
}

.fbw-header-sub { font-size: 12px; opacity: 0.8; margin: 0; }

.fbw-close-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    flex-shrink: 0;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.fbw-close-btn:hover { color: #fff; background: rgba(255,255,255,0.15); }

/* Section wrapper */
.fbw-section { display: flex; flex-direction: column; }

/* Scrollable body */
.fbw-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f5f7fa;
    scrollbar-width: thin;
    scrollbar-color: #b0c8e0 transparent;
}

.fbw-body::-webkit-scrollbar { width: 4px; }
.fbw-body::-webkit-scrollbar-thumb { background: #b0c8e0; border-radius: 4px; }

/* Section labels */
.fbw-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: #64748b;
    margin-bottom: 8px;
}

/* --- Mood Buttons --- */
.fbw-mood-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.fbw-mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: #fff;
    border: 2px solid #d1dde8;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    user-select: none;
    font-family: inherit;
}

.fbw-mood-btn .fbw-mood-emoji { font-size: 22px; line-height: 1; transition: transform 0.2s ease; }

.fbw-mood-btn:hover {
    border-color: #1166A6;
    background: #e8f1f9;
    color: #1166A6;
    transform: translateY(-2px);
}

.fbw-mood-btn:hover .fbw-mood-emoji { transform: scale(1.12); }

.fbw-mood-btn.is-active {
    border-color: #1166A6;
    background: #e8f1f9;
    color: #1166A6;
    box-shadow: 0 2px 10px rgba(17, 102, 166, 0.2);
}

/* --- Star Rating --- */
.fbw-stars { display: flex; gap: 4px; direction: ltr; }

.fbw-star {
    font-size: 26px;
    cursor: pointer;
    color: #d1dde8;
    transition: color 0.15s ease, transform 0.15s ease;
    line-height: 1;
    user-select: none;
}

.fbw-star:hover, .fbw-star.is-hover, .fbw-star.is-active {
    color: #f59e0b;
    transform: scale(1.15);
}

/* --- Type Buttons --- */
.fbw-type-row { display: flex; flex-wrap: wrap; gap: 7px; }

.fbw-type-btn {
    padding: 5px 13px;
    border: 2px solid #d1dde8;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.17s ease;
    user-select: none;
    font-family: inherit;
}

.fbw-type-btn:hover { border-color: #1166A6; color: #1166A6; background: #e8f1f9; }

.fbw-type-btn.is-active {
    border-color: #1166A6;
    background: #1166A6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(17, 102, 166, 0.3);
}

/* --- Textarea --- */
.fbw-textarea {
    width: 100%;
    border: 2px solid #d1dde8;
    border-radius: 10px;
    padding: 10px 13px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 85px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    color: #2d3748;
    background: #fff;
    line-height: 1.5;
}

.fbw-textarea:focus {
    border-color: #1166A6;
    box-shadow: 0 0 0 3px rgba(17, 102, 166, 0.12);
}

.fbw-textarea::placeholder { color: #94a3b8; }

/* --- Checkboxes --- */
.fbw-checks { display: flex; flex-direction: column; gap: 9px; }

.fbw-check-label {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    font-weight: 500;
    user-select: none;
}

.fbw-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #1166A6;
    cursor: pointer;
    flex-shrink: 0;
}

/* --- Screen Info --- */
.fbw-info-box {
    background: #fff;
    border: 1px solid #d1dde8;
    border-radius: 8px;
    padding: 10px 13px;
    font-size: 11px;
    color: #64748b;
    line-height: 1.8;
}

.fbw-info-box span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbw-info-key { font-weight: 700; color: #2d3748; }

/* --- Footer --- */
.fbw-footer {
    padding: 14px 22px 18px;
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

/* --- Submit Button --- */
.fbw-submit-btn {
    width: 100%;
    padding: 13px;
    background: #1166A6;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.fbw-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(17, 102, 166, 0.4);
    background: #0d5490;
}

.fbw-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.fbw-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fbwSpin 0.7s linear infinite;
    display: none;
}

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

/* --- Success State --- */
.fbw-success {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 22px;
    text-align: center;
    flex: 1;
    gap: 12px;
    background: #f5f7fa;
}

.fbw-success-check { width: 60px; height: 60px; }

.fbw-success-check circle {
    fill: none;
    stroke: #1166A6;
    stroke-width: 4;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: fbwCheckCircle 0.5s ease forwards;
}

.fbw-success-check path {
    fill: none;
    stroke: #1166A6;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: fbwCheckTick 0.35s 0.45s ease forwards;
}

@keyframes fbwCheckCircle { to { stroke-dashoffset: 0; } }
@keyframes fbwCheckTick { to { stroke-dashoffset: 0; } }

.fbw-success-title { font-size: 17px; font-weight: 700; color: #2d3748; margin: 0; }
.fbw-success-sub { font-size: 13px; color: #64748b; margin: 0; }

/* --- Responsive --- */
@media (max-width: 540px) {
    .fbw-trigger { bottom: 8px; }
    [dir="ltr"] .fbw-trigger { right: 67px; left: auto; }
    [dir="rtl"] .fbw-trigger { left: 15px; right: auto; }

    /* Bottom sheet on mobile */
    .fbw-popup .dx-overlay-wrapper {
        align-items: flex-end !important;
    }

    .fbw-popup .dx-overlay-content {
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        /* height is set by JS to 92vh so the flex chain has a concrete value */
    }

    .fbw-popup .dx-popup-content {
        border-radius: 16px 16px 0 0 !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .fbw-popup-inner {
        height: 100%;
        border-radius: 16px 16px 0 0;
        overflow: hidden;
    }

    /* Drag handle hint */
    .fbw-header::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255,255,255,0.4);
        border-radius: 2px;
        margin: 0 auto 10px;
    }

    .fbw-mood-row { grid-template-columns: repeat(2, 1fr); }
    .fbw-mood-btn { padding: 10px 4px; font-size: 12px; }
    .fbw-mood-btn .fbw-mood-emoji { font-size: 20px; }
    .fbw-type-row { gap: 6px; }
    .fbw-type-btn { font-size: 12px; padding: 6px 12px; }
    .fbw-body { padding: 14px 16px; gap: 14px; }
    .fbw-header { padding: 10px 16px 13px; }
    .fbw-footer {
        padding: 12px 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* =============================================================
   Snipping Tool
   ============================================================= */

/* --- Snip trigger button (inside popup) --- */
.fbw-snip-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 2px dashed #b0c8e0;
    border-radius: 10px;
    color: #1166A6;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: all 0.18s ease;
    font-family: inherit;
}

.fbw-snip-btn:hover {
    border-color: #1166A6;
    background: #e8f1f9;
}

/* --- Full-screen overlay --- */
#fbw-snip-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    cursor: crosshair;
    user-select: none;
    background: rgba(0, 0, 0, 0.45);
}

/* Hint bar at top */
#fbw-snip-hint {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #1166A6;
    color: #fff;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    padding: 10px;
    font-family: "Baloo Bhaijaan 2", "Segoe UI", sans-serif;
    letter-spacing: 0.2px;
    pointer-events: none;
}

/* Draggable selection rectangle */
#fbw-snip-selection {
    position: absolute;
    display: none;
    border: 2px solid #1166A6;
    background: rgba(17, 102, 166, 0.08);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

/* Corner handles on the selection */
#fbw-snip-selection::before,
#fbw-snip-selection::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #1166A6;
    border-radius: 2px;
}
#fbw-snip-selection::before { top: -4px; left: -4px; }
#fbw-snip-selection::after  { bottom: -4px; right: -4px; }

/* Size indicator inside selection */
#fbw-snip-size {
    position: absolute;
    bottom: -26px;
    left: 0;
    background: #1166A6;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    font-family: "Segoe UI", sans-serif;
}

/* --- Preview thumbnail in popup --- */
.fbw-screenshot-preview {
    border: 2px solid #d1dde8;
    border-radius: 10px;
    overflow: hidden;
    background: #f5f7fa;
}

.fbw-screenshot-preview img {
    width: 100%;
    display: block;
    max-height: 160px;
    object-fit: contain;
    background: #eef2f7;
}

.fbw-screenshot-actions {
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.fbw-snip-action-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #d1dde8;
    border-radius: 7px;
    background: #f5f7fa;
    color: #374151;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.fbw-snip-action-btn:hover { background: #e8f1f9; border-color: #1166A6; color: #1166A6; }

.fbw-snip-remove:hover { background: #fde8e8; border-color: #ef4444; color: #ef4444; }
