/* chat-report.css — 챗봇 신고 접수 UI */

:root {
    --chat-primary: #0ea5e9;
    --chat-primary-dark: #0284c7;
    --chat-primary-light: #e0f2fe;
    --chat-bg: #f1f5f9;
    --chat-white: #ffffff;
    --chat-text: #1e293b;
    --chat-text-light: #64748b;
    --chat-border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
    background: var(--chat-bg);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    z-index: 10;
}
.chat-header-back {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.chat-header-title {
    font-size: 1.0625rem;
    font-weight: 700;
}
.chat-header-subtitle {
    font-size: 0.6875rem;
    opacity: 0.85;
}

/* ── Chat Area ── */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    -webkit-overflow-scrolling: touch;
}
.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* ── Message Bubbles ── */
.chat-msg {
    display: flex;
    gap: 0.5rem;
    max-width: 88%;
    animation: bubbleIn 0.25s ease-out;
}
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}
.chat-msg.bot .chat-avatar {
    background: var(--chat-primary-light);
    color: var(--chat-primary);
}
.chat-msg.user .chat-avatar {
    background: #dbeafe;
    color: #2563eb;
}

.chat-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1.125rem;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}
.chat-msg.bot .chat-bubble {
    background: var(--chat-white);
    color: var(--chat-text);
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chat-msg.user .chat-bubble {
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

/* ── Typing Indicator ── */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
}
.typing-indicator span {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* ── Option Buttons (chip style) ── */
.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.25rem 0;
    align-self: flex-start;
    max-width: 100%;
    animation: bubbleIn 0.25s ease-out;
}
.chat-option-btn {
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--chat-border);
    border-radius: 2rem;
    background: var(--chat-white);
    font-size: 0.8125rem;
    color: var(--chat-text);
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.chat-option-btn:active { transform: scale(0.97); }
.chat-option-btn:hover { border-color: var(--chat-primary); color: var(--chat-primary); }
.chat-option-btn.selected {
    border-color: var(--chat-primary);
    background: var(--chat-primary-light);
    color: var(--chat-primary-dark);
    font-weight: 600;
}
.chat-option-btn.suggested {
    border-color: var(--chat-primary);
    background: var(--chat-primary-light);
    position: relative;
}
.chat-option-btn.suggested::after {
    content: 'AI 추천';
    position: absolute;
    top: -8px;
    right: 8px;
    font-size: 0.5625rem;
    background: var(--chat-primary);
    color: white;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* ── Photo Thumbnails in Chat ── */
.chat-photos {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-top: 0.375rem;
}
.chat-photos img {
    width: 64px; height: 64px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid var(--chat-border);
}
.chat-photos .photo-fallback {
    width: 64px; height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: rgba(255,255,255,0.2);
    border: 1px dashed rgba(255,255,255,0.5);
    font-size: 0.6875rem;
    text-align: center;
}

/* ── Summary Card ── */
.summary-card {
    background: var(--chat-white);
    border: 1px solid var(--chat-border);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    animation: bubbleIn 0.25s ease-out;
    align-self: flex-start;
    max-width: 88%;
}
.summary-card .summary-title {
    font-weight: 700;
    color: var(--chat-primary-dark);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}
.summary-card .summary-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.summary-card .summary-row:last-child { border-bottom: none; }
.summary-card .summary-label {
    color: var(--chat-text-light);
    flex-shrink: 0;
    min-width: 4.5rem;
}
.summary-card .summary-value {
    color: var(--chat-text);
    font-weight: 500;
}
.summary-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    animation: bubbleIn 0.25s ease-out;
    align-self: flex-start;
}
.summary-actions button {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.summary-actions .btn-submit {
    background: var(--chat-primary);
    color: white;
}
.summary-actions .btn-submit:active { background: var(--chat-primary-dark); }
.summary-actions .btn-edit {
    background: #f1f5f9;
    color: var(--chat-text);
}

/* ── Input Bar ── */
.chat-input-bar {
    background: var(--chat-white);
    border-top: 1px solid var(--chat-border);
    padding: 0.5rem 0.75rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}
.chat-input-bar.disabled {
    opacity: 0.5;
    pointer-events: none;
}
.chat-photo-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--chat-border);
    background: var(--chat-white);
    font-size: 1.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.chat-photo-btn .photo-count {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--chat-primary);
    color: white;
    font-size: 0.625rem;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.chat-text-input {
    flex: 1;
    border: 1.5px solid var(--chat-border);
    border-radius: 1.25rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    outline: none;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    font-family: inherit;
}
.chat-text-input:focus { border-color: var(--chat-primary); }
.chat-send-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--chat-primary);
    color: white;
    font-size: 1.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}
.chat-send-btn:disabled { background: #cbd5e1; cursor: not-allowed; }
.chat-send-btn:not(:disabled):active { background: var(--chat-primary-dark); }

/* ── Loading overlay ── */
.chat-loading {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.chat-loading-inner {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--chat-text);
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

/* ── Animations ── */
@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Responsive ── */
@media (min-width: 480px) {
    body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 20px rgba(0,0,0,0.1); }
}
