/* 게시판 에디터 스타일 */

.editor-wrapper {
    border: 1px solid var(--border2);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
    position: relative;
}

#editor-container {
    min-height: 400px;
    background: var(--bg);
    color: var(--text-color);
}

/* Quill 에디터 툴바 스타일 */
.ql-toolbar {
    background: var(--light-gray);
    border: none !important;
    border-bottom: 1px solid var(--border2) !important;
    padding: 12px 10px;
}

.ql-toolbar button {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.ql-toolbar button:hover {
    background: var(--bg);
}

.ql-toolbar button.ql-active {
    background: var(--bg);
}

.ql-toolbar .ql-stroke {
    stroke: var(--editor-btn-color);
    stroke-width: 2;
}

.ql-toolbar .ql-stroke:hover,
.ql-toolbar button:hover .ql-stroke {
    stroke: var(--color-primary);
}

.ql-toolbar .ql-fill {
    fill: var(--editor-btn-color);
}

.ql-toolbar .ql-fill:hover,
.ql-toolbar button:hover .ql-fill {
    fill: var(--color-primary);
}

.ql-toolbar button.ql-active .ql-stroke {
    stroke: var(--color-primary);
}

.ql-toolbar button.ql-active .ql-fill {
    fill: var(--color-primary);
}

/* 드롭다운 라벨 */
.ql-toolbar .ql-picker-label {
    color: var(--editor-btn-color);
    border: 1px solid var(--border2);
    border-radius: 4px;
    padding: 4px 8px;
}

.ql-toolbar .ql-picker-label:hover {
    background: var(--bg);
    color: var(--color-primary);
}

.ql-toolbar .ql-picker-label .ql-stroke {
    stroke: var(--editor-btn-color);
}

.ql-toolbar .ql-picker-label:hover .ql-stroke {
    stroke: var(--color-primary);
}

/* 에디터 컨테이너 */
.ql-container {
    border: none !important;
    font-size: 1em;
}

.ql-editor {
    padding: 20px;
    min-height: 400px;
    line-height: 1.8;
}

.ql-editor.ql-blank::before {
    color: var(--gray);
    font-style: normal;
}

.ql-editor p,
.ql-editor ol,
.ql-editor ul {
    margin-bottom: 1em;
}

.ql-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em 0;
}

.ql-editor h1 {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 0.5em;
}

.ql-editor h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 0.5em;
}

.ql-editor h3 {
    font-size: 1.17em;
    font-weight: bold;
    margin-bottom: 0.5em;
}

.ql-editor a {
    color: var(--color-primary);
    text-decoration: underline;
}

/* 드롭다운 스타일 */
.ql-snow .ql-picker {
    color: var(--text-color);
}

.ql-snow .ql-picker-options {
    background: var(--bg);
    border: 1px solid var(--border2);
    z-index: 1000;
}

.ql-snow .ql-picker-item:hover {
    background: var(--light-gray);
}

/* 링크 툴팁 스타일 */
.ql-snow .ql-tooltip {
    background: var(--bg);
    border: 1px solid var(--border2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: var(--text-color);
    padding: 10px 12px;
    z-index: 1000;
}

.ql-snow .ql-tooltip input[type=text] {
    background: var(--input-bg);
    border: 1px solid var(--border2);
    color: var(--text-color);
    padding: 6px 10px;
    border-radius: 4px;
}

.ql-snow .ql-tooltip input[type=text]:focus {
    border-color: var(--color-primary);
    outline: none;
}

.ql-snow .ql-tooltip a.ql-action,
.ql-snow .ql-tooltip a.ql-remove {
    color: var(--color-primary);
}

.ql-snow .ql-tooltip a.ql-action:hover,
.ql-snow .ql-tooltip a.ql-remove:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* 게시글 본문 표시 스타일 */
.board-content {
    line-height: 1.8;
    word-break: break-word;
}

.board-content p {
    margin-bottom: 1em;
}

.board-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em 0;
}

.board-content h1 {
    font-size: 2em;
    font-weight: bold;
    margin: 1em 0 0.5em;
}

.board-content h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 1em 0 0.5em;
}

.board-content h3 {
    font-size: 1.17em;
    font-weight: bold;
    margin: 1em 0 0.5em;
}

.board-content ul,
.board-content ol {
    margin-left: 2em;
    margin-bottom: 1em;
}

.board-content ul li {
    list-style-type: disc;
}

.board-content ol li {
    list-style-type: decimal;
}

.board-content a {
    color: var(--color-primary);
    text-decoration: underline;
}

.board-content a:hover {
    text-decoration: none;
}

.board-content strong {
    font-weight: bold;
}

.board-content em {
    font-style: italic;
}

.board-content u {
    text-decoration: underline;
}

.board-content s {
    text-decoration: line-through;
}

/* 이미지 업로드 모달 */
.image-upload-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.image-upload-modal.active {
    display: flex;
}

.image-upload-content {
    background: var(--bg);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.image-upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.image-upload-header h3 {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-color);
}

.image-upload-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--gray);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.image-upload-close:hover {
    background: var(--light-gray);
    color: var(--text-color);
}

.image-drop-zone {
    border: 2px dashed var(--border2);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
    background: var(--input-bg);
}

.image-drop-zone:hover {
    border-color: var(--color-primary);
    background: var(--light-gray);
}

.image-drop-zone.drag-over {
    border-color: var(--color-primary);
    background: var(--light-gray);
}

.image-drop-zone p {
    color: var(--gray);
    margin: 10px 0;
}

.image-drop-zone .upload-icon {
    font-size: 3em;
    color: var(--gray);
    margin-bottom: 10px;
}

.image-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.image-preview-item {
    position: relative;
    border: 2px solid var(--border2);
    border-radius: 8px;
    overflow: hidden;
    background: var(--input-bg);
    cursor: move;
    transition: all 0.2s;
}

.image-preview-item:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.image-preview-item.dragging {
    opacity: 0.5;
}

.image-preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.image-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.image-preview-remove:hover {
    background: var(--color-primary);
}

.image-upload-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.image-upload-actions .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s;
}

.image-upload-actions .btn-cancel {
    background: var(--light-gray);
    color: var(--text-color);
}

.image-upload-actions .btn-cancel:hover {
    background: var(--border2);
}

.image-upload-actions .btn-upload {
    background: var(--color-primary);
    color: #fff;
}

.image-upload-actions .btn-upload:hover {
    opacity: 0.9;
}

/* 반응형 */
@media (max-width: 600px) {
    .ql-editor {
        padding: 15px;
        min-height: 300px;
    }

    #editor-container {
        min-height: 300px;
    }

    .ql-toolbar {
        padding: 8px 5px;
    }

    .image-upload-content {
        padding: 20px;
    }

    .image-preview-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .image-preview-item img {
        height: 100px;
    }
}
