/**
 * 재사용 가능한 게시판 시스템 - 스타일시트
 * 다크 테마 기반 / 프로젝트에 맞게 커스터마이징 가능
 */

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    --dark-bg: #0a0a0f;
    --dark-surface: #14141a;
    --dark-card: #1a1a22;
    --dark-border: rgba(255, 255, 255, 0.08);

    --light-bg: #f8f8f8;
    --light-surface: #ffffff;
    --light-border: rgba(0, 0, 0, 0.08);

    --text-primary: #1a1a22;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-white: #ffffff;
    --text-white-muted: rgba(255, 255, 255, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--light-bg);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* GNB */
.gnb {
    background: var(--dark-bg);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.gnb .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gnb .logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-white);
}
.gnb .logo:hover {
    color: var(--primary-color);
}
.gnb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.gnb-nav a {
    color: var(--text-white-muted);
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: 6px;
    transition: all 0.2s;
}
.gnb-nav a:hover {
    color: var(--text-white);
    background: rgba(255,255,255,0.08);
}
.gnb-nav .btn-admin {
    background: var(--primary-color);
    color: #fff !important;
}
.gnb-nav .btn-admin:hover {
    background: var(--primary-hover);
}

@media (max-width: 768px) {
    .gnb-nav a {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* Page Hero (Dark Header) */
.page-hero {
    position: relative;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #0a0a0f 0%, #14141a 100%);
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.page-hero .container {
    position: relative;
    z-index: 1;
    text-align: center;
}

.page-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.page-hero h1 span {
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-hero p {
    color: var(--text-white-muted);
    font-size: 1.1rem;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    font-size: 0.85rem;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.5);
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb span {
    color: rgba(255, 255, 255, 0.3);
}

.breadcrumb span:last-child {
    color: var(--primary-color);
}

/* Content Section */
.content-section {
    padding: 60px 0 100px;
    background: var(--light-bg);
    min-height: calc(100vh - 280px);
}

/* Section Title */
.section-title {
    margin-bottom: 30px;
}

.section-title h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-title p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Board Table */
.board-table {
    background: var(--light-surface);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--light-border);
}

.board-header {
    display: grid;
    grid-template-columns: 100px 1fr 120px 80px;
    padding: 18px 25px;
    background: var(--dark-card);
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.9rem;
}

.board-row {
    display: grid;
    grid-template-columns: 100px 1fr 120px 80px;
    padding: 20px 25px;
    border-bottom: 1px solid var(--light-border);
    transition: all 0.3s ease;
    cursor: pointer;
    align-items: center;
}

.board-row:hover {
    background: rgba(59, 130, 246, 0.03);
}

.board-row:last-child {
    border-bottom: none;
}

.board-row .category {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

.board-row .title-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.board-row .title {
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: color 0.3s;
}

.board-row:hover .title {
    color: var(--primary-color);
}

.board-row .title .comment-count {
    color: var(--primary-color);
    font-size: 0.85rem;
    margin-left: 6px;
}

.board-row .writer {
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-row .writer .writer-link {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    cursor: pointer;
}

.board-row .writer .writer-link:hover {
    color: var(--primary-color);
}

.board-row .date {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: right;
}

/* Notice Row */
.board-row.notice {
    background: rgba(59, 130, 246, 0.04);
}

.board-row.notice .title {
    font-weight: 600;
}

.board-row.notice .title::before {
    content: '[공지] ';
    color: var(--primary-color);
}

/* 답글 스타일 */
.board-row.is-reply {
    background: rgba(59, 130, 246, 0.02);
}

.board-row.is-reply .title-area {
    padding-left: 20px;
}

.reply-icon {
    color: var(--primary-color);
    margin-right: 8px;
    font-size: 0.85rem;
    opacity: 0.7;
}

.board-row.is-reply .title {
    color: var(--text-secondary);
}

.board-row.is-reply:hover .title {
    color: var(--primary-color);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
}

.badge-new {
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
}

.badge-secret {
    background: var(--secondary-color);
    color: white;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-surface);
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.pagination a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination a.active,
.pagination span.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination a.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: flex-end;
}

.search-box select,
.search-box input {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--light-surface);
}

.search-box select {
    min-width: 120px;
}

.search-box input {
    min-width: 250px;
}

.search-box button {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: var(--primary-hover);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-outline {
    background: transparent;
    border: 1px solid #ddd;
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group label .required {
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--light-surface);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control {
    min-height: 300px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

/* Card */
.card {
    background: var(--light-surface);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--light-border);
}

/* Post View */
.post-view {
    background: var(--light-surface);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--light-border);
}

.post-header {
    padding: 30px;
    border-bottom: 1px solid var(--light-border);
}

.post-header .category {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.post-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
    line-height: 1.4;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-meta .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.post-meta .user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
}

.post-meta .writer-name {
    font-weight: 600;
    color: var(--text-primary);
}

.post-content {
    padding: 40px 30px;
    min-height: 300px;
    line-height: 1.8;
    color: var(--text-primary);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

.post-attachments {
    padding: 20px 30px;
    background: var(--light-bg);
    border-top: 1px solid var(--light-border);
}

.post-attachments h4 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: var(--light-surface);
    border-radius: 8px;
    font-size: 0.9rem;
}

.attachment-item i {
    color: var(--primary-color);
}

.attachment-item .size {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Post Navigation */
.post-nav {
    display: flex;
    border-top: 1px solid var(--light-border);
}

.post-nav a {
    flex: 1;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background 0.3s;
}

.post-nav a:hover {
    background: var(--light-bg);
}

.post-nav a:first-child {
    border-right: 1px solid var(--light-border);
}

.post-nav .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.post-nav .title {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Post Actions */
.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
}

/* Comments */
.comments-section {
    margin-top: 40px;
}

.comments-section h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.comment-form {
    background: var(--light-surface);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--light-border);
}

.comment-form textarea {
    min-height: 100px;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    background: var(--light-surface);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--light-border);
}

.comment-item.reply {
    margin-left: 40px;
}

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

.comment-writer {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.comment-content {
    color: var(--text-primary);
    line-height: 1.6;
}

.comment-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.comment-actions button {
    background: none;
    border: none;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.comment-actions button:hover {
    color: var(--primary-color);
}

/* Flash Messages */
.flash-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.flash-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.flash-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.flash-message.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Footer */
footer {
    background: var(--dark-bg);
    padding: 40px 0 30px;
    border-top: 1px solid var(--dark-border);
}

footer .container {
    text-align: center;
}

footer p {
    color: var(--text-white-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .page-hero {
        height: 220px;
    }

    .board-header {
        display: none;
    }

    .board-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 18px 20px;
    }

    .board-row .category {
        order: 1;
    }

    .board-row .title-area {
        order: 2;
    }

    .board-row .writer {
        order: 3;
        font-size: 0.85rem;
    }

    .board-row .date {
        order: 4;
        text-align: left;
        font-size: 0.85rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box select,
    .search-box input {
        min-width: 100%;
    }

    .post-header h1 {
        font-size: 1.3rem;
    }

    .post-meta {
        flex-direction: column;
        gap: 10px;
    }

    .post-nav {
        flex-direction: column;
    }

    .post-nav a:first-child {
        border-right: none;
        border-bottom: 1px solid var(--light-border);
    }

    .post-actions {
        flex-direction: column;
        gap: 15px;
    }

    .comment-item.reply {
        margin-left: 20px;
    }
}
