/**
 * CASHiQ 챗봇 스타일
 * 모든 페이지에서 사용 가능한 공통 챗봇 디자인
 */

/* 챗봇 안내 말풍선 */
.chatbot-tooltip {
    position: fixed;
    bottom: 160px;
    right: 35px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9997;
    max-width: 160px;
    animation: tooltipBounce 2s ease-in-out infinite;
}

.chatbot-tooltip-text {
    font-size: 11px;
    line-height: 1.4;
    color: #1e293b;
    font-weight: 600;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chatbot-tooltip-line {
    display: block;
}

/* 말풍선 꼬리 */
.chatbot-tooltip::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 40px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

.chatbot-tooltip::before {
    content: '';
    position: absolute;
    bottom: -13px;
    right: 38px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #667eea;
}

@keyframes tooltipBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* AI 뱃지 */
.chatbot-ai-badge {
    position: fixed;
    bottom: 165px;
    right: 25px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    z-index: 9999;
    animation: aiPulse 2s infinite;
    border: 3px solid white;
}

@keyframes aiPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(239, 68, 68, 0.6);
    }
}

/* 챗봇 버튼 */
.chatbot-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 56px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9998;
    animation: pulse 2s infinite;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.chatbot-button.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.7), 0 0 0 10px rgba(102, 126, 234, 0.1);
    }
}

