/* 1_5_ai_estimate.css */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* ============================================
   AI + ESTIMATE SECTION
   ============================================ */

/* --- Section Header --- */
.ai-est-header {
    margin-bottom: 36px;
}

.ai-est-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #FF1F23;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.ai-est-badge::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 2px;
    background-color: #FF1F23;
    flex-shrink: 0;
}

.ai-est-title {
    font-size: 36px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.ai-est-title span {
    color: #FF1F23;
}

.ai-est-subtitle {
    font-size: 15px;
    color: #6B6E7E;
    margin: 0;
    font-weight: 400;
}

.ai-est-sec {
    background-color: #090A10;
    font-family: 'Pretendard', sans-serif;
    padding: 48px 0;
    color: #fff;
}

.ai-est-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

/* ============================================
   공통 패널
   ============================================ */
.ai-panel,
.est-panel {
    background: #111218;
    border: 1px solid #1E2028;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 패널 헤더 */
.panel-header {
    padding: 14px 20px;
    border-bottom: 1px solid #1E2028;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.panel-header-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FF1F23;
    flex-shrink: 0;
}

.panel-header-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex: 1;
}

.panel-header-badge {
    font-size: 11px;
    font-weight: 700;
    color: #FF1F23;
    background: rgba(255, 31, 35, 0.1);
    border: 1px solid rgba(255, 31, 35, 0.25);
    border-radius: 20px;
    padding: 3px 10px;
    letter-spacing: 0.04em;
}

/* 로그인 상태 뱃지 */
.est-logged-in-badge {
    color: #34d399 !important;
    background: rgba(52, 211, 153, 0.1) !important;
    border-color: rgba(52, 211, 153, 0.25) !important;
    display: flex;
    align-items: center;
    gap: 5px;
}

.est-login-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    flex-shrink: 0;
    animation: login-pulse 2s infinite;
}

@keyframes login-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.est-logged-out-badge {
    color: #6B6E7E !important;
    background: rgba(107, 110, 126, 0.08) !important;
    border-color: rgba(107, 110, 126, 0.2) !important;
}

/* 비로그인 안내 영역 */
.est-login-required {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 48px 24px;
    gap: 14px;
    text-align: center;
}

.est-login-icon {
    font-size: 36px;
    opacity: 0.5;
}

.est-login-msg {
    font-size: 14px;
    color: #6B6E7E;
    line-height: 1.6;
}

.est-login-btn {
    display: inline-block;
    padding: 10px 28px;
    background: #FF1F23;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s;
    margin-top: 4px;
}

.est-login-btn:hover {
    background: #e01518;
}

/* ============================================
   AI 챗봇 패널 (왼쪽)
   ============================================ */
.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    max-height: 280px;
    scrollbar-width: thin;
    scrollbar-color: #2E3040 transparent;
}

.ai-chat-body::-webkit-scrollbar {
    width: 4px;
}
.ai-chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.ai-chat-body::-webkit-scrollbar-thumb {
    background: #2E3040;
    border-radius: 4px;
}

