/* ===========================
   Board Page Specific Styles
   =========================== */

.board-page {
    padding-top: 100px;
    min-height: 100vh;
}

.board-container {
    max-width: 900px;
    margin: 0 auto;
}

/* Board Header */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.board-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

#post-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-new-post {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-new-post:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

/* New Post Form */
.new-post-form {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    animation: slideDown 0.3s ease;
    min-height: auto;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.new-post-form h3 {
    color: var(--accent-blue);
    margin-bottom: 20px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.new-post-form form {
    display: flex;
    flex-direction: column;
    height: auto;
}

.form-group {
    margin-bottom: 20px;
    flex-shrink: 0;
}

/* Keep toggle switch above buttons */
.form-group:has(.toggle-switch) {
    margin-bottom: 10px;
}

/* Make the editor group flexible to fill available space */
.form-group:has(.editor-content) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: auto;
    overflow: visible;
    margin-bottom: 15px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.08);
}

/* Form Actions - Submit and Cancel Buttons */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-shrink: 0;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.form-actions .btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
}

.form-actions .btn-submit {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.form-actions .btn-submit:hover {
    background: linear-gradient(135deg, #7c8fff, #8e5db3);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.form-actions .btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-actions .btn-cancel:hover {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
    border-color: rgba(255, 71, 87, 0.3);
    transform: translateY(-2px);
}

/* Board Posts */
.board-posts {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Contact Message Styles */
.contact-row {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.03), rgba(136, 71, 255, 0.03));
    border-left: 3px solid var(--accent-blue);
}

.contact-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    font-size: 0.75rem;
    border-radius: 5px;
    margin-left: 10px;
    font-weight: 500;
}

.author-email {
    display: inline-block;
    margin-left: 8px;
    color: var(--accent-blue);
    cursor: help;
    font-size: 0.9em;
}

.detail-email {
    color: var(--accent-blue);
    font-size: 0.9em;
    margin-left: 10px;
}

.board-post {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s;
}

.board-post:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.post-info {
    flex: 1;
}

.post-author {
    color: var(--accent-blue);
    font-weight: 600;
    margin-bottom: 5px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.private-badge {
    background: var(--accent-purple);
    color: white;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: normal;
}

.post-title {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Brighter style for restricted post titles with lock icon */
.restricted-post .post-title,
.post-title.restricted-title {
    color: #ffffff !important;
    opacity: 1 !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Make the entire restricted post header brighter */
.restricted-post .post-info {
    filter: brightness(1.2);
}

.post-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.post-number {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 300;
}

.post-content {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 20px;
}

/* Emoji Headers in Posts */
.post-content h2,
.board-message h2 {
    margin: 25px 0 15px !important;
    color: #667eea !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
    padding-bottom: 8px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), transparent);
    padding-left: 15px;
    border-left: 4px solid #667eea;
}

.post-actions {
    display: flex;
    gap: 15px;
}

.post-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.post-action-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(0, 212, 255, 0.1);
}

.like-btn:hover {
    border-color: #ff4458;
    color: #ff4458;
    background: rgba(255, 68, 88, 0.1);
}

.delete-btn:hover {
    border-color: #ff4458;
    color: #ff4458;
    background: rgba(255, 68, 88, 0.1);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px 0;
}

.page-btn,
.page-number {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
}

.page-btn {
    padding: 0;
    width: 36px;
}

.page-btn:hover:not(.disabled),
.page-number:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.4);
    color: #fff;
    transform: translateY(-2px);
}

.page-number.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #fff;
    font-weight: 600;
}

.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.page-dots {
    color: rgba(255, 255, 255, 0.3);
    padding: 0 8px;
    user-select: none;
}

/* Empty Board */
.empty-board {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-board p {
    font-size: 1.1rem;
}

/* Login Alert */
.login-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--bg-secondary);
    border: 1px solid var(--accent-purple);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.login-alert.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.alert-content {
    text-align: center;
}

.alert-message {
    margin-bottom: 20px;
}

.alert-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.alert-message p {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-top: 10px;
}

.alert-close {
    padding: 10px 30px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.3s;
}