/* 배지 */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    border: 3px solid white;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* 챗봇 윈도우 */
.chatbot-window {
    position: fixed;
    bottom: 160px;
    right: 30px;
    width: 400px;
    height: 700px;
    max-height: calc(100vh - 180px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 9999;
    overflow: hidden;
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* 챗봇 헤더 */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.chatbot-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* 메시지 영역 */
.chatbot-messages {
    overflow-y: auto;
    padding: 0;
    background: #f8fafc;
    display: none;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
}

.chatbot-messages.has-messages {
    display: flex;
    flex: 1 1 auto;
    max-height: none;
    padding: 16px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 메시지 */
.chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.bot {
    align-self: flex-start;
}

.chatbot-message.user {
    align-self: flex-end;
}

.chatbot-message-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message.bot .chatbot-message-content {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chatbot-message.user .chatbot-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chatbot-message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 8px;
}

.chatbot-message.user .chatbot-message-time {
    text-align: right;
}

/* 빠른 질문 */
.chatbot-quick-questions {
    padding: 10px 14px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.chatbot-quick-questions::-webkit-scrollbar {
    width: 6px;
}

.chatbot-quick-questions::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chatbot-quick-questions::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chatbot-quick-questions::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chatbot-quick-title {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.chatbot-questions-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chatbot-quick-btn {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.3;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.chatbot-quick-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.chatbot-quick-btn:hover::before {
    transform: scaleY(1);
}

.chatbot-quick-btn:hover {
    background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
    border-color: #c7d2fe;
    transform: translateX(6px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.chatbot-quick-btn:active {
    transform: translateX(4px) scale(0.98);
}

.question-number {
    color: #667eea;
    font-weight: 700;
    font-size: 14px;
    min-width: 24px;
}

.question-text {
    flex: 1;
    line-height: 1.5;
    word-break: keep-all;
}

/* 입력 영역 */
.chatbot-input-area {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.chatbot-input-area[style*="display: none"] {
    padding: 0;
    height: 0;
    overflow: hidden;
}

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.chatbot-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .chatbot-tooltip {
        bottom: 110px;
        right: 15px;
        max-width: 140px;
        padding: 8px 12px;
    }
    
    .chatbot-tooltip-text {
        font-size: 10px;
        line-height: 1.3;
        gap: 1px;
    }
    
    .chatbot-tooltip::after {
        right: 30px;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-top: 8px solid white;
        bottom: -8px;
    }
    
    .chatbot-tooltip::before {
        right: 28px;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid #667eea;
        bottom: -11px;
    }
    
    .chatbot-ai-badge {
        width: 32px;
        height: 32px;
        font-size: 12px;
        bottom: 120px;
        right: 15px;
        border: 2px solid white;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 90px);
        right: 10px;
        bottom: 80px;
        border-radius: 16px;
        max-height: 750px;
    }

    .chatbot-button {
        width: 80px;
        height: 80px;
        font-size: 40px;
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-badge {
        width: 28px;
        height: 28px;
        font-size: 14px;
        border: 2px solid white;
    }

    .chatbot-header {
        padding: 14px 16px;
    }
    
    .chatbot-header-title {
        font-size: 14px;
    }
    
    .chatbot-close-btn {
        width: 28px;
        height: 28px;
    }

    .chatbot-messages {
        padding: 12px;
    }
    
    .chatbot-messages.has-messages {
        flex: 1 1 auto;
        max-height: none;
        min-height: 200px;
    }

    .chatbot-quick-questions {
        padding: 8px 12px;
        flex: 1;
        min-height: 0;
    }
    
    .chatbot-quick-title {
        font-size: 11px;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }
    
    .chatbot-quick-btn {
        padding: 7px 9px;
        font-size: 11.5px;
        border-radius: 6px;
        line-height: 1.3;
    }
    
    .chatbot-questions-list {
        gap: 3px;
    }
    
    .chatbot-quick-btn:hover {
        transform: translateX(4px);
    }
    
    .question-number {
        font-size: 12px;
        min-width: 20px;
    }
    
    .question-text {
        font-size: 11.5px;
        line-height: 1.3;
    }

    .chatbot-input-area {
        padding: 10px 12px;
        gap: 6px;
    }
    
    .chatbot-input {
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 20px;
    }
    
    .chatbot-send-btn {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
    
    .chatbot-message-content {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .chatbot-message-time {
        font-size: 10px;
    }
    
    .chatbot-back-to-list-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* 작은 모바일 (iPhone SE 등) */
@media (max-width: 375px) {
    .chatbot-tooltip {
        bottom: 95px;
        right: 12px;
        max-width: 110px;
        padding: 7px 10px;
    }
    
    .chatbot-tooltip-text {
        font-size: 9px;
        gap: 1px;
    }
    
    .chatbot-ai-badge {
        width: 28px;
        height: 28px;
        font-size: 11px;
        bottom: 80px;
        right: 8px;
    }
    
    .chatbot-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        right: 8px;
        bottom: 70px;
    }
    
    .chatbot-button {
        width: 70px;
        height: 70px;
        font-size: 36px;
        bottom: 12px;
        right: 12px;
    }
    
    .chatbot-quick-questions {
        padding: 6px 8px;
        flex: 1;
        min-height: 0;
    }
    
    .chatbot-quick-title {
        font-size: 10px;
        margin-bottom: 4px;
        padding-bottom: 3px;
    }
    
    .chatbot-quick-btn {
        padding: 6px 8px;
        font-size: 10.5px;
        line-height: 1.2;
    }
    
    .chatbot-questions-list {
        gap: 2px;
    }
    
    .question-number {
        font-size: 11px;
        min-width: 18px;
    }
    
    .question-text {
        font-size: 10.5px;
        line-height: 1.2;
    }
}

/* 태블릿 (768px ~ 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .chatbot-window {
        width: 420px;
        height: 650px;
    }
    
    .chatbot-button {
        width: 110px;
        height: 110px;
        font-size: 52px;
    }
}

/* 다크모드 지원 (선택사항) */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #1e293b;
    }

    .chatbot-messages {
        background: #0f172a;
    }

    .chatbot-message.bot .chatbot-message-content {
        background: #334155;
        color: #f1f5f9;
        border-color: #475569;
    }

    .chatbot-quick-questions {
        background: #1e293b;
        border-top-color: #334155;
    }

    .chatbot-quick-btn {
        background: #334155;
        border-color: #475569;
        color: #e2e8f0;
    }

    .chatbot-quick-btn:hover {
        background: #475569;
        border-color: #64748b;
    }

    .chatbot-input-area {
        background: #1e293b;
        border-top-color: #334155;
    }

    .chatbot-input {
        background: #334155;
        border-color: #475569;
        color: #f1f5f9;
    }

    .chatbot-input::placeholder {
        color: #94a3b8;
    }
}

/* 애니메이션 효과 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-window.active .chatbot-messages,
.chatbot-window.active .chatbot-quick-questions,
.chatbot-window.active .chatbot-input-area {
    animation: fadeInUp 0.4s ease forwards;
}

/* 목록으로 돌아가기 버튼 */
.chatbot-back-to-list-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.chatbot-back-to-list-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chatbot-back-to-list-btn:active {
    transform: translateY(0);
}

/* 로딩 인디케이터 (선택사항) */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* 1:1 문의 버튼 스타일 제거됨 - 배너의 문의하기 버튼 사용 */

/* 1:1 문의 버튼 위 텍스트 */
.inquiry-tooltip {
    position: fixed;
    bottom: 240px;
    right: -10px;
    background: white;
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9997;
    max-width: 140px;
    pointer-events: none;
}

.inquiry-tooltip-text {
    font-size: 10px;
    line-height: 1.4;
    color: #1e293b;
    font-weight: 600;
    text-align: center;
    white-space: pre-line;
}

.inquiry-tooltip-line {
    display: block;
    margin: 2px 0;
}

.inquiry-tooltip-line:nth-child(1) {
    color: #059669;
}

.inquiry-tooltip-line:nth-child(2) {
    color: #047857;
}

.inquiry-tooltip-line:nth-child(3) {
    color: #10b981;
    font-weight: 700;
}

/* 툴팁 꼬리 */
.inquiry-tooltip::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 50px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

.inquiry-tooltip::before {
    content: '';
    position: absolute;
    bottom: -13px;
    right: 48px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #10b981;
}

/* 문의 모달 */
.inquiry-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.inquiry-modal.active {
    display: flex;
}

.inquiry-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.inquiry-modal-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inquiry-modal-header h3 {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
}

.inquiry-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.inquiry-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.inquiry-modal-body {
    padding: 24px;
}

.inquiry-form-group {
    margin-bottom: 20px;
}

.inquiry-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}

.inquiry-form-group input,
.inquiry-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.inquiry-form-group input:focus,
.inquiry-form-group textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.inquiry-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.inquiry-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.inquiry-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.inquiry-submit-btn:active {
    transform: translateY(0);
}

/* 모바일용 inquiry-button 스타일 제거됨 - 배너의 문의하기 버튼만 사용 */
