/* ===== Feedback Widget (fbw) ===== */

.fbw {
    position: fixed;
    z-index: 99999;
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Trigger Button ── */
.fbw__trigger {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: #f97316;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 12px rgba(249, 115, 22, 0.35),
        0 1px 3px rgba(0, 0, 0, 0.1);
    animation: fbw-float 3s ease-in-out infinite;
}

@keyframes fbw-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

.fbw__trigger:hover {
    animation-play-state: paused;
    transform: scale(1.08);
    box-shadow:
        0 6px 20px rgba(249, 115, 22, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.12);
}

.fbw__trigger .material-symbols-rounded {
    font-size: 24px;
    color: #fff;
}

.fbw__trigger--hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
    animation: none;
}

/* ── Panel ── */
.fbw__panel {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    width: 360px;
    max-height: 80vh;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}

.fbw__panel--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.fbw__panel-inner {
    max-height: 80vh;
    overflow-y: auto;
}

/* ── Header ── */
.fbw__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.fbw__header-icon {
    font-size: 22px;
    color: var(--color-primary, #4f46e5);
}

.fbw__header-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.fbw__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    color: rgba(15, 23, 42, 0.5);
    transition: background 0.15s;
}

.fbw__close:hover {
    background: rgba(15, 23, 42, 0.06);
}

/* ── Steps ── */
.fbw__step {
    padding: 16px;
}

/* ── Consent Step ── */
.fbw__disclaimer {
    display: flex;
    gap: 10px;
    padding: 14px;
    border-radius: 10px;
    background: rgba(79, 70, 229, 0.06);
    border: 1px solid rgba(79, 70, 229, 0.1);
    margin-bottom: 14px;
}

.fbw__disclaimer-icon {
    font-size: 20px;
    color: var(--color-primary, #4f46e5);
    flex-shrink: 0;
    margin-top: 1px;
}

.fbw__disclaimer-text {
    font-size: 12.5px;
    line-height: 1.6;
    color: #334155;
    margin: 0;
}

.fbw__agree-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    margin-bottom: 14px;
    line-height: 1.4;
}

.fbw__agree-check {
    margin-top: 2px;
    accent-color: var(--color-primary, #4f46e5);
}

.fbw__next-btn {
    width: 100%;
}

/* ── Form Step ── */
.fbw__rating {
    margin-bottom: 14px;
}

.fbw__rating-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 8px;
}

.fbw__rating-btns {
    display: flex;
    gap: 8px;
}

.fbw__rating-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s,
        transform 0.15s;
}

.fbw__rating-btn:hover {
    background: rgba(15, 23, 42, 0.04);
}

.fbw__rating-btn .material-symbols-rounded {
    font-size: 28px;
    color: rgba(15, 23, 42, 0.4);
    transition: color 0.15s;
}

