/* ==========================================================================
   WeTalk AI 통합 스타일 시트 (v1.6 - Final Optimized)
   ========================================================================== */

/* ----------------------------------------------------------------
   1. Typography & Global Reset
---------------------------------------------------------------- */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
    /* Brand Colors */
    --primary-dark: #0a192f;
    --primary-light: #112240;
    --primary-blue: #0d6efd;
    --primary-blue-hover: #0b5ed7;
    --accent-blue: #3B82F6;
    /* Backgrounds & Text */
    --bg-color: #f8f9fa;
    --text-main: #1f2937;
    --text-sub: #6b7280;
    --text-placeholder: #adb5bd;
    /* Shadow System (Soft & Deep) */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-floating: 0 10px 40px -10px rgba(0,0,0,0.15);
    --shadow-nav: 0 -5px 20px rgba(0,0,0,0.05);
}

body {
    font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    letter-spacing: -0.02em;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 90px; /* 하단바 가림 방지 */
}

a {
    text-decoration: none;
    color: inherit;
}

/* 유틸리티: 드래그 방지 (앱 느낌) */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 유틸리티: 한글 줄바꿈 최적화 */
.text-keep-all {
    word-break: keep-all;
    word-wrap: break-word;
}

/* ----------------------------------------------------------------
   2. Components: Cards & Chips (Dashboard v1)
---------------------------------------------------------------- */
/* 카드 공통 */
.card {
    border: none !important;
    border-radius: 20px !important;
    box-shadow: var(--shadow-md) !important;
    background: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

    .card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg) !important;
    }

/* 10 Core 칩 (Chips) */
.core-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-grow: 1; /* 가득 채우기 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

    .core-chip:active {
        transform: scale(0.96);
        background-color: #f1f3f5;
    }

    /* 완료된 칩 */
    .core-chip.active {
        background-color: #e7f5ff;
        border-color: var(--primary-blue);
        color: var(--primary-blue);
        font-weight: 700;
        box-shadow: 0 4px 10px rgba(13, 110, 253, 0.15);
    }

        .core-chip.active::after {
            content: '✔';
            margin-left: 6px;
            font-size: 0.85rem;
        }

/* Sticky Header 그림자 처리 */
.sticky-top {
    transition: box-shadow 0.3s;
}

/* ----------------------------------------------------------------
   3. Components: Modal (Glassmorphism)
---------------------------------------------------------------- */
.modal-backdrop.show {
    opacity: 0.5;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    border: none;
    border-radius: 24px;
    box-shadow: var(--shadow-floating);
    background-color: rgba(255, 255, 255, 0.98);
}

.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.03);
    padding: 1.2rem 1.5rem 0.8rem;
}

.modal-body {
    padding: 1.5rem;
}

/* 모달 등장 애니메이션 (Slide Up) */
.modal.fade .modal-dialog {
    transform: translate(0, 20px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .modal-dialog {
    transform: none;
}

/* ----------------------------------------------------------------
   4. Components: Forms & Inputs
---------------------------------------------------------------- */
.form-control {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background-color: #f8f9fa; /* 연한 회색 배경 */
}

    .form-control:focus {
        border-color: var(--accent-blue);
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
        background-color: #fff;
    }

.form-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* 버튼 (Primary) */
.btn-primary {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
    font-weight: 600;
    border-radius: 12px;
    padding: 0.7rem 1.2rem;
}

    .btn-primary:hover, .btn-primary:active {
        background-color: var(--primary-blue-hover);
        transform: translateY(-1px);
        box-shadow: 0 6px 16px rgba(13, 110, 253, 0.35);
    }

/* 감성 Mindset 태그 (라디오 버튼 -> 칩) */
.mindset-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 15px;
}

.mindset-container .btn-check {
    position: absolute;
    clip: rect(0,0,0,0);
    pointer-events: none;
}

.mindset-container .btn-outline-primary {
    border: 1px solid #e9ecef;
    background-color: #fff;
    color: var(--text-sub);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 50rem;
    transition: all 0.2s;
}

/* 선택된 태그 */
.mindset-container .btn-check:checked + .btn-outline-primary {
    background-color: var(--primary-blue);
    color: #fff;
    border-color: var(--primary-blue);
    box-shadow: 0 4px 10px rgba(13, 110, 253, 0.3);
    transform: translateY(-2px);
    font-weight: 700;
}

/* ----------------------------------------------------------------
   5. Bottom Navigation (Fixed)
---------------------------------------------------------------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: #ffffff;
    box-shadow: var(--shadow-nav);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1050;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #adb5bd; /* 비활성: 회색 */
    font-size: 10px;
    text-decoration: none;
    width: 60px;
    transition: all 0.2s ease;
}

    .nav-item i {
        font-size: 22px;
        margin-bottom: 4px;
        transition: transform 0.2s;
    }

    /* 활성 탭 */
    .nav-item.active {
        color: var(--primary-blue);
        font-weight: 700;
    }

        .nav-item.active i {
            transform: translateY(-2px);
        }

