/* 실시간 채팅 플로팅 (사용자 페이지) */
.chat-fab {
    position: fixed;
    right: 16px;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    z-index: 10160;
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #00cec9);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 8px 28px rgba(0, 206, 201, 0.45), 0 4px 16px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.chat-fab:hover {
    transform: scale(1.06);
}

.chat-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ff4757;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.chat-panel {
    position: fixed;
    right: 16px;
    bottom: calc(142px + env(safe-area-inset-bottom, 0px));
    z-index: 10165;
    width: min(360px, calc(100vw - 32px));
    height: min(480px, calc(100vh - 200px));
    max-height: calc(100vh - 180px);
    background: #141820;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-panel.hidden {
    display: none !important;
}

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(90deg, #2d3436, #0984e3);
    color: #fff;
    font-weight: 600;
    flex-shrink: 0;
}

.chat-panel-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.chat-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-panel-footer {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #0f1218;
}

.chat-panel-footer textarea {
    flex: 1;
    min-width: 0;
    resize: none;
    border-radius: 10px;
    border: 1px solid #333;
    background: #1e2430;
    color: #e8eaed;
    padding: 8px 10px;
    font-size: 14px;
}

.chat-send-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: #6c5ce7;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg.admin {
    align-self: flex-start;
    background: #2d3436;
    color: #dfe6e9;
    border-bottom-left-radius: 4px;
}

.chat-msg-time {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    opacity: 0.75;
}

.chat-msg.system {
    align-self: center;
    background: transparent;
    color: #95a5a6;
    font-size: 12px;
    text-align: center;
}

.chat-hours-bar {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 11px;
    line-height: 1.4;
    color: #b2bec3;
    background: #1a2030;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-hours-bar.off-hours {
    color: #ffeaa7;
    background: #2d1f3d;
}

.chat-faq-bar {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-faq-btn {
    border: 1px solid #6c5ce7;
    background: transparent;
    color: #dfe6e9;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
}

.chat-faq-btn:hover {
    background: rgba(108, 92, 231, 0.25);
}

.chat-panel-footer {
    align-items: flex-end;
}

.chat-attach-btn {
    flex-shrink: 0;
    width: 40px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b2bec3;
    cursor: pointer;
    border-radius: 8px;
}

.chat-attach-btn:hover {
    color: #00cec9;
}

.chat-att img {
    max-width: 100%;
    max-height: 160px;
    border-radius: 8px;
    margin-top: 6px;
}

.chat-att a {
    color: #74b9ff;
    font-size: 12px;
}

.chat-csat-panel {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #1a2030;
}

.chat-csat-panel.hidden {
    display: none !important;
}

.chat-panel-body.csat-mode {
    max-height: 40%;
}

.chat-csat-title {
    font-size: 13px;
    margin: 0 0 8px;
    color: #dfe6e9;
}

.chat-csat-stars {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.chat-csat-stars button {
    flex: 1;
    border: 1px solid #636e72;
    background: #2d3436;
    color: #fff;
    border-radius: 6px;
    padding: 6px 0;
    cursor: pointer;
}

.chat-csat-stars button.active {
    background: #fdcb6e;
    border-color: #f39c12;
    color: #2d3436;
}

.chat-csat-panel textarea {
    width: 100%;
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #1e2430;
    color: #e8eaed;
    font-size: 13px;
    padding: 6px 8px;
}

.chat-csat-submit {
    width: 100%;
    border: none;
    border-radius: 8px;
    padding: 8px;
    background: #00cec9;
    color: #1a1a1a;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 480px) {
    .chat-fab {
        right: 12px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        width: 52px;
        height: 52px;
        min-width: 52px;
        min-height: 52px;
    }
    .chat-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: calc(132px + env(safe-area-inset-bottom, 0px));
    }
}
