@charset "utf-8";

/* ==================================================
   [Round Phone Theme vFinal - Fix Request]
   ================================================== */

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* [1] 전체 래퍼 */
#chat_board_wrap {
    width: 400px;       
    height: 75vh;        /* 기존 85vh -> 75vh로 축소 (한눈에 들어오게) */
    max-height: 720px;   /* 최대 높이도 800px -> 720px로 제한 */
    min-height: 550px;
    margin: 40px auto;   /* 상단 여백 80px -> 40px로 줄임 */
    position: relative;
    animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* [2] 실제 핸드폰 프레임 (본체) */
.chat-frame-body {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 10; /* 이미지를 덮어야 함 */
    
    background-color: var(--bg-color, #f5f5f5);
    background-image: linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3)), var(--bg-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    border: 1px solid var(--point-color, #97c3d1);    
    outline: 1px solid rgba(0,0,0,0.1); 
    border-radius: 45px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

/* [3] 빼꼼(Peek) 이미지 - 1회 애니메이션 & 더 바깥쪽 & 말풍선 숨김 */

/* 쫑쫑! (JongJong) 애니메이션 */
@keyframes jongJong {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* 개별 아이템 공통 */
.peek-item {
    position: absolute;
    width: 180px; 
    height: auto;
    z-index: 5; 
    cursor: pointer;
    pointer-events: auto;
}

/* 1. 왼쪽 상단 (Left Wall) */
.peek-item.pos-tl {
    top: 60px;      
    left: -125px;   /* [수정] -100px -> -125px (더 밖으로) */
    transform: rotate(-35deg); 
}

/* 2. 오른쪽 하단 (Right Wall) */
.peek-item.pos-br {
    bottom: 60px; 
    right: -125px;  /* [수정] -100px -> -125px (더 밖으로) */
    transform: rotate(35deg);  
}

/* 이미지 컨테이너 */
.peek-img-box {
    width: 100%;
    transition: transform 0.2s;
}

.peek-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.3));
}

/* [수정] 호버 시 애니메이션 1회만 실행 (infinite 제거) */
.peek-item:hover .peek-img-box {
    animation: jongJong 0.4s ease-in-out 1;
}

