/* ============================================================
   community.css — 마이타임 커뮤니티 게시판 전용 스타일
   디자인 토큰: #2b70c9 블루, #1e5296 호버, #FAFAFA 배경
   ============================================================ */

/* ── 공통 컨테이너 ── */
.community-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: calc(100vh - 150px);
}

/* ── 페이지 헤더 (제목 + 글쓰기 버튼) ── */
.community-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.community-page-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: #111;
}
.btn-community-write {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #2b70c9;
    color: #fff;
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s;
    cursor: pointer;
}
.btn-community-write:hover {
    background-color: #1e5296;
    color: #fff;
}

/* ── 검색/필터 영역 ── */
.community-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}
.community-filter-bar .filter-count {
    font-size: 15px;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}
.community-filter-bar .filter-count strong {
    font-weight: 700;
    color: #111;
}
.community-search-box {
    flex: 1;
    position: relative;
}
.community-search-box input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.2s;
}
.community-search-box input:focus {
    border-color: #2b70c9;
    outline: none;
}
.community-search-box .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
    font-size: 16px;
}

/* ── 게시글 카드 리스트 ── */
.community-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.community-card {
    background: #fff;
    border: 1px solid #EBEBEB;
    border-radius: 12px;
    padding: 22px 24px;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}
.community-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.07);
    color: inherit;
    text-decoration: none;
}
.community-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.community-card-header .card-author-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #e8f0fe;
    color: #2b70c9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.community-card-header .card-author-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.community-card-header .card-date {
    font-size: 13px;
    color: #999;
    margin-left: auto;
}
.community-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #111;
    margin-bottom: 8px;
    line-height: 1.4;
}
.community-card-body {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 14px;
}
.community-card-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #888;
}
.community-card-footer .card-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}
.community-card-footer .card-stat i {
    font-size: 14px;
}
.community-card-footer .card-stat.stat-like i {
    color: #2b70c9;
}
.community-card-footer .card-stat.stat-comment i {
    color: #2b70c9;
}

/* ── 페이지네이션 ── */
.community-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 36px;
}
.community-pagination .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.community-pagination .page-btn:hover {
    background-color: #f0f0f0;
}
.community-pagination .page-btn.active {
    background-color: #2b70c9;
    color: #fff;
    font-weight: 700;
}
.community-pagination .page-btn.disabled {
    color: #ccc;
    cursor: default;
    pointer-events: none;
}

/* ============================================================
   상세 보기 (community_view)
   ============================================================ */

/* ── 글 상세 영역 ── */
.community-view-header {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 28px;
}
.community-view-title {
    font-size: 26px;
    font-weight: 800;
    color: #111;
    line-height: 1.35;
    margin-bottom: 14px;
}
.community-view-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: #888;
}
.community-view-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.community-view-meta .meta-item i {
    font-size: 14px;
    color: #aaa;
}
.community-view-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    min-height: 150px;
    white-space: pre-line;
    word-break: break-word;
    margin-bottom: 32px;
}
.community-view-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}

/* ── 액션 바 (좋아요 + 목록으로) ── */
.community-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin-bottom: 36px;
}
.btn-like {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    color: #555;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-like:hover {
    border-color: #2b70c9;
    color: #2b70c9;
}
.btn-like.active {
    border-color: #2b70c9;
    background-color: #eef4fc;
    color: #2b70c9;
    font-weight: 600;
}
.btn-like i {
    font-size: 18px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.btn-like.active i {
    transform: scale(1.2);
}
/* 좋아요 bounce 애니메이션 */
@keyframes likeBounce {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.35); }
    60%  { transform: scale(0.9); }
    100% { transform: scale(1.2); }
}
.btn-like.bounce i {
    animation: likeBounce 0.4s ease;
}
.btn-list {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-list:hover {
    background-color: #f5f5f5;
    color: #333;
    text-decoration: none;
}

/* ============================================================
   댓글 영역
   ============================================================ */
.comment-section {
    margin-top: 0;
}
.comment-section-title {
    font-size: 17px;
    font-weight: 700;
    color: #111;
    margin-bottom: 20px;
}

/* ── 댓글 입력 폼 ── */
.comment-input-box {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    align-items: flex-start;
}
.comment-input-box textarea {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 200px;
    overflow-y: auto;
    transition: border-color 0.2s;
    line-height: 1.5;
}
.comment-input-box textarea:focus {
    border-color: #2b70c9;
    outline: none;
}
.comment-input-box textarea::placeholder {
    color: #bbb;
}
.btn-comment-submit {
    padding: 10px 18px;
    background-color: #2b70c9;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
}
.btn-comment-submit:hover {
    background-color: #1e5296;
}

/* ── 댓글 아이템 ── */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.comment-item {
    padding: 18px 0;
    border-top: 1px solid #f0f0f0;
}
.comment-item:first-child {
    border-top: none;
}
.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #e8f0fe;
    color: #2b70c9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.comment-author {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.comment-time {
    font-size: 12px;
    color: #aaa;
}
.comment-body {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 8px;
    padding-left: 42px;
    white-space: pre-line;
    word-break: break-word;
}
.comment-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-left: 42px;
    font-size: 13px;
}
.comment-actions .btn-comment-like {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 13px;
    transition: color 0.2s;
}
.comment-actions .btn-comment-like:hover,
.comment-actions .btn-comment-like.active {
    color: #2b70c9;
}
.comment-actions .btn-reply-toggle {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    transition: color 0.2s;
}
.comment-actions .btn-reply-toggle:hover {
    color: #2b70c9;
}