/* 중앙 퀵 버튼 (Floating Action Button) */
.nav-fab {
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.4);
    margin-bottom: 40px; /* 네비바 위로 띄움 */
    border: 5px solid var(--bg-color); /* 배경색 테두리로 공중부양 효과 */
    transition: transform 0.2s;
}

    .nav-fab i {
        font-size: 30px;
        margin: 0;
    }

    .nav-fab:active {
        transform: scale(0.92);
    }

/* ----------------------------------------------------------------
   6. Animations & Feedback
---------------------------------------------------------------- */
/* 칭찬 토스트 (Top Slide Down) */
.praise-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(33, 37, 41, 0.95);
    color: #fff;
    backdrop-filter: blur(4px);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 2050;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    animation: slideDownToast 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: normal; /* 텍스트 줄바꿈 허용 */
    max-width: 90%; /* 화면 너비의 90%를 넘지 않도록 제한 */
    word-break: keep-all; /* 단어 단위로 줄바꿈 (한글 최적화) */
    text-align: center; /* 줄바꿈 시 중앙 정렬 */
}

@keyframes slideDownToast {
    from {
        top: -60px;
        opacity: 0;
    }

    to {
        top: 30px;
        opacity: 1;
    }
}

/* 불꽃(Streak) 애니메이션 */
@keyframes fire-animation {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px orange);
    }

    50% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 8px red);
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px orange);
    }
}

.fire-icon {
    display: inline-block;
    animation: fire-animation 1.8s infinite ease-in-out;
}

/* ----------------------------------------------------------------
   7. Mobile Optimization
---------------------------------------------------------------- */
@media (max-width: 380px) {
    h5 {
        font-size: 1.1rem !important;
    }

    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    /* 작은 화면에선 하단바 텍스트 숨김 */
    .nav-item span {
        display: none;
    }

    .nav-item i {
        font-size: 24px;
        margin-bottom: 0;
    }
}

/* 퀵 모달 그리드 스타일 */
.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2열 */
    gap: 10px;
    max-height: 50vh; /* 화면 반까지만 */
    overflow-y: auto;
    padding: 5px;
}

.quick-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 15px;
    border-radius: 16px;
    background-color: #f8f9fa;
    border: 1px solid #eee;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    text-align: left;
}

    .quick-btn:hover {
        background-color: #e9ecef;
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    }

    .quick-btn i {
        font-size: 1.2rem;
        margin-right: 8px;
        width: 24px;
        text-align: center;
    }

/* 스크롤바 커스텀 */
.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #dee2e6;
    border-radius: 10px;
}

/* 모바일 최적화: 폰트 크기 및 터치 영역 */
.custom-nav-pills .nav-link {
    font-size: clamp(1rem, 4vw, 1.2rem); /* 폰트 크기 자동 조절 */
    white-space: nowrap; /* 줄바꿈 방지 */
    padding-top: 12px; /* 터치 영역 위 */
    padding-bottom: 12px; /* 터치 영역 아래 */
    font-weight: 600; /* 폰트 굵기 */
}