/* 말풍선 공통 스타일 */
.peek-msg {
    position: absolute;
    white-space: nowrap;
    background: #fff;
    border: 1px solid #db5248;
    border-radius: 12px;
    padding: 8px 12px;
    color: #db5248;
    font-size: 13px;
    font-weight: bold;
    
    /* [수정] 평소에는 안 보이게 숨김 */
    opacity: 0; 
    visibility: hidden;
    
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
    pointer-events: none;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

/* [수정] 호버 시에만 말풍선 등장 */
.peek-item:hover .peek-msg {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* --- 말풍선 위치 (캐릭터 이동에 맞춰 미세 조정) --- */

/* [왼쪽 놈] 말풍선 */
.peek-item.pos-tl .peek-msg {
    bottom: 80%;   
    right: 40%;    /* 캐릭터 중심 기준 배치 */
    transform: scale(0.9) rotate(35deg); 
    transform-origin: bottom right;
}
/* 꼬리 */
.peek-item.pos-tl .peek-msg::after {
    content: ""; position: absolute;
    bottom: -8px; right: 20px;
    border-width: 8px 0 0 6px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}
.peek-item.pos-tl .peek-msg::before {
    content: ""; position: absolute;
    bottom: -4px; right: 22px;
    border-width: 6px 0 0 4px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    z-index: 1;
}

/* [오른쪽 놈] 말풍선 */
.peek-item.pos-br .peek-msg {
    bottom: 80%;   
    left: 40%;     
    transform: scale(0.9) rotate(-35deg); 
    transform-origin: bottom left;
}
/* 꼬리 */
.peek-item.pos-br .peek-msg::after {
    content: ""; position: absolute;
    bottom: -8px; left: 20px;
    border-width: 8px 6px 0 0;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}
.peek-item.pos-br .peek-msg::before {
    content: ""; position: absolute;
    bottom: -4px; left: 22px;
    border-width: 6px 4px 0 0;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    z-index: 1;
}

.peek-item.empty { display: none; }

/* [4] 공지사항 바 - 오버레이 및 반투명 수정 */
.notice-bar-area {
    position: absolute; /* 띄우기 */
    top: 130px;          /* 채팅 입력창 높이만큼 띄움 (입력창 크기에 따라 숫자 조절 필요) */
    left: 0;
    width: 100%;
    
    background: rgba(255, 255, 255, 0.6); /* 반투명 배경 */
    backdrop-filter: blur(5px);           /* 뒤에 비치는 내용 흐리게 */
    
    padding: 12px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    z-index: 40;        /* 채팅 내용보다 위에 오도록 설정 */
    transition: all 0.3s ease-in-out;
    min-height: 45px;
    box-sizing: border-box;
    height: auto;
    overflow: hidden; 
}

/* 펼쳐졌을 때 */
.notice-bar-area.expanded {
    padding-bottom: 35px;
    background: rgba(255, 255, 255, 0.95); /* 펼치면 좀 더 진하게 */
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.notice-content { 
    display: flex; 
    align-items: flex-start; 
    gap: 10px; 
    width: 100%; 
    cursor: pointer; 
    padding-right: 50px; 
    box-sizing: border-box;
}

.icon-mega {
    font-style: normal; font-size: 14px; filter: grayscale(100%); opacity: 0.6;
    margin-top: 3px; flex-shrink: 0;
}

/* 텍스트 영역 */
.notice-text {
    font-weight: bold; color: #555; line-height: 1.5; font-size: 12px;
    white-space: normal; word-break: break-all;
    
    /* 2줄 보이게 설정 */
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 3.2em; /* 높이를 살짝 넉넉하게 줌 */
    transition: max-height 0.3s ease-in-out;
}

/* 펼쳐졌을 때 텍스트 */
.notice-bar-area.expanded .notice-text {
    -webkit-line-clamp: unset;
    max-height: 1000px; /* 충분히 크게 잡음 */
    overflow: visible;
}

.notice-bar-area.expanded .notice-toggle-btn {
    transform: rotate(180deg);
}

.notice-toggle-btn {
    background: none; border: none; padding: 0; color: #bbb;
    font-size: 10px; margin-top: 4px; cursor: pointer;
    transition: 0.3s; flex-shrink: 0;
}

/* [5] 공지 관리 버튼 - Z-index 상향 조정 */
.notice-admin-btns {
    position: absolute;
    top: 12px;
    right: 30px; /* 펼침 화살표와 겹치지 않게 왼쪽으로 이동 */
    display: flex; gap: 4px;
    z-index: 100; /* [중요] 다른 요소보다 확실히 위에 오도록 설정 */
}
.notice-btn-mini {
    width: 22px; height: 22px;
    border: 1px solid #ddd; background: #fff; /* 배경색 명시 */
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    color: #888; cursor: pointer; font-size: 11px; text-decoration: none;
    transition: 0.2s;
}
.notice-btn-mini:hover { background: #ffeded; color: #ff5555; border-color: #ffcccc; }

/* 나머지 스타일 (기존 유지) */
.top-function-icons { position: absolute; top: 15px; right: 15px; z-index: 50; display: flex; gap: 8px; }
.top-btn { background: rgba(255,255,255,0.6); border: none; padding: 0; cursor: pointer; color: #777; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-decoration: none;} /* a태그 호환을 위해 text-decoration 추가 */
.top-btn:hover { color: #333; background: #fff; transform: rotate(15deg); }
.top-btn svg { width: 18px; height: 18px; fill: currentColor; }

.chat-write-section { background: rgba(255,255,255,0.95); padding: 15px; border-bottom: 1px solid #ececec; z-index: 30; flex-shrink: 0; backdrop-filter: blur(5px); border-radius: 38px 38px 0 0; }
.chat-header-row { 
    display: flex; 
    align-items: center; 
    gap: 8px; /* 간격 조정 */
    margin-bottom: 10px; 
    flex-wrap: nowrap; /* 줄바꿈 금지 */
    white-space: nowrap; 
}
/* 체크박스 라벨 정렬 보정 */
.chat-header-row label {
    display: flex;
    align-items: center;
    margin: 0;
}
.input-mini { width: 70px; border: 1px solid #ddd; background: #fff; padding: 6px 10px; font-size: 12px; border-radius: 8px; outline: none; transition: 0.2s; }
.input-mini:focus { border-color: var(--point-color, #97c3d1); }
.btn-icon { border: 1px solid #eee; background: #fff; color: #888; width: 30px; height: 30px; font-size: 14px; cursor: pointer; border-radius: 8px; padding: 0; display: flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: #f0f0f0; color: #555; border-color: #ccc; }
.secret-check-box { position: relative; width: 30px; height: 30px; }
.secret-check-box input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; z-index: 2; }
.secret-check-icon { width: 100%; height: 100%; border: 1px solid #eee; background: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #ddd; transition: 0.2s; }
.secret-check-box input:checked + .secret-check-icon { background: #fff0f0; border-color: #ffcccc; color: #ff6b6b; }
#reply_indicator_box { background: #f0f7f9; padding: 6px 10px; margin-bottom: 5px; border-radius: 8px; font-size: 12px; color: #555; display: flex; justify-content: space-between; align-items: center; border: 1px solid #e1eef3; }
.btn-cancel-reply { background: none; border: none; cursor: pointer; color: #888; font-size: 11px; }
.chat-input-row.compact-mode { display: flex; align-items: center; gap: 8px; background: #f9f9f9; border: 1px solid #eee; border-radius: 20px; padding: 5px 5px 5px 15px; }
.chat-input-row textarea { flex-grow: 1; height: 34px; border: none; resize: none; outline: none; font-size: 13px; color: #333; background: transparent; padding: 8px 0; line-height: 1.4; }
.btn-send-icon { width: 34px; height: 34px; background: var(--point-color, #97c3d1); color: #fff; border: none; border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center; flex-shrink: 0; transition: 0.2s; }
.btn-send-icon:hover { opacity: 0.9; transform: scale(1.05); }
.btn-send-icon svg { width: 16px; height: 16px; fill: #fff; }

/* [수정] 채팅 리스트 영역 */
.chat-list-area { 
    flex-grow: 1; 
    overflow-y: scroll; 
    /* 기본 패딩은 작게 (공지 없을 때) */
    padding: 20px 15px 20px; 
    scroll-behavior: smooth; 
    background: transparent; 
    border-radius: 0 0 38px 38px; 
    position: relative;
    z-index: 5;
}

/* [추가] 공지사항이 있을 때만 상단 여백 추가 */
.chat-list-area.has-notice {
    padding-top: 60px; /* 공지바 높이만큼 확보 */
}
.chat-list-area::-webkit-scrollbar { width: 5px; }
.chat-list-area::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.1); border-radius: 10px; }
.chat-list-area::-webkit-scrollbar-track { background-color: transparent; }

.chat-row { display: flex; flex-direction: column; margin-bottom: 15px; }
.bubble-container { display: flex; align-items: flex-end; max-width: 85%; gap: 6px; }
.chat-bubble-left { 
    align-self: flex-start; 
    max-width: 90%; /* [추가] 화면의 90%까지만 차지하도록 제한 */
}
.chat-bubble-left .profile-name { font-size: 11px; color: #666; margin: 0 0 4px 5px; }
.chat-bubble-left .bubble-content { 
    position: relative; 
    background: var(--post-bg-color, #fff);  /* [변경] 변수 적용 */
    color: var(--post-text-color, #333);     /* [변경] 변수 적용 */
    padding: 10px 14px; 
    border-radius: 0 18px 18px 18px; 
    font-size: 13px; 
    line-height: 1.5; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); 
    border: 1px solid #eee; 
    word-break: break-word;   
    word-wrap: break-word;    
}
.chat-bubble-left .bubble-content::before { 
    content: ""; position: absolute; 
    top: 0; /* [중요] 0으로 수정 */
    left: -8px; width: 0; height: 0; 
    border-bottom: 8px solid transparent; 
    border-right: 8px solid #eee; 
}
.chat-bubble-left .bubble-content::after { 
    content: ""; position: absolute; 
    top: 0; /* [중요] 0으로 수정 */
    left: -6px; width: 0; height: 0; 
    border-bottom: 7px solid transparent; 
    border-right: 7px solid var(--post-bg-color, #fff); 
}
/* [수정] 오른쪽 답글 영역 전체 컨테이너 */
.chat-bubble-right-area { 
    align-self: flex-end; 
    display: flex; 
    flex-direction: column; 
    align-items: flex-end; /* 무조건 오른쪽 정렬 */
    width: 100%; /* 전체 폭 사용 */
    margin-top: 5px;
}
/* [수정] 리플 개별 아이템 */
.item-comment {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* 오른쪽 정렬 강제 */
    margin-bottom: 8px;
    width: 100%;
    position: relative;
}

/* [수정] 리플 말풍선 + 버튼 컨테이너 */
.item-comment .bubble-container { 
    display: flex;
    flex-direction: row-reverse; 
    align-items: flex-end;       
    gap: 6px; 
    max-width: 90%;              /* [수정] 85% -> 90%로 변경 */
}

/* [수정] 리플 말풍선 본체 */
.item-comment-box { 
    position: relative; 
    background: var(--reply-color, #4a5568); 
    color: var(--reply-text-color, #fff);
    padding: 10px 14px; 
    border-radius: 18px 0 18px 18px; /* 오른쪽 위만 각지게 */
    font-size: 13px; 
    line-height: 1.5; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1); 
    
    text-align: left; /* 텍스트는 왼쪽 정렬 */
    white-space: normal;
    word-break: break-all;
}

/* [수정] 리플 꼬리 위치 (오른쪽 위) */
.item-comment-box::before { 
    content: ""; position: absolute; 
    top: 0px;        /* 상단 0px에 딱 맞춤 */
    right: -8px;     /* 오른쪽으로 8px 뺌 */
    width: 0; height: 0; 
    border-bottom: 8px solid transparent; 
    border-left: 8px solid var(--reply-color, #4a5568); 
}

/* [수정] 리플 하단 정보 (시간, 수정버튼) */
.item-comment .co-footer { 
    margin-top: 2px; 
    font-size: 10px; 
    color: #ccc; 
    text-align: right; 
    padding-right: 2px; /* 꼬리만큼 약간 여백 */
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.item-comment .co-footer a { color: #ccc; text-decoration: none; margin-left: 5px; }

.action-btn-group { opacity: 0.4; transition: 0.2s; display: flex; gap: 3px; }
.chat-row:hover .action-btn-group { opacity: 1; }
.btn-icon-small { background: none; border: none; padding: 0; cursor: pointer; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; color: #aaa; border-radius: 4px; }
.btn-icon-small:hover { background: rgba(0,0,0,0.05); color: var(--point-color, #97c3d1); }
.btn-icon-small svg { width: 14px; height: 14px; fill: currentColor; }
.btn-icon-small.del:hover { color: #ff6b6b; } 

.secret-blur { color: transparent; text-shadow: 0 0 10px rgba(0,0,0,0.5); background: rgba(240,240,240,0.5); border-radius: 5px; user-select: none; cursor: pointer; }
.secret-cover-link { position: absolute; top:0; left:0; right:0; bottom:0; z-index: 10; cursor: pointer; }
.empty_list { text-align: center; margin-top: 50px; color: #888; font-size: 12px; }

.design-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.design-modal { background: #fff; padding: 20px; border-radius: 15px; width: 300px; box-shadow: 0 5px 20px rgba(0,0,0,0.2); max-height: 80vh; overflow-y: auto; }
.design-modal h3 { margin: 0 0 15px 0; font-size: 16px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.opt-row { margin-bottom: 10px; display: flex; flex-direction:column; gap:5px; } /* [수정] 레이아웃 보기 좋게 수정 */
.opt-row label { font-size: 12px; color: #555; font-weight:bold;}
.opt-row input[type="color"] { border: none; width: 100%; height: 35px; cursor: pointer; padding: 0; }
.opt-row select, .opt-row .input-text { 
    border: 1px solid #ddd; 
    padding: 0 8px; /* 상하 패딩 제거 후 높이로 제어 */
    height: 35px; /* 색상 인풋과 높이 맞춤 */
    line-height: 35px; /* 텍스트 수직 정렬 */
    font-size: 12px; 
    border-radius: 5px; 
    width: 100%; 
    box-sizing: border-box;
    vertical-align: middle;
}
.btn-row { margin-top: 20px; text-align: right; }
.btn-save { background: #333; color: #fff; border: none; padding: 5px 15px; border-radius: 5px; cursor: pointer; }
.btn-close { background: #eee; color: #555; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; margin-left: 5px; }

/* [추가] 관리자용 즉시 삭제(X) 버튼 스타일 */
.btn-quick-del {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 18px; height: 18px;
    background: #fff; border: 1px solid #eee;
    color: #ff6b6b; border-radius: 50%;
    margin-left: 5px; cursor: pointer;
    vertical-align: middle;
}
.btn-quick-del:hover { background: #ff6b6b; color: #fff; border-color: #ff6b6b; }
.btn-quick-del svg { width: 10px; height: 10px; fill: currentColor; }

/* [추가] 관리자용 비밀글 표시 아이콘 */
.secret-indicator { font-size: 11px; color: #ff6b6b; margin-right: 3px; vertical-align: middle; }

/* [추가] 비밀글 인라인 입력폼 스타일 */
.secret-inline-form {
    display: none; /* 평소엔 숨김 */
    align-items: center;
    gap: 5px;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #eee;
}
.secret-input {
    border: 1px solid #ddd;
    padding: 5px;
    font-size: 12px;
    border-radius: 4px;
    width: 100px;
    outline: none;
}
.btn-secret-ok {
    background: #555;
    color: #fff;
    border: none;
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
}

.notice-bar-area.reply-active {
    top: 175px !important; /* 기존 130px + 알림창 높이(약 45px) */
}

/* [수정] 로딩 시 만화 같은 광택 효과 (Cartoonish Shine) */
@keyframes shineSwipe {
    0% { left: -150%; opacity: 0; }
    5% { opacity: 1; }   /* 시작하자마자 쨍하게 등장 */
    100% { left: 150%; opacity: 0; }
}

.chat-frame-body::after {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 80%; /* 폭을 좀 더 넓힘 */
    height: 100%;
    
    /* [중요] 만화 느낌의 날카로운 광택 그라데이션 */
    background: linear-gradient(
        to right, 
        transparent 0%, 
        transparent 40%,
        rgba(255,255,255, 0.4) 40%, 
        rgba(255,255,255, 0.8) 50%, 
        rgba(255,255,255, 0.4) 60%,
        transparent 60%, 
        transparent 100%
    );
    
    /* 기울기 조정 */
    transform: skewX(-25deg);
    
    pointer-events: none; 
    z-index: 100;
    
    /* 속도 조절: 1.5s -> 2.0s (조금 더 여유롭게 지나감) */
    animation: shineSwipe 2.0s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

/* [추가] 공지 체크박스 스타일 (비밀글과 통일) */
.notice-check-box { position: relative; width: 30px; height: 30px; }
.notice-check-box input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; z-index: 2; }
.notice-check-icon { 
    width: 100%; height: 100%; 
    border: 1px solid #eee; 
    background: #fff; 
    border-radius: 8px; 
    display: flex; align-items: center; justify-content: center; 
    color: #ddd; 
    transition: 0.2s; 
    font-size: 14px;
}

/* 공지 체크 활성화 시 (진한 회색) */
.notice-check-box input:checked + .notice-check-icon { 
    background: #555; 
    border-color: #333; 
    color: #fff; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}