/**
 * TaskFlow 공지사항 스타일
 */

/* 토큰은 css/zds.css(notice.html 이 함께 로드, data-theme 은 앱과 같은 localStorage 값)에서 온다.
   아래는 zds.css 를 못 읽었을 때의 라이트 폴백. */
:root {
    --bg-primary: #F8F9FA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F3F5;
    --border: #DDE1E6;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #868E96;
    --accent-blue: #2563EB;
    --accent-red: #E03131;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 14px;
    letter-spacing: -0.01em;
}

.lucide {
    flex-shrink: 0;
}

.tf-lucide-inline-svg {
    color: var(--accent-blue);
    vertical-align: -2px;
}

.notice-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 32px;
}

.notice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.notice-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.btn-write {
    height: 40px;
    padding: 0 20px;
    background: var(--z-cta, #0B0C0D);
    color: var(--z-cta-text, #FFFFFF);
    border: none;
    border-radius: var(--z-radius-pill, 100px);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-write:hover {
    background: var(--z-cta-hover, #212529);
}

.btn-write:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* 게시물 목록 */
.notice-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-card, 16px);
    overflow: hidden;
}

.notice-item {
    display: grid;
    grid-template-columns: 60px 1fr 120px 80px 80px;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: background 0.2s;
    align-items: center;
}

.notice-item:hover {
    background: var(--bg-primary);
}

/* 고정 글 = 옅은 키컬러 면(한쪽 액센트 선 없음) */
.notice-item.pinned {
    background: var(--z-accent-light, #EFF6FF);
}

.notice-item.pinned:hover {
    background: var(--z-accent-light, #EFF6FF);
}

.notice-num {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notice-num.pinned {
    color: var(--accent-blue);
    font-weight: 600;
}

.notice-info {
    min-width: 0;
}

.notice-item-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notice-item-title .pin-icon {
    display: inline-flex;
    align-items: center;
    color: var(--accent-blue);
}

.notice-num-icon,
.title-pin-icon,
.detail-pin-icon,
.meta-lucide,
.btn-lucide,
.section-lucide,
.page-lucide,
.file-lucide {
    color: currentColor;
}

.detail-pin-icon,
.meta-lucide,
.section-lucide,
.page-lucide {
    color: var(--accent-blue);
}

.notice-item-title .comment-count {
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 600;
}

.notice-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.notice-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: white;
    letter-spacing: -0.04em;
    white-space: nowrap;
}

.notice-date {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.notice-views {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* 게시물 상세 */
.notice-detail {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-card, 16px);
    overflow: hidden;
}

.notice-detail.active {
    display: block;
}

.detail-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.detail-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.detail-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-content {
    padding: 24px;
    min-height: 200px;
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
}

.detail-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: transparent;
}

.detail-actions-left {
    display: flex;
    gap: 8px;
}

.detail-actions-right {
    display: flex;
    gap: 8px;
}

.btn {
    height: 36px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--z-radius-pill, 100px);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, border-color 0.2s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--z-border-strong, #C5CAD1);
}

.btn-danger {
    color: var(--z-error-text, #C92A2A);
}

.btn-danger:hover {
    background: var(--z-error-bg, rgba(224, 49, 49, 0.10));
    border-color: var(--border);
}

/* 이모지 반응 */
.reactions {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.reaction-btn {
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-pill, 100px);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.reaction-btn:hover {
    border-color: var(--z-border-strong, #C5CAD1);
    background: var(--bg-tertiary);
}

.reaction-btn.active {
    background: var(--z-accent-light, #EFF6FF);
    border-color: var(--z-accent-border, #BFDBFE);
    box-shadow: none;
}

.reaction-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reaction-btn.disabled:hover {
    border-color: var(--border);
    transform: none;
}

.reaction-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* 리액션 툴팁 */
.reaction-btn[data-tooltip] {
    position: relative;
}

.reaction-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--z-cta, #0B0C0D);
    border: 0;
    border-radius: var(--z-radius-xs, 8px);
    font-size: 12px;
    color: var(--z-cta-text, #FFFFFF);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    margin-bottom: 8px;
    box-shadow: var(--z-shadow-float, 0 8px 24px rgba(0,0,0,0.12));
    pointer-events: none;
}

.reaction-btn[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

.add-reaction {
    padding: 6px 12px;
    background: transparent;
    border: 1px dashed var(--z-border-strong, #C5CAD1);
    border-radius: var(--z-radius-pill, 100px);
    font-size: 14px;
    cursor: pointer;
    color: var(--text-muted);
}

.add-reaction:hover {
    border-color: var(--text-muted);
    color: var(--text-secondary);
}

/* 댓글 섹션 */
.comments-section {
    padding: 24px;
    border-top: 1px solid var(--border);
}

.comments-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-form {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-input, 10px);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    min-height: 44px;
}

.comment-input:hover {
    border-color: var(--z-border-strong, #C5CAD1);
}

.comment-input:focus {
    outline: none;
    border-color: var(--z-form-accent, #19AAFF);
    box-shadow: var(--z-focus-ring, 0 0 0 3px rgba(25,170,255,0.15));
}

.comment-submit {
    height: 44px;
    padding: 0 20px;
    background: var(--z-cta, #0B0C0D);
    color: var(--z-cta-text, #FFFFFF);
    border: none;
    border-radius: var(--z-radius-pill, 100px);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.comment-submit:hover {
    background: var(--z-cta-hover, #212529);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    display: flex;
    gap: 12px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    letter-spacing: -0.04em;
    white-space: nowrap;
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
}

.comment-time {
    font-size: 12px;
    color: var(--text-muted);
}

.comment-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.comment-actions {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.comment-action {
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.comment-action:hover {
    color: var(--accent-blue);
}

.reply-list {
    margin-top: 12px;
    padding-left: 20px;
}

/* 작성/수정 폼 */
.write-form {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-card, 16px);
    padding: 24px;
}

.write-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-input, 10px);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}

.form-input:hover, .form-textarea:hover {
    border-color: var(--z-border-strong, #C5CAD1);
}

.form-input:focus {
    outline: none;
    border-color: var(--z-form-accent, #19AAFF);
    box-shadow: var(--z-focus-ring, 0 0 0 3px rgba(25,170,255,0.15));
}

.form-textarea {
    width: 100%;
    min-height: 300px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-input, 10px);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
    line-height: 1.8;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--z-form-accent, #19AAFF);
    box-shadow: var(--z-focus-ring, 0 0 0 3px rgba(25,170,255,0.15));
}

/* 첨부파일 스타일 */
.attachment-area {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--z-radius-sm, 12px);
    border: 1px dashed var(--z-border-strong, #C5CAD1);
}

.attachment-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.attachment-label:hover {
    color: var(--accent-blue);
}

.attachment-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--z-radius-xs, 8px);
}

.attachment-preview .file-icon {
    font-size: 20px;
}

.attachment-preview .file-info {
    flex: 1;
    min-width: 0;
}

.attachment-preview .file-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-preview .file-size {
    font-size: 12px;
    color: var(--text-muted);
}

.attachment-preview .remove-btn {
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: var(--z-error-text, #C92A2A);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
}

/* 첨부파일 표시 */
.detail-attachment {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-sm, 12px);
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-attachment a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
}

.detail-attachment a:hover {
    color: var(--accent-blue);
}

.detail-attachment .file-size {
    font-size: 12px;
    color: var(--text-muted);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-checkbox input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--z-form-accent, #19AAFF);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-primary {
    background: var(--z-cta, #0B0C0D);
    color: var(--z-cta-text, #FFFFFF);
    border-color: var(--z-cta, #0B0C0D);
}

.btn-primary:hover {
    background: var(--z-cta-hover, #212529);
    border-color: var(--z-cta-hover, #212529);
}

.btn-secondary {
    background: var(--bg-secondary);
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    color: var(--text-muted);
}

.empty-text {
    font-size: 14px;
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-pill, 100px);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover {
    background: var(--bg-tertiary);
}

.page-btn.active {
    background: var(--z-cta, #0B0C0D);
    border-color: var(--z-cta, #0B0C0D);
    color: var(--z-cta-text, #FFFFFF);
}

/* 로딩 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 반응형 */
@media (max-width: 768px) {
    .notice-container {
        padding: 16px;
    }

    .notice-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .notice-num, .notice-author, .notice-date, .notice-views {
        display: none;
    }

    .notice-item.pinned .notice-num {
        display: none;
    }

    .notice-meta {
        margin-top: 8px;
    }

    .detail-meta {
        flex-wrap: wrap;
        gap: 12px;
    }
}

/* 이모지 피커 */
.emoji-picker {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-sm, 12px);
    padding: 6px;
    display: none;
    z-index: 100;
    box-shadow: var(--z-shadow-float, 0 8px 24px rgba(0,0,0,0.12));
}

.emoji-picker.active {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 200px;
}

.emoji-option {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--z-radius-xs, 8px);
    border: none;
    background: transparent;
}

.emoji-option:hover {
    background: var(--bg-tertiary);
}

/* 네비게이션 (목록으로) */
.back-nav {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    height: 32px;
    padding: 0 14px 0 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--z-radius-pill, 100px);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    width: fit-content;
}

.back-nav:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.back-nav.active {
    display: flex;
}