.alert-close:hover {
    transform: translateY(-2px);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Edit and Delete buttons in table */
.col-actions {
    text-align: center;
    min-width: 80px;
}

.col-actions button {
    padding: 5px;
    margin: 0 2px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.col-actions .edit-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    color: #667eea;
}

.col-actions .delete-btn:hover {
    background: rgba(255, 71, 87, 0.2);
    border-color: #ff4757;
    color: #ff4757;
}

/* Board Table Styles */
.board-table {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    overflow: hidden;
}

.board-table-header {
    display: grid;
    grid-template-columns: 60px 1fr 120px 100px 80px;
    background: rgba(0, 212, 255, 0.1);
    padding: 10px 20px;
    font-weight: 600;
    color: var(--accent-blue);
    border-bottom: 1px solid var(--border-color);
}

.board-table-body {
    max-height: 600px;
    overflow-y: auto;
}

/* 모바일에서 스크롤 제거 */
@media (max-width: 768px) {
    .board-table-body {
        max-height: none !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        height: auto !important;
    }
}

.board-row {
    display: grid;
    grid-template-columns: 60px 1fr 120px 100px 80px;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s;
}

.board-row:hover {
    background: rgba(0, 212, 255, 0.05);
}

/* Private Row Styles */
.board-row.private-row {
    background: rgba(255, 255, 255, 0.02);
    opacity: 0.85;
}

.board-row.private-row:hover {
    background: rgba(0, 212, 255, 0.03);
    opacity: 1;
}

.private-title {
    color: rgba(255, 255, 255, 0.5) !important;
    font-style: italic;
}

.table-col {
    display: flex;
    align-items: center;
}

.col-num {
    justify-content: center;
    color: var(--text-muted);
}

.col-title {
    gap: 10px;
}

.post-title-text {
    color: var(--text-primary);
    font-weight: 500;
}

.board-row:hover .post-title-text {
    color: var(--accent-blue);
}

.col-author {
    color: var(--text-secondary);
}

.col-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.col-views {
    justify-content: center;
    color: var(--text-secondary);
}

.has-image {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Post Detail Modal */
.post-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.post-detail-modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    position: absolute;
    top: 20px;
    right: 20px;
    left: 20px;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-action-buttons {
    display: flex;
    gap: 10px;
}

.modal-action-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-action-btn:hover {
    transform: scale(1.05);
}

.modal-action-btn.edit-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    color: #667eea;
}

.modal-action-btn.delete-btn:hover {
    background: rgba(255, 68, 88, 0.1);
    border-color: #ff4458;
    color: #ff4458;
}

.modal-close {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(255, 68, 88, 0.1);
    border-color: #ff4458;
    color: #ff4458;
}

.modal-body {
    padding: 40px;
}

.detail-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.detail-title {
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 15px;
}

.detail-meta {
    display: flex;
    gap: 20px;
    align-items: center;
}

.detail-author {
    color: var(--accent-blue);
    font-weight: 600;
}

.detail-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.detail-views {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail-content {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 30px;
    min-height: 100px;
}

.detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 15px 0;
}

.detail-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.detail-images img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: block;
    object-fit: contain;
}

.detail-image {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}

.detail-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s;
}

.detail-image:hover img {
    transform: scale(1.05);
}

.detail-actions {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-btn.like-btn:hover {
    border-color: #ff4458;
    color: #ff4458;
    background: rgba(255, 68, 88, 0.1);
}

.action-btn.delete-btn:hover {
    border-color: #ff4458;
    color: #ff4458;
    background: rgba(255, 68, 88, 0.1);
}

/* Responsive Table */
@media (max-width: 768px) {
    .board-table-header {
        display: none;
    }
    
    .board-row {
        display: block;
        padding: 12px;
    }
    
    .board-row .table-col {
        display: block;
        padding: 5px 0;
    }
    
    .col-num::before {
        content: '번호: ';
        font-weight: 600;
    }
    
    .col-author::before {
        content: '작성자: ';
        font-weight: 600;
    }
    
    .col-date::before {
        content: '작성일: ';
        font-weight: 600;
    }
    
    .col-views::before {
        content: '조회수: ';
        font-weight: 600;
    }
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    gap: 5px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}

.editor-btn {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.editor-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.editor-btn.active {
    background: var(--accent-blue);
    color: var(--bg-primary);
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 5px;
}

/* Code formatting buttons */
.editor-btn.code-btn {
    min-width: 45px;
    font-family: 'JetBrains Mono', monospace;
}

.editor-btn.code-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    border-color: #8b5cf6;
}

.editor-btn.code-btn[data-language="html"]:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: #ef4444;
}

