/* ============================================================
 * 피드백 UI — 공유 스타일 (index.html, roastery.html 양쪽)
 *
 * 동작 컨텍스트:
 *   - 버튼(.feedback-btn) 은 position:absolute. 컨테이너에
 *     position:relative 가 있어야 정상 배치됨.
 *     - index.html: .coffee-card (relative 지정됨)
 *     - roastery.html: .now-card (이미 relative)
 *   - 모달은 feedback.js 가 첫 호출 시 body 에 주입.
 * ============================================================ */

/* ===== 버튼 =====
 * 카드 배경(브라운 그라디언트)에 묻히지 않도록 비비드한 오렌지-레드 그라디언트 +
 * 글로우 + 은은한 펄스로 시선을 끈다. */
.feedback-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #FF8A00 0%, #FF3D00 100%);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow:
        0 4px 14px rgba(255, 61, 0, 0.55),
        0 0 0 4px rgba(255, 138, 0, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    z-index: 2;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    animation: feedbackPulse 2.2s ease-in-out infinite;
}
.feedback-btn:hover {
    transform: translateY(-1px) scale(1.04);
    filter: brightness(1.08);
    box-shadow:
        0 6px 18px rgba(255, 61, 0, 0.7),
        0 0 0 6px rgba(255, 138, 0, 0.22);
}
.feedback-btn:active { transform: translateY(0) scale(1); }

@keyframes feedbackPulse {
    0%, 100% {
        box-shadow:
            0 4px 14px rgba(255, 61, 0, 0.55),
            0 0 0 0 rgba(255, 138, 0, 0.45);
    }
    50% {
        box-shadow:
            0 4px 14px rgba(255, 61, 0, 0.55),
            0 0 0 8px rgba(255, 138, 0, 0);
    }
}