/* 메시지 */
.chat-msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.chat-msg.user {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 31, 35, 0.15);
    border: 1px solid rgba(255, 31, 35, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.chat-msg.user .chat-avatar {
    background: #1E2028;
    border-color: #2E3040;
}

.chat-bubble {
    max-width: 80%;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.65;
}

.chat-msg.bot .chat-bubble {
    background: #1A1C27;
    color: #CDD0E0;
    border-radius: 4px 12px 12px 12px;
}

.chat-msg.user .chat-bubble {
    background: #FF1F23;
    color: #fff;
    border-radius: 12px 4px 12px 12px;
    font-weight: 500;
}

/* 추천 카드 */
.chat-rec-card {
    background: #0D0E14;
    border: 1px solid #2E3040;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 8px;
    font-size: 13px;
}

.chat-rec-card .rec-name {
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.chat-rec-card .rec-price {
    color: #FF1F23;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

.chat-rec-card .rec-spec {
    color: #6B6E7E;
    font-size: 12px;
    line-height: 1.6;
}

/* 빠른 질문 버튼 */
.chat-quick-area {
    padding: 8px 16px;
    border-top: 1px solid #1A1C27;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.chat-quick-btn {
    background: #1A1C27;
    border: 1px solid #2E3040;
    border-radius: 20px;
    color: #A1A3B1;
    font-size: 12.5px;
    font-weight: 500;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Pretendard', sans-serif;
}

.chat-quick-btn:hover {
    background: rgba(255, 31, 35, 0.1);
    border-color: rgba(255, 31, 35, 0.4);
    color: #FF1F23;
}

/* 채팅 입력 */
.chat-input-area {
    padding: 10px 16px;
    border-top: 1px solid #1E2028;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background: #0D0E14;
    border: 1px solid #2E3040;
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-size: 13.5px;
    font-family: 'Pretendard', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input::placeholder {
    color: #3F4452;
}

.chat-input:focus {
    border-color: rgba(255, 31, 35, 0.5);
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    background: #FF1F23;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}

.chat-send-btn:hover {
    background: #e01518;
    transform: scale(1.05);
}

.chat-send-btn svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* 타이핑 인디케이터 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 4px;
    align-items: center;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #3F4452;
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite ease-in-out;
}

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

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); background: #3F4452; }
    40% { transform: translateY(-6px); background: #FF1F23; }
}

/* ============================================
   견적문의 패널 (오른쪽)
   ============================================ */
.est-form-body {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: #2E3040 transparent;
}

.est-form-body::-webkit-scrollbar { width: 4px; }
.est-form-body::-webkit-scrollbar-track { background: transparent; }
.est-form-body::-webkit-scrollbar-thumb { background: #2E3040; border-radius: 4px; }

/* 연락처 + 이메일 가로 나열 */
.est-inline-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.est-inline-row .est-group {
    margin-bottom: 0;
}

/* 추가내용 영역 (flex-grow로 남은 공간 차지) */
.est-group-flex {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin-bottom: 8px;
}

.est-textarea-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.est-textarea-grow {
    flex: 1;
    resize: none;
    min-height: 80px;
}

/* 폼 그룹 */
.est-group {
    margin-bottom: 8px;
}

.est-label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: #6B6E7E;
    margin-bottom: 4px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.est-input,
.est-select,
.est-textarea {
    width: 100%;
    background: #0D0E14;
    border: 1px solid #2E3040;
    border-radius: 8px;
    padding: 7px 9px;
    color: #fff;
    font-size: 13px;
    font-family: 'Pretendard', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
}

.est-input::placeholder,
.est-textarea::placeholder {
    color: #3F4452;
}

.est-input:focus,
.est-select:focus,
.est-textarea:focus {
    border-color: rgba(255, 31, 35, 0.5);
}

.est-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6E7E' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.est-select option {
    background: #111218;
}

.est-textarea {
    height: 60px;
    resize: none;
}

/* ── 서식 에디터 툴바 ── */
.est-editor-toolbar {
    display: flex;
    gap: 2px;
    align-items: center;
    padding: 5px 8px;
    background: #161820;
    border: 1px solid #2E3040;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
}

.est-tb-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #6B6E7E;
    font-size: 12px;
    font-family: 'Pretendard', sans-serif;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.5;
    min-width: 26px;
    text-align: center;
}

.est-tb-btn:hover,
.est-tb-btn:active {
    background: #1A1C27;
    border-color: #2E3040;
    color: #fff;
}

.est-tb-sep {
    width: 1px;
    height: 14px;
    background: #2E3040;
    margin: 0 4px;
    flex-shrink: 0;
}

/* contenteditable 에디터 */
.est-editor {
    flex: 1;
    background: #0D0E14;
    border: 1px solid #2E3040;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 9px 11px;
    color: #fff;
    font-size: 13px;
    font-family: 'Pretendard', sans-serif;
    outline: none;
    min-height: 140px;
    overflow-y: auto;
    line-height: 1.7;
    word-break: break-word;
    cursor: text;
    transition: border-color 0.2s;
    scrollbar-width: thin;
    scrollbar-color: #2E3040 transparent;
}

.est-editor:focus {
    border-color: rgba(255, 31, 35, 0.5);
}

.est-editor:empty::before {
    content: attr(data-placeholder);
    color: #3F4452;
    pointer-events: none;
    display: block;
}

/* ── 옵션 버튼 그룹 ── */
.est-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.est-opt-btn {
    background: #0D0E14;
    border: 1px solid #2E3040;
    border-radius: 6px;
    color: #6B6E7E;
    font-size: 12.5px;
    font-weight: 500;
    font-family: 'Pretendard', sans-serif;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.est-opt-btn:hover {
    border-color: rgba(255, 31, 35, 0.4);
    color: #CDD0E0;
}

.est-opt-btn.active {
    background: rgba(255, 31, 35, 0.12);
    border-color: #FF1F23;
    color: #FF1F23;
    font-weight: 700;
}

/* 전화번호 */
.phone-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.phone-row .est-input {
    text-align: center;
}

.phone-sep {
    color: #3F4452;
    font-size: 16px;
    flex-shrink: 0;
}

/* 쿠키/토큰 섹션 */
.est-token-section {
    background: #0D0E14;
    border: 1px solid #2E3040;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.est-token-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}

.est-token-row .est-input {
    flex: 1;
    margin: 0;
}

.est-token-note {
    font-size: 11.5px;
    color: #3F4452;
    margin-top: 6px;
    line-height: 1.5;
}

/* 비밀글 체크 */
.est-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.est-check-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #FF1F23;
    cursor: pointer;
}

.est-check-row span {
    font-size: 13px;
    color: #6B6E7E;
}

/* 버튼들 */
.est-btn-sm {
    padding: 8px 14px;
    background: rgba(255, 31, 35, 0.12);
    border: 1px solid rgba(255, 31, 35, 0.3);
    border-radius: 8px;
    color: #FF1F23;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Pretendard', sans-serif;
    transition: all 0.2s;
    flex-shrink: 0;
}

.est-btn-sm:hover {
    background: rgba(255, 31, 35, 0.22);
}

.est-btn-sm:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 제출 버튼 */
.est-submit-btn {
    width: 100%;
    padding: 13px;
    background: #FF1F23;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    font-family: 'Pretendard', sans-serif;
    letter-spacing: 0.02em;
    transition: background 0.2s, transform 0.15s;
    margin-top: 4px;
}

.est-submit-btn:hover {
    background: #e01518;
    transform: translateY(-1px);
}

.est-submit-btn:disabled {
    background: #2E3040;
    color: #6B6E7E;
    cursor: not-allowed;
    transform: none;
}

/* 결과 메시지 */
.est-result {
    display: none;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-all;
}

.est-result.ok {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
}

.est-result.err {
    display: block;
    background: rgba(255, 31, 35, 0.08);
    border: 1px solid rgba(255, 31, 35, 0.25);
    color: #ff6b6b;
}

.est-result.info {
    display: block;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .ai-est-grid {
        grid-template-columns: 1fr;
    }

    .ai-chat-body {
        max-height: 360px;
    }
}

@media (max-width: 768px) {
    .ai-est-sec {
        padding: 40px 0;
    }

    .est-select-grid {
        grid-template-columns: 1fr 1fr;
    }

    .est-inline-row {
        flex-direction: column;
        gap: 8px;
    }
}