/* ── 답글 (대댓글) 영역 ── */
.reply-section {
    margin-left: 42px;
    margin-top: 12px;
}
.reply-toggle-btn {
    background: none;
    border: none;
    color: #2b70c9;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 8px;
    transition: color 0.2s;
}
.reply-toggle-btn:hover {
    color: #1e5296;
}
.reply-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}
.reply-list.collapsed {
    max-height: 0;
    opacity: 0;
}
.reply-list.expanded {
    max-height: 2000px;
    opacity: 1;
}
.reply-item {
    padding: 14px 0 14px 16px;
    border-left: 2px solid #e8f0fe;
    margin-bottom: 4px;
}
.reply-item .reply-indicator {
    color: #2b70c9;
    font-size: 13px;
    margin-right: 6px;
}
.reply-body,
.reply-actions {
    padding-left: 52px;
}

/* ── 답글 입력 폼 ── */
.reply-input-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 10px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}
.reply-input-box.hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}
.reply-input-box.visible {
    max-height: 200px;
    opacity: 1;
}
.reply-input-box textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    min-height: 40px;
    max-height: 150px;
    overflow-y: auto;
    transition: border-color 0.2s;
    line-height: 1.5;
}
.reply-input-box textarea:focus {
    border-color: #2b70c9;
    outline: none;
}
.reply-input-box textarea::placeholder {
    color: #bbb;
}
.btn-reply-submit {
    padding: 8px 14px;
    background-color: #2b70c9;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
}
.btn-reply-submit:hover {
    background-color: #1e5296;
}

/* ============================================================
   글쓰기 (community_write)
   ============================================================ */
.community-write-form {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 36px;
    margin-top: 8px;
}
.community-form-group {
    margin-bottom: 24px;
}
.community-form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: #333;
    font-size: 15px;
}
.community-form-group .form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.community-form-group .form-input:focus {
    border-color: #2b70c9;
    outline: none;
}
.community-form-group .form-hint {
    font-size: 13px;
    color: #999;
    margin-top: 8px;
}

/* CKEditor5 커스텀 */
.community-form-group .ck-editor__editable {
    min-height: 300px;
    font-size: 15px;
    line-height: 1.7;
}

/* ── 글쓰기 하단 버튼 ── */
.community-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
}
.btn-form-submit {
    background-color: #2b70c9;
    color: #fff;
    padding: 13px 36px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-form-submit:hover {
    background-color: #1e5296;
}
.btn-form-cancel {
    background-color: #f5f5f5;
    color: #555;
    padding: 13px 36px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
}
.btn-form-cancel:hover {
    background-color: #e0e0e0;
    color: #333;
    text-decoration: none;
}

/* ============================================================
   반응형 (768px / 480px)
   ============================================================ */
@media (max-width: 768px) {
    .community-container {
        padding: 20px 15px;
    }
    .community-page-header h2 {
        font-size: 20px;
    }
    .community-filter-bar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    .community-filter-bar .filter-count {
        text-align: left;
    }
    .community-view-title {
        font-size: 22px;
    }
    .community-view-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
    .community-action-bar {
        flex-direction: row;
        gap: 12px;
    }
    .community-write-form {
        padding: 20px;
    }
    .community-form-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }
    .btn-form-submit, .btn-form-cancel {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }
    .reply-section {
        margin-left: 24px;
    }
}
@media (max-width: 480px) {
    .community-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .btn-community-write {
        width: 100%;
        justify-content: center;
    }
    .community-card {
        padding: 18px 16px;
    }
    .comment-body,
    .comment-actions,
    .reply-body,
    .reply-actions {
        padding-left: 0;
    }
    .reply-section {
        margin-left: 16px;
    }
}