/* roastery 같은 밝은/투명 카드용 변형 — 동일한 비비드 톤 유지 (override 시 사용). */
.feedback-btn--dark {
    background: linear-gradient(135deg, #FF8A00 0%, #E63900 100%);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.55);
}
.feedback-btn--dark:hover { filter: brightness(1.08); }

/* ===== 모달 ===== */
.fb-modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(20, 15, 10, 0.55);
    z-index: 10000;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 14px;
    overflow-y: auto;
}
.fb-modal.open { display: flex; }
.fb-modal-content {
    background: #fff;
    border-radius: 18px;
    max-width: 520px;
    width: 100%;
    padding: 24px 22px 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin-top: 4vh;
    margin-bottom: 4vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #2a1f15;
}
.fb-modal-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 8px; gap: 12px;
}
.fb-modal-title { font-size: 1.25rem; font-weight: 700; color: #6F4E37; line-height: 1.3; }
.fb-modal-subtitle { font-size: 0.85rem; color: #8B6F47; margin-top: 2px; }
.fb-modal-close {
    background: none; border: none; font-size: 1.6rem; cursor: pointer;
    color: #999; padding: 0; line-height: 1;
    font-family: inherit;
}
.fb-modal-close:hover { color: #6F4E37; }

.fb-field { margin-top: 16px; }
.fb-label { display: block; font-size: 0.9rem; font-weight: 600; color: #4a3a2a; margin-bottom: 8px; }
.fb-label .fb-req { color: #c0392b; margin-left: 2px; }
.fb-input, .fb-textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #d5cabe;
    border-radius: 10px; font-size: 0.95rem; font-family: inherit;
    background: #fffdfa; color: #2a1f15; box-sizing: border-box;
}
.fb-input:focus, .fb-textarea:focus {
    outline: none; border-color: #8B6F47; box-shadow: 0 0 0 3px rgba(139,111,71,0.15);
}
.fb-textarea { resize: vertical; min-height: 80px; }
.fb-hint { font-size: 0.78rem; color: #999; margin-top: 4px; }

/* 3단계 평가 — 좋아요/중간/싫어요 */
.fb-choices {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
}
.fb-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 8px;
    background: #fffdfa;
    border: 2px solid #e2d5c0;
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    color: #4a3a2a;
    transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.fb-choice:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(111,78,55,0.15);
}
.fb-choice:active { transform: translateY(0); }
.fb-choice:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.fb-choice-emoji { font-size: 2.4rem; line-height: 1; }
.fb-choice-label { font-size: 0.92rem; font-weight: 700; letter-spacing: 0.2px; }
.fb-choice-good:hover { border-color: #2E7D32; background: #E8F5E9; color: #1B5E20; }
.fb-choice-mid:hover  { border-color: #F9A825; background: #FFF8E1; color: #E65100; }
.fb-choice-bad:hover  { border-color: #c62828; background: #FFEBEE; color: #B71C1C; }

/* (사용 안 함) 5점 별점 — 다른 페이지가 참조할 가능성 대비 보존 */
.fb-stars { display: flex; gap: 4px; }
.fb-star {
    font-size: 2rem; cursor: pointer; color: #d5cabe;
    transition: transform 0.1s ease, color 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
}
.fb-star.active { color: #f5b400; }
.fb-star:hover { transform: scale(1.15); }

/* 컵노트 토큰 */
.fb-tokens { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-tokens:empty { display: none; }
.fb-token {
    background: #f5ede2; color: #5a4730; border: 1px solid #e2d5c0;
    padding: 8px 14px; border-radius: 999px; cursor: pointer;
    font-size: 0.88rem; font-weight: 500;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}
.fb-token:hover { background: #efe1cd; }
.fb-token.selected {
    background: linear-gradient(135deg, #6F4E37, #8B6F47);
    color: #fff; border-color: transparent;
}
.fb-token.disabled { opacity: 0.4; cursor: not-allowed; }
.fb-custom-row { display: flex; gap: 8px; margin-top: 8px; }
.fb-custom-row .fb-input { flex: 1; }
.fb-custom-add {
    background: #6F4E37; color: #fff; border: none;
    padding: 0 16px; border-radius: 10px; cursor: pointer;
    font-size: 0.88rem; font-weight: 600;
    white-space: nowrap;
    font-family: inherit;
}
.fb-custom-add:hover { background: #8B6F47; }
.fb-custom-add:disabled { background: #c5b8a5; cursor: not-allowed; }
.fb-selected-count { font-size: 0.78rem; color: #8B6F47; margin-top: 6px; }

/* 액션 */
.fb-actions { display: flex; gap: 10px; margin-top: 24px; }
.fb-btn {
    flex: 1; padding: 12px; border-radius: 10px;
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    border: none; transition: background 0.15s ease;
    font-family: inherit;
}
.fb-btn-cancel { background: #f0e8dc; color: #6F4E37; }
.fb-btn-cancel:hover { background: #e5d9c5; }
.fb-btn-submit { background: linear-gradient(135deg, #6F4E37, #8B6F47); color: #fff; }
.fb-btn-submit:hover { filter: brightness(1.08); }
.fb-btn-submit:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

.fb-toast {
    position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
    background: rgba(40, 30, 20, 0.92); color: #fff;
    padding: 12px 22px; border-radius: 999px;
    font-size: 0.9rem; font-weight: 500;
    z-index: 10100; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.fb-toast.show { opacity: 1; }

@media (max-width: 480px) {
    .feedback-btn { top: 10px; right: 10px; padding: 6px 11px; font-size: 0.78rem; }
    .fb-modal { padding: 12px 10px; }
    .fb-modal-content { padding: 20px 16px 16px; margin-top: 2vh; }
    .fb-modal-title { font-size: 1.1rem; }
    .fb-star { font-size: 1.7rem; }
    .fb-choices { gap: 8px; margin-top: 16px; }
    .fb-choice { padding: 16px 4px; gap: 6px; }
    .fb-choice-emoji { font-size: 2rem; }
    .fb-choice-label { font-size: 0.82rem; }
}
