
/* [NEW] 히스토리 상단 토픽 필터 바 */
.topic-filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 24px 16px; /* 좌우 여백, 하단 여백 */
    margin-bottom: 10px;
    white-space: nowrap;
    -ms-overflow-style: none; /* IE, Edge 스크롤바 숨김 */
    scrollbar-width: none; /* Firefox 스크롤바 숨김 */
}
.topic-filter-bar::-webkit-scrollbar { display: none; } /* Chrome 스크롤바 숨김 */

.topic-chip {
    padding: 8px 16px;
    border-radius: 10px;
    background: #F2F2F7;
    color: #8E8E93;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.topic-chip.active {
    background: #1D1D1F;
    color: white;
    transform: scale(1.05);
}

/* History 헤더의 타이틀과 아이콘 정렬 */
#page-history .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 24px; /* 아이콘 위치 여백 */
}

/* 히스토리 아이템 스타일 통합 관리 */
.history-item {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s var(--apple-ease);
    cursor: pointer;
    border: 1px solid transparent;
}

.history-item.expanded {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-color: rgba(0,0,0,0.05);
}

.history-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    transition: background 0.3s, color 0.3s;
}

.history-item.expanded .history-header {
    background: #1D1D1F;
    color: white;
}

.history-preview {
    flex: 1;
    margin-right: 12px;
    overflow: hidden;
}

.history-date {
    font-size: 12px;
    color: var(--apple-sub);
    margin-bottom: 6px;
}

.history-toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s;
    opacity: 0.5;
}

.history-item.expanded .history-toggle-icon {
    transform: rotate(180deg);
    filter: invert(1);
    opacity: 1;
}

.history-details {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    background: #FAFAFC;
    transition: all 0.4s var(--apple-ease);
}

.history-item.expanded .history-details {
    max-height: 2000px; /* 충분히 크게 */
    opacity: 1;
    padding: 0 20px 24px;
    border-top: 1px solid #F2F2F7;
}

.history-text-line {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--apple-text);
    /* 말줄임표 핵심 설정 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    margin-top: 4px;
}

.history-item.expanded .history-text-line {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    color: white;
}

.history-author-line {
    font-size: 13px;
    color: var(--apple-sub);
    margin-top: 6px;
    display: none;
}

.history-item.expanded .history-author-line {
    display: block;
    color: rgba(255, 255, 255, 0.6);
}

/* 상세 내용 내부 스타일 */
.detail-quote-box {
    margin-top: 20px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border-left: 4px solid #333;
    margin-bottom: 20px;
}

.detail-quote { font-size: 14px; font-weight: 500; line-height: 1.4; color: #333; }
.detail-author { margin-top: 8px; font-size: 12px; color: #86868B; }

/* 생각 타임라인 (댓글 형태) */
.thought-thread {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.thought-bubble {
    position: relative;
    padding-left: 12px;
    border-left: 2px solid #E5E5E7;
}

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

.thought-time {
    font-size: 11px;
    color: var(--apple-sub);
}

.thought-actions button {
    background: none;
    border: none;
    color: var(--apple-sub);
    font-size: 15px;
    cursor: pointer;
    padding: 4px 8px; /* 터치 영역 확보 */
    opacity: 0.6;
    transition: 0.2s;
}

.thought-actions button:hover {
    opacity: 1;
    color: var(--apple-text);
}

.thought-meta {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.thought-content {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    position: relative;
    min-height: 24px;
}

/* 이미지 캡처 시 전용 스타일 (포스터 모드) */
.history-item.capturing {
    box-shadow: none !important;
    border: none !important;
    width: 375px; /* 인스타 스토리 표준 가로폭 */
    margin: 0 auto;
}
.history-item.capturing .history-header {
    padding: 40px 30px 20px !important;
}
.history-item.capturing .history-details {
    padding: 0 30px 40px !important;
}

/* 캘린더 및 탐색 스타일 */
#page-browse-records .page-header button {
    color: var(--apple-text);
}

.browse-group { margin-bottom: 8px; border-radius: 12px; background: white; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.browse-item { 
    padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; 
    cursor: pointer; border-bottom: 1px solid #F2F2F7;
}
.browse-item:last-child { border-bottom: none; }
.browse-label { font-size: 16px; font-weight: 500; }
.browse-count { 
    background: #1D1D1F; color: white; font-size: 11px;
    padding: 2px 8px; border-radius: 10px; opacity: 0.8;
}
.browse-sub-list { display: none; background: #FAFAFC; padding-left: 15px; }
.browse-sub-list.active { display: block; }

.day-item { padding: 14px 20px; font-size: 14px; color: #333; border-bottom: 1px solid #EEE; cursor: pointer; }
.day-item:active { background: #E5E5E7; }

.daily-detail-view { padding: 20px; background: white; border-radius: 20px; margin-top: 10px; }

.calendar-wrapper {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.calendar-nav-btn {
    background: none; border: none; font-size: 18px; cursor: pointer; color: var(--apple-text);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
}

.calendar-weekday {
    font-size: 11px;
    font-weight: 600;
    color: var(--apple-sub);
    padding-bottom: 10px;
}

.calendar-day {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

.day-num {
    position: relative;
    z-index: 2;
    font-size: 14px;
    color: var(--apple-text);
}

.calendar-day.has-record .day-num {
    color: #FFFFFF !important;
    font-weight: 700;
}

.record-mark {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 90%;
    -webkit-mask: url('../assets/icon/chat-fill.svg') no-repeat center;
    mask: url('../assets/icon/chat-fill.svg') no-repeat center;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    background-color: #1D1D1F;
    z-index: 1; 
}

.calendar-day.today {
    border: 1px solid var(--apple-text);
}
.calendar-day.today.has-record {
    border-color: rgba(255, 255, 255, 0.5);
}
