/**
 * HLI Chatbot - Rich Message Styles
 * 리치 메시지 렌더링 전용 CSS (#285)
 * 네임스페이스: hli-rich-*
 */

/* ── 공통 컨테이너 ── */
.hli-chat-rich-content {
    max-width: 90%;
    width: 100%;
}

/* ── 카드 기본 스타일 ── */
.hli-rich-card {
    background: #fff;
    border: 1px solid var(--custom-color-border, #C9C9C9);
    border-radius: .5rem;
    overflow: hidden;
}

.hli-rich-card-header {
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
}

/* ── 상태 뱃지 ── */
.hli-status-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    line-height: 1.4;
}

.hli-status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.hli-status-badge.shipping {
    background: #dbeafe;
    color: #1e40af;
}

.hli-status-badge.delivered {
    background: #d1fae5;
    color: #065f46;
}

.hli-status-badge.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.hli-status-badge.returning {
    background: #fce7f3;
    color: #9d174d;
}

/* ── 액션 버튼 ── */
.hli-rich-action-btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.hli-rich-action-btn.primary {
    background: var(--custom-secondary-gray02);
    color: #fff;
}

.hli-rich-action-btn.primary:hover {
    background: #5568d3;
}

.hli-rich-action-btn.outline {
    border-radius: 0.375rem;
    border: 1px solid var(--custom-color-border, #C9C9C9);
    background: var(--custom-secondary-white, #FFF);
    color: var(--custom-primary-blue, #000);
    height: 2.5rem;
    padding: 0.625rem 1.5rem;
}

.hli-rich-action-btn.outline:hover {
    border-color: var(--custom-primary-blue, #000);
}

/* ── 링크 버튼 카드 (#286) ── */
.hli-rich-link-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hli-rich-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: #1f2937;
    transition: background 0.15s ease;
    cursor: pointer;
}

.hli-rich-link-item:last-child {
    border-bottom: none;
}

.hli-rich-link-item:hover {
    background: #f9fafb;
}

.hli-rich-link-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.hli-rich-link-desc {
    font-size: 12px;
    color: #6b7280;
}

.hli-rich-link-arrow {
    font-size: 16px;
    color: #9ca3af;
    flex-shrink: 0;
    margin-left: 8px;
}

/* ── 상품 카드 (#287) ── */
.hli-rich-product-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    cursor: pointer;
}

.hli-rich-product-item:last-child {
    border-bottom: none;
}

.hli-rich-product-item:hover {
    background: #f9fafb;
    border-radius: 8px;
}

.hli-rich-product-item.out-of-stock {
    opacity: 0.6;
}

.hli-rich-product-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
    flex-shrink: 0;
    margin-right: 12px;
}

.hli-rich-product-info {
    flex: 1;
    min-width: 0;
}

.hli-rich-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hli-rich-product-price {
    font-size: .875rem;
    font-weight: 600;
    color: var(--custom-secondary-gray02, #737B7D);
    margin-bottom: 4px;
}

.hli-rich-product-rating {
    font-size: 12px;
    color: #6b7280;
}

.hli-rich-product-rating .stars {
    color: #f59e0b;
    letter-spacing: 1px;
}

.hli-rich-product-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    background: #fee2e2;
    color: #991b1b;
    margin-left: 8px;
}

/* ── 주문/배송 카드 (#288) ── */
.hli-rich-order-item {
    border-bottom: 1px solid #f3f4f6;
}

.hli-rich-order-item:last-child {
    border-bottom: none;
}

.hli-rich-order-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.hli-rich-order-summary:hover {
    background: #f9fafb;
}

.hli-rich-order-summary-left {
    flex: 1;
}
.hli-rich-order-summary-left + div {
    text-align: right;
}
.hli-rich-order-no {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.hli-rich-order-date {
    font-size: 12px;
    color: #6b7280;
}

.hli-rich-order-amount {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    text-align: right;
    margin-bottom: 2px;
}

.hli-rich-order-toggle {
    font-size: 16px;
    color: #9ca3af;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.hli-rich-order-toggle.open {
    transform: rotate(180deg);
}

.hli-rich-order-details {
    display: none;
    padding: 0.5rem 1rem 0.625rem 1rem;
    background: #f9f9f9;
}

.hli-rich-order-details.open {
    display: block;
}

.hli-rich-order-products {
    font-size: 13px;
    color: #4b5563;
    padding: 8px 0;
    line-height: 1.5;
}

/* ── 주문 상세 - 개별 상품 목록 ── */
.hli-rich-order-product-list {
    padding: 4px 0 8px 0;
}

.hli-rich-order-product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.hli-rich-order-product-item:last-child {
    border-bottom: none;
}

.hli-rich-order-product-name {
    font-size: 13px;
    color: var(--custom-primary-blue, #1f2937);
    text-decoration: none;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.hli-rich-order-product-name:hover {
    text-decoration: underline;
}

.hli-rich-order-product-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    font-size: 12px;
    color: #6b7280;
}

.hli-rich-order-product-qty {
    white-space: nowrap;
}

.hli-rich-order-product-price {
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
}

.hli-rich-order-actions {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    flex-wrap: wrap;
}

.hli-rich-order-actions .hli-rich-action-btn {
    flex: 1;
    min-width: 0;
    font-size: .875rem;
    padding: 0.625rem 1.5rem;
}

/* ── Quick Reply (#289) ── */
.hli-rich-quick-reply {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    max-width: 90%;
}

.hli-quick-reply-btn {
    display: inline-block;
    padding: 8px 14px;
    font-size: 13px;
    color: #667eea;
    background: #fff;
    border: 1.5px solid #667eea;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.hli-quick-reply-btn:hover {
    background: #667eea;
    color: #fff;
}

.hli-quick-reply-btn.used {
    opacity: 0.5;
    pointer-events: none;
    border-color: #d1d5db;
    color: #9ca3af;
}

/* ── 텍스트 + 링크 버튼 (text_with_links) ── */
.hli-rich-text-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    max-width: 90%;
}

.hli-rich-text-link-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fff;
    border: 1.5px solid var(--custom-color-border, #C9C9C9);
    border-radius: 12px;
    text-decoration: none;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hli-rich-text-link-btn:hover {
    border-color: var(--custom-primary-blue, #667eea);
    background: #f9fafb;
}

.hli-rich-text-link-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.hli-rich-text-link-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.hli-rich-text-link-desc {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.hli-rich-text-link-icon {
    font-size: 16px;
    color: #9ca3af;
    flex-shrink: 0;
    margin-left: 8px;
}

.hli-rich-text-link-icon.phone {
    color: #667eea;
}

/* ── 할인가 표시 (공통) ── */
.hli-rich-price-sale {
    font-weight: 700;
}

.hli-rich-price-original {
    text-decoration: line-through;
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.8em;
    margin-left: 4px;
}

.hli-rich-price-discount {
    color: #dc2626;
    font-weight: 700;
    font-size: 0.85em;
    margin-left: 4px;
}

/* ── 상품 상세 카드 (product_detail) ── */
.hli-rich-pd-main {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.hli-rich-pd-main:hover {
    background: #f9fafb;
}

.hli-rich-pd-image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
    flex-shrink: 0;
    margin-right: 12px;
}

.hli-rich-pd-info {
    flex: 1;
    min-width: 0;
}

.hli-rich-pd-brand {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 2px;
}

.hli-rich-pd-name {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.hli-rich-pd-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--custom-secondary-gray02, #737B7D);
    margin-bottom: 4px;
}

.hli-rich-pd-desc {
    padding: 8px 12px;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.5;
    border-top: 1px solid #f3f4f6;
}

.hli-rich-pd-specs {
    padding: 8px 12px;
    border-top: 1px solid #f3f4f6;
}

.hli-rich-pd-specs-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.hli-rich-pd-spec-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 12px;
}

.hli-rich-pd-spec-name {
    color: #6b7280;
    flex-shrink: 0;
    margin-right: 8px;
}

.hli-rich-pd-spec-value {
    color: #1f2937;
    text-align: right;
}

.hli-rich-pd-actions {
    padding: 8px 12px 12px;
    border-top: 1px solid #f3f4f6;
}

.hli-rich-pd-actions .hli-rich-action-btn {
    display: block;
    text-align: center;
    width: 100%;
}

/* ── 모바일 대응 ── */
@media (max-width: 480px) {
    .hli-chat-rich-content {
        max-width: 95%;
    }

    .hli-rich-product-image {
        width: 50px;
        height: 50px;
    }

    .hli-rich-order-actions {
        flex-direction: column;
    }

    .hli-rich-order-actions .hli-rich-action-btn {
        flex: none;
        width: 100%;
    }

    .hli-rich-order-product-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .hli-rich-order-product-name {
        white-space: normal;
        margin-right: 0;
    }

    .hli-rich-order-product-meta {
        width: 100%;
        justify-content: flex-end;
    }

    .hli-rich-pd-image {
        width: 80px;
        height: 80px;
    }
}