.fbw__rating-btn--active {
    border-color: var(--color-primary, #4f46e5);
    background: rgba(79, 70, 229, 0.08);
}

.fbw__rating-btn--active .material-symbols-rounded {
    color: var(--color-primary, #4f46e5);
}

.fbw__rating-btn[data-rating="bad"]:hover .material-symbols-rounded,
.fbw__rating-btn[data-rating="bad"].fbw__rating-btn--active
    .material-symbols-rounded {
    color: #ef4444;
}

.fbw__rating-btn[data-rating="ok"]:hover .material-symbols-rounded,
.fbw__rating-btn[data-rating="ok"].fbw__rating-btn--active
    .material-symbols-rounded {
    color: #f59e0b;
}

.fbw__rating-btn[data-rating="good"]:hover .material-symbols-rounded,
.fbw__rating-btn[data-rating="good"].fbw__rating-btn--active
    .material-symbols-rounded {
    color: #22c55e;
}

.fbw__rating-btn[data-rating="bad"].fbw__rating-btn--active {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.fbw__rating-btn[data-rating="ok"].fbw__rating-btn--active {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.fbw__rating-btn[data-rating="good"].fbw__rating-btn--active {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

/* ── Textarea ── */
.fbw__textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: #0f172a;
    background: #fff;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 12px;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.fbw__textarea:focus {
    outline: none;
    border-color: var(--color-primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ── Screenshot ── */
.fbw__screenshot-section {
    margin-bottom: 14px;
}

.fbw__screenshot-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px dashed rgba(15, 23, 42, 0.2);
    border-radius: 8px;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #64748b;
    width: 100%;
    justify-content: center;
    transition:
        background 0.15s,
        border-color 0.15s;
}

.fbw__screenshot-btn:hover {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.3);
}

.fbw__screenshot-btn .material-symbols-rounded {
    font-size: 18px;
}

.fbw__screenshot-preview {
    position: relative;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.fbw__screenshot-img {
    display: block;
    width: 100%;
    max-height: 160px;
    object-fit: cover;
}

.fbw__screenshot-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fbw__screenshot-remove .material-symbols-rounded {
    font-size: 16px;
}

.fbw__screenshot-warn {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
    font-size: 11.5px;
    line-height: 1.5;
    color: #92400e;
}

.fbw__screenshot-warn .material-symbols-rounded {
    font-size: 16px;
    color: #f59e0b;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Console Logs ── */
.fbw__console-section {
    margin-bottom: 14px;
}

.fbw__console-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.02);
    cursor: pointer;
    font-size: 13px;
    color: #64748b;
    transition: background 0.15s, border-color 0.15s;
}

.fbw__console-label:hover {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.15);
}

.fbw__console-label:has(input:checked) {
    background: rgba(79, 70, 229, 0.06);
    border-color: var(--color-primary, #4f46e5);
    color: var(--color-primary, #4f46e5);
}

.fbw__console-check {
    accent-color: var(--color-primary, #4f46e5);
}

.fbw__console-label .material-symbols-rounded {
    font-size: 18px;
}

.fbw__console-count {
    font-size: 12px;
    color: #94a3b8;
    margin-left: auto;
}

.fbw__console-info {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.12);
    font-size: 11.5px;
    line-height: 1.5;
    color: #1e40af;
}

.fbw__console-info .material-symbols-rounded {
    font-size: 16px;
    color: #3b82f6;
    flex-shrink: 0;
    margin-top: 1px;
}

[data-theme="dark"] .fbw__console-label {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
}

[data-theme="dark"] .fbw__console-label:hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .fbw__console-label:has(input:checked) {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--color-primary, #6366f1);
    color: var(--color-primary, #6366f1);
}

[data-theme="dark"] .fbw__console-count {
    color: #64748b;
}

[data-theme="dark"] .fbw__console-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* ── Actions ── */
.fbw__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.fbw__submit-btn {
    min-width: 100px;
    position: relative;
}

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

.fbw__spin {
    animation: fbw-spin 0.8s linear infinite;
    font-size: 18px;
}

/* ── Done Step ── */
.fbw__step--done {
    text-align: center;
    padding: 32px 16px;
}

.fbw__done-icon {
    font-size: 48px;
    color: #22c55e;
    margin-bottom: 12px;
}

.fbw__done-text {
    font-size: 14px;
    color: #334155;
    line-height: 1.6;
}

/* ── Dark Theme ── */
[data-theme="dark"] .fbw__panel {
    background: rgba(30, 30, 40, 0.96);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .fbw__header {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .fbw__header-title {
    color: #e2e8f0;
}

[data-theme="dark"] .fbw__close {
    color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .fbw__close:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .fbw__disclaimer {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.2);
}

[data-theme="dark"] .fbw__disclaimer-text {
    color: #cbd5e1;
}

[data-theme="dark"] .fbw__agree-label {
    color: #cbd5e1;
}

[data-theme="dark"] .fbw__rating-label {
    color: #cbd5e1;
}

[data-theme="dark"] .fbw__rating-btn {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .fbw__rating-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .fbw__rating-btn .material-symbols-rounded {
    color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .fbw__textarea {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

[data-theme="dark"] .fbw__textarea:focus {
    border-color: var(--color-primary, #6366f1);
}

[data-theme="dark"] .fbw__screenshot-btn {
    border-color: rgba(255, 255, 255, 0.15);
    color: #94a3b8;
}

[data-theme="dark"] .fbw__screenshot-warn {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .fbw__done-text {
    color: #cbd5e1;
}

/* ── Header bar trigger button (inbox 옆) ── */
.fbw-header-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-subtle, #64748b);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.fbw-header-btn:hover {
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-content, #334155);
}

.fbw-header-btn .material-symbols-rounded {
    font-size: 22px;
}

.fbw-header-btn__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

[data-theme="dark"] .fbw-header-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ── Header-anchored panel (drops down from top-right) ── */
.fbw__panel--header {
    bottom: auto;
    left: auto;
    top: 56px;
    right: 24px;
    transform: translateY(-8px) scale(0.96);
}

.fbw__panel--header.fbw__panel--open {
    transform: translateY(0) scale(1);
}

/* ── Mobile ── */
@media (max-width: 640px) {
    /* 모바일에서 플로팅 버튼 크기 조정 */
    .fbw__trigger {
        width: 44px;
        height: 44px;
        bottom: 16px;
        left: 16px;
        /* 애니메이션은 유지 */
    }

    .fbw__trigger .material-symbols-rounded {
        font-size: 22px;
    }

    .fbw__panel,
    .fbw__panel--header {
        bottom: 0;
        top: auto;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .fbw__panel--open,
    .fbw__panel--header.fbw__panel--open {
        transform: translateY(0);
    }
}