.editor-btn.code-btn[data-language="css"]:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-color: #3b82f6;
}

.editor-btn.code-btn[data-language="js"]:hover {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-color: #f59e0b;
}

.editor-btn.code-btn[data-language="python"]:hover {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-color: #22c55e;
}

/* Alignment buttons */
.editor-btn.align-btn {
    min-width: 32px;
}

.editor-btn.align-btn:hover {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
    border-color: #a855f7;
}

.editor-btn.align-btn.active {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
    border-color: #a855f7;
}

/* Content Editor */
.editor-content {
    min-height: 500px;
    max-height: 700px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 0 0 10px 10px;
    color: var(--text-primary);
    outline: none;
    line-height: 1.6;
    position: relative;
    resize: vertical;
    overflow: auto;
}

.editor-content:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

.editor-content:focus {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--accent-blue);
}

/* Editor scrollbar styling */
.editor-content::-webkit-scrollbar {
    width: 8px;
}

.editor-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.editor-content::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

.editor-content::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 5px 0;
    display: inline-block;
    object-fit: contain;
    cursor: pointer;
}

/* Image resize overlay */
.image-resize-overlay {
    z-index: 9999;
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.5);
}

.resize-handle {
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.resize-handle:hover {
    transform: scale(1.2);
}

.resize-handle-nw { cursor: nw-resize; }
.resize-handle-ne { cursor: ne-resize; }
.resize-handle-sw { cursor: sw-resize; }
.resize-handle-se { cursor: se-resize; }

.resize-size-display {
    z-index: 10000;
    user-select: none;
    pointer-events: none;
}

/* Prevent image selection during resize */
.editor-content img.resizing {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* YouTube embed styles removed - YouTube URLs now use link previews */

/* Link Preview Styles in Editor */
.editor-content .link-preview {
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    background: rgba(255,255,255,0.03);
    display: block;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.editor-content .link-preview:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.2);
}

.editor-content .link-preview-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-content .link-preview .preview-image {
    flex-shrink: 0;
}

.editor-content .link-preview .preview-image img {
    width: 100px !important;
    height: 75px !important;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.editor-content .preview-content {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.editor-content .preview-title {
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95em;
}

.editor-content .preview-description {
    color: rgba(255,255,255,0.6);
    font-size: 0.85em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Image Layout Selector */
.image-layout-selector {
    display: inline-flex;
    gap: 5px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-left: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.layout-btn {
    padding: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-blue);
}

.layout-btn.active {
    background: rgba(102, 126, 234, 0.2);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Image Preview */
.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    min-height: 100px;
    display: none;
}

.image-preview.has-images {
    display: flex;
}

.image-preview-item {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
    animation: fadeIn 0.3s;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    background: rgba(255, 59, 48, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.image-preview-item:hover .remove-btn {
    opacity: 1;
}

.image-preview-item.uploading {
    position: relative;
}

.image-preview-item.uploading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--accent-blue);
    transition: width 0.3s;
}

/* Board Post with Images */
.post-images {
    margin: 15px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.post-image {
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: transform 0.3s;
}

.post-image:hover {
    transform: scale(1.02);
}

.post-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Single image - larger display */
.post-images.single-image {
    grid-template-columns: 1fr;
}

.post-images.single-image .post-image img {
    height: 400px;
}

/* Image Lightbox */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.image-lightbox.show {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Formatting styles for editor content */
.post-content {
    line-height: 1.8;
}

.post-content img {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 15px 0;
    display: block;
    object-fit: contain;
}

/* Image Layout Styles */
.image-gallery {
    margin: 10px 0;
    clear: both;
    contain: layout;
    display: block;
}

.image-gallery.layout-single img {
    width: 100%;
    margin-bottom: 10px;
}

.image-gallery.layout-double {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 100%;
}

.image-gallery.layout-double > img {
    width: 100%;
    height: auto;
    border-radius: 10px;
}

.image-gallery.layout-triple {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 100%;
}

.image-gallery.layout-triple > img {
    width: 100%;
    height: auto;
    border-radius: 10px;
}

/* Image layout wrapper to isolate grid layouts */
.image-layout-wrapper {
    display: block;
    width: 100%;
    margin: 20px 0;
    clear: both;
    position: relative;
}

.image-layout-wrapper[contenteditable="false"] {
    user-select: none;
}

.image-layout-wrapper .image-gallery {
    pointer-events: auto;
}

.image-layout-wrapper button,
.image-layout-wrapper .slider-controls,
.image-layout-wrapper .slider-nav {
    pointer-events: auto !important;
}

/* Editor break to ensure proper text flow */
.editor-break {
    display: block;
    width: 100%;
    min-height: 1px;
    clear: both;
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Ensure text after image galleries is not affected */
.image-gallery + * {
    clear: both;
    width: 100%;
    display: block;
}

/* Puzzle/Masonry Layout - 4 images */
.image-gallery.layout-masonry {
    display: grid;
    gap: 10px;
    aspect-ratio: 1;
    max-width: 600px;
    margin: 20px auto;
}

.image-gallery.layout-masonry.puzzle-4 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.image-gallery.layout-masonry.puzzle-4 .puzzle-item {
    overflow: hidden;
    border-radius: 10px;
}

.image-gallery.layout-masonry.puzzle-4 .puzzle-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-gallery.layout-masonry.puzzle-4 .puzzle-item img:hover {
    transform: scale(1.05);
}

/* Puzzle Layout - 5 images */
.image-gallery.layout-masonry.puzzle-5 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.image-gallery.layout-masonry.puzzle-5 .puzzle-item-1 {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
}

.image-gallery.layout-masonry.puzzle-5 .puzzle-item-2 {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
}

.image-gallery.layout-masonry.puzzle-5 .puzzle-item-3 {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}

.image-gallery.layout-masonry.puzzle-5 .puzzle-item-4 {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.image-gallery.layout-masonry.puzzle-5 .puzzle-item-5 {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
}

.image-gallery.layout-masonry.puzzle-5 .puzzle-item {
    overflow: hidden;
    border-radius: 10px;
}

.image-gallery.layout-masonry.puzzle-5 .puzzle-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-gallery.layout-masonry.puzzle-5 .puzzle-item img:hover {
    transform: scale(1.05);
}

.image-gallery.layout-slider {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    max-width: 100%;
    min-height: 400px;
    height: 60vh;
    max-height: 600px;
    background: rgba(0, 0, 0, 0.1);
}

.image-gallery.layout-slider .slider-container {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
    transform: translateX(0);
}

.image-gallery.layout-slider .slider-image-wrapper {
    min-width: 100%;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-gallery.layout-slider .slider-image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.image-gallery.layout-slider .slider-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.image-gallery.layout-slider .slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.image-gallery.layout-slider .slider-dot.active {
    background: white;
}

.image-gallery.layout-slider .slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.image-gallery.layout-slider .slider-nav:hover {
    opacity: 0.8;
}

.image-gallery.layout-slider .prev {
    left: 20px;
}

.image-gallery.layout-slider .next {
    right: 20px;
}

@media (max-width: 768px) {
    .image-gallery.layout-triple {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .image-gallery.layout-masonry {
        columns: 2;
    }
}

@media (max-width: 480px) {
    .image-gallery.layout-double,
    .image-gallery.layout-triple {
        grid-template-columns: 1fr;
    }
    
    .image-gallery.layout-masonry {
        columns: 1;
    }
}

.post-content strong {
    font-weight: 600;
    color: var(--accent-blue);
}

.post-content em {
    font-style: italic;
}

.post-content u {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .board-container {
        padding: 0 15px;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .board-section {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .editor-toolbar {
        flex-wrap: wrap;
        position: relative;
        top: auto;
    }
    
    .new-post-form {
        max-height: none;
    }
    
    .editor-content {
        max-height: 500px;
        min-height: 400px;
    }
    
    .post-images {
        grid-template-columns: 1fr;
    }
    
    .post-image img {
        height: 250px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Image Library Modal */
.image-library-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    z-index: 9999;
}

.image-library-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-library-content {
    background: var(--bg-primary);
    border-radius: 15px;
    width: 90%;
    max-width: 1200px;
    max-height: 80vh; /* 화면 높이의 80%로 제한 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.image-library-header {
    padding: 15px 20px; /* 패딩 줄임 */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* 헤더가 줄어들지 않도록 */
}

.image-library-title {
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.image-library-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.image-library-close:hover {
    background: rgba(255, 71, 87, 0.2);
    border-color: #ff4757;
}

.image-library-body {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 15px;
    min-height: 0; /* flexbox 스크롤 해결 */
    max-height: calc(80vh - 150px) !important; /* 헤더와 푸터 높이 제외 */
}

.image-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    grid-auto-rows: 150px; /* 고정 높이 */
    padding: 5px;
    width: 100%;
    box-sizing: border-box;
}

.library-image-item {
    position: relative;
    width: 100%;
    height: 150px !important; /* 명시적 높이 설정 */
    max-height: 150px !important;
    border-radius: 8px;
    overflow: hidden !important;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.library-image-item:hover {
    transform: scale(1.05);
    border-color: var(--accent-blue);
}

.library-image-item.selected {
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
}

.library-image-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block;
}

.library-image-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.library-image-item.selected .library-image-checkbox {
    display: flex;
    background: var(--accent-purple);
}

.library-image-checkbox::after {
    content: '✓';
    color: white;
    font-weight: bold;
}

.image-library-footer {
    padding: 15px 20px; /* 패딩 줄임 */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* 푸터가 줄어들지 않도록 */
}

.selected-count {
    color: #999;
}

.library-action-buttons {
    display: flex;
    gap: 10px;
}

.library-insert-btn {
    background: var(--accent-gradient);
    color: white;
    padding: 10px 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.library-insert-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.library-insert-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.library-browse-btn {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.library-browse-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

/* Image Figure and Caption Styles */
figure.single-image-figure,
figure.grid-image-figure {
    margin: 0;
    padding: 0;
    position: relative;
}

figure.grid-image-figure {
    width: 100%;
    height: 100%;
}

.image-caption {
    text-align: center;
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 8px;
    padding: 0 10px;
}

.image-gallery.layout-double figure,
.image-gallery.layout-triple figure {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.image-gallery.layout-double figure img,
.image-gallery.layout-triple figure img {
    flex: 1;
    object-fit: cover;
    width: 100%;
    height: auto;
    min-height: 200px;
}

.slider-image-wrapper .image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 15px;
    font-style: normal;
    font-size: 0.9rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Puzzle layout captions */
.puzzle-item {
    position: relative;
}

.puzzle-item .image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px;
    font-size: 0.8rem;
    display: none;
}

.puzzle-item:hover .image-caption {
    display: block;
}

/* 인기 게시물 섹션 */
.popular-posts-section {
    border-radius: 15px;
}

.popular-posts-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 30px;
    padding: 0 20px;
    text-align: center;
}

.popular-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    padding: 0 20px;
}

.popular-post-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(103, 126, 234, 0.2);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    position: relative;
}

.popular-post-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(103, 126, 234, 0.4);
    box-shadow: 0 15px 40px rgba(103, 126, 234, 0.3);
}

.popular-post-thumbnail {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
}

.popular-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.popular-post-card:hover .popular-post-thumbnail img {
    transform: scale(1.08);
}

.popular-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-purple);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.popular-post-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.popular-post-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popular-post-card-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    min-height: 63px;
}

.popular-post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.popular-post-date {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.popular-post-stats {
    display: flex;
    gap: 12px;
}

.popular-post-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.popular-post-stats svg {
    width: 14px;
    height: 14px;
}

/* 태블릿 반응형 */
@media (max-width: 1024px) {
    .popular-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .popular-posts-section {
    }
    
    .popular-posts-title {
        font-size: 1.2rem;
        padding: 0 15px;
    }
    
    .popular-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 15px;
    }
    
    .popular-post-thumbnail {
        height: 180px;
    }
    
    .popular-post-info {
        padding: 15px;
    }
    
    .popular-post-card-title {
        font-size: 1rem;
    }
    
    .popular-post-card-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        min-height: 42px;
    }
}