/* ===================================
   Elancer 블로그 글쓰기/수정 에디터
   =================================== */

/* A-RMS 스타일 오버라이드 - 강제로 블로그 스타일 적용 */
body {
    background: #f8f8f7 !important;
    color: #333 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* A-RMS 전역 스타일 오버라이드 - contenteditable 요소 보호 */
[contenteditable="true"] {
    caret-color: #333 !important;
    cursor: text !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

[contenteditable="true"]:focus {
    caret-color: #007bff !important;
    cursor: text !important;
    outline: none !important;
}

.content {
    background: #f8f8f7 !important;
}

.wrap {
    background: #f8f8f7 !important;
}

/* 전체 컨테이너 */
.blog-editor-container {
    min-height: 100vh !important;
    background: #f8f8f7 !important;
}

/* 헤더 영역 - 블로그 상세와 동일 */
.blog-header {
    border-bottom: 1px solid #e0e0e0 !important;
    width: 100% !important;
    background: #f8f8f7 !important;
}

.blog-header .container {
    max-width: 1200px !important;
}

.header-logo {
    height: 32px !important;
    width: auto !important;
}

.blog-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-top: 5px !important;
}

.header-actions {
    margin-top: 5px !important;
}

.header-actions .btn {
    padding: 6px 12px !important;
    font-size: 13px !important;
    border-radius: 4px !important;
    transition: all 0.3s ease !important;
    background: #f8f8f7 !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
}

.header-actions .btn:hover {
    background: #efefef !important;
    border-color: #ccc !important;
}

.header-actions .btn-primary {
    background: #007bff !important;
    border-color: #007bff !important;
    color: white !important;
}

.header-actions .btn-success {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

/* 메인 에디터 - 블로그 상세와 동일 */
.main-editor {
    max-width: 800px !important;
    margin: 0 auto !important;
    padding: 40px 20px !important;
    background: #f8f8f7 !important;
    overflow: hidden !important;
}

.main-editor .container {
    max-width: 100% !important;
    overflow: hidden !important;
    background: #f8f8f7 !important;
}

/* 기본 정보 입력 영역 */
.editor-basic-info {
    padding-bottom: 15px !important;
    background: #f8f8f7 !important;
}

.form-group {
    margin-bottom: 15px !important;
    position: relative !important;
}

.form-group label {
    color: #333 !important;
    font-weight: 500 !important;
    margin-bottom: 6px !important;
    display: block !important;
}

.form-control {
    /*background: white !important;  !* 입력 필드는 흰색 유지 *!*/
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    color: #333 !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
}

/* select 요소 전용 스타일 - A-RMS 오버라이드 */
#category-select,
select.form-control {
    appearance: auto !important;
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
    /*background: white !important;*/
    background-image: none !important;
    /*background-color: white !important;*/
    color: #333 !important;
    height: auto !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    width: 33.333% !important;
    max-width: 200px !important;
}

/* select의 선택된 옵션 텍스트가 보이도록 강제 */
#category-select option,
select.form-control option {
    background: white !important;
    color: #333 !important;
    padding: 8px !important;
}

.form-control:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* 제목 입력 */
.title-input {
    box-sizing: border-box;
    width: 100% !important;
    padding: 21px 15px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #333 !important;
    outline: none;
    transition: all 0.3s ease;
    background: inherit;
}

.title-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.title-input::placeholder {
    color: #999;
    font-weight: 400;
}

.char-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #999;
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 메타 정보는 Bootstrap 그리드 사용 - CSS 불필요 */

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
}

/* 태그 입력 */
.tags-container {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.tag-remove {
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.tag-remove:hover {
    opacity: 1;
}

.help-text {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}

/* 대표 이미지 업로드 */
.featured-image-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #f0f0f0;
}

.featured-image-section label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.image-upload-area {
    position: relative !important;
    border: 2px dashed #d0d0d0 !important;
    border-radius: 8px !important;
    padding: 40px 20px !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    background: #efefef !important; /* 배경과 구분되도록 약간 어둡게 */
}

.image-upload-area:hover {
    border-color: #007bff !important;
    background: #f8f9ff !important;
}

.upload-placeholder i {
    font-size: 32px !important;
    color: #999 !important;
    margin-bottom: 12px !important;
}

.upload-placeholder p {
    margin: 0 0 8px 0 !important;
    font-size: 16px !important;
    color: #333 !important;
}

.file-info {
    font-size: 12px !important;
    color: #666 !important;
}

.image-preview {
    position: relative !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    max-width: 400px !important;
    margin: 0 auto !important;
}

/* .image-preview img 스타일은 Bootstrap .img-responsive 클래스로 대체됨 */

.remove-image {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    padding: 6px 8px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: background 0.3s ease !important;
}

.remove-image:hover {
    background: rgba(220, 53, 69, 0.8) !important;
}

/* 본문 에디터 */
.content-editor-section {
    margin-bottom: 40px !important;
}

.content-editor-section label {
    display: block !important;
    margin-bottom: 12px !important;
    font-weight: 500 !important;
    color: #333 !important;
    font-size: 14px !important;
}

/* 에디터 툴바 */
.editor-toolbar {
    display: flex !important;
    gap: 16px !important;
    padding: 12px 16px !important;
    background: #efefef !important; /* 툴바는 약간 어둡게 */
    border: 1px solid #e0e0e0 !important;
    border-bottom: none !important;
    border-radius: 8px 8px 0 0 !important;
    flex-wrap: wrap !important;
}

.toolbar-group {
    display: flex !important;
    gap: 4px !important;
}

.toolbar-btn {
    padding: 8px 10px !important;
    border: 1px solid transparent !important;
    background: transparent !important;
    color: #666 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-size: 13px !important;
    min-width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.toolbar-btn:hover {
    background: white !important;
    border-color: #d0d0d0 !important;
    color: #333 !important;
}

.toolbar-btn.active {
    background: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
}

/* 에디터 컨테이너 */
.editor-container {
    position: relative !important;
    background: #f8f8f7 !important;
}

.editor-content {
    min-height: 400px !important;
    padding: 20px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 0 0 8px 8px !important;
    outline: none !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
    color: #333 !important;
    background: white !important; /* 입력 영역은 흰색 유지 */
    overflow-y: auto !important;

    /* 텍스트 커서 강제 표시 */
    caret-color: #333 !important;
    cursor: text !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

.editor-content:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1) !important;

    /* 포커스시 커서 강제 표시 */
    caret-color: #007bff !important;
    cursor: text !important;
}

.editor-content:empty::before {
    content: attr(placeholder) !important;
    color: #999 !important;
    font-style: italic !important;
}

.editor-content h2 {
    font-size: 24px !important;
    font-weight: 600 !important;
    margin: 24px 0 12px 0 !important;
    color: #333 !important;
}

.editor-content h3 {
    font-size: 20px !important;
    font-weight: 500 !important;
    margin: 20px 0 10px 0 !important;
    color: #333 !important;
}

.editor-content p {
    margin: 0 0 12px 0 !important;
}

.editor-content ul, .editor-content ol {
    margin: 12px 0 !important;
    padding-left: 24px !important;
}

.editor-content img {
    /* max-width, height는 .img-responsive에서 제공 */
    border-radius: 4px !important;
    margin: 12px 0 !important;
}

/* 에디터 통계 */
.editor-stats {
    margin-top: 8px !important;
    font-size: 12px !important;
    color: #666 !important;
}

/* 해시태그 섹션 */
.hashtag-section {
    margin-top: 30px !important;
    padding: 20px !important;
    background-color: #efefef !important; /* 약간 어두운 배경으로 구분 */
    border-radius: 6px !important;
    border: 1px solid #e3e3e3 !important;
}

.hashtag-section .form-group {
    margin-bottom: 0 !important;
}

#hashtag-input {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    padding: 12px 15px !important;
    font-size: 14px !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

#hashtag-input:focus {
    border-color: #66afe9 !important;
    outline: 0 !important;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6) !important;
}

.hashtag-container {
    margin-top: 15px !important;
    min-height: 40px !important;
    padding: 10px !important;
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.hashtag-item {
    display: inline-flex !important;
    align-items: center !important;
    background-color: #e7f3ff !important;
    color: #0066cc !important;
    padding: 6px 12px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    border: 1px solid #b3d9ff !important;
    transition: all 0.2s ease !important;
}

.hashtag-item:hover {
    background-color: #d0e9ff !important;
    border-color: #80c1ff !important;
}

.hashtag-remove {
    margin-left: 8px !important;
    cursor: pointer !important;
    font-weight: bold !important;
    color: #666 !important;
    font-size: 14px !important;
    line-height: 1 !important;
}

.hashtag-remove:hover {
    color: #d9534f !important;
}

.hashtag-section .help-text {
    color: #777 !important;
    font-size: 12px !important;
    margin-top: 10px !important;
    display: block !important;
}

/* 하단 액션 바 */
.editor-footer {
    position: sticky !important;
    bottom: 0 !important;
    background: #f8f8f7 !important;
    border-top: 1px solid #e0e0e0 !important;
    padding: 16px 0 !important;
    margin-top: 40px !important;
}

.footer-actions {
    padding: 16px 20px !important;
}

/* Bootstrap pull-right 클래스 강제 적용 */
.footer-actions .pull-right {
    float: right !important;
}

.footer-actions .pull-left {
    float: left !important;
}

/* clearfix 강제 적용 */
.footer-actions.clearfix:after {
    content: "" !important;
    display: table !important;
    clear: both !important;
}

.btn-link {
    background: none !important;
    border: none !important;
    color: #007bff !important;
    text-decoration: none !important;
    padding: 8px 12px !important;
    border-radius: 4px !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
}

.btn-link:hover {
    background: #f8f9ff !important;
    text-decoration: none !important;
}

/* 모든 에디터 버튼 강제 스타일 */
.editor-footer .btn {
    background: white !important; /* 버튼은 흰색 유지 */
    border: 1px solid #ddd !important;
    color: #333 !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
}

.editor-footer .btn-primary {
    background: #007bff !important;
    border-color: #007bff !important;
    color: white !important;
}

.editor-footer .btn-success {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.editor-footer .btn-info {
    background: #17a2b8 !important;
    border-color: #17a2b8 !important;
    color: white !important;
}

/* 업로드 진행 상황 */
.upload-progress {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: white !important;
    padding: 20px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    z-index: 9999 !important;
    min-width: 300px !important;
    text-align: center !important;
}

.progress-bar {
    width: 100% !important;
    height: 8px !important;
    background: #f0f0f0 !important;
    border-radius: 4px !important;
    margin-bottom: 10px !important;
    overflow: hidden !important;
}

.progress-fill {
    height: 100% !important;
    background: #007bff !important;
    border-radius: 4px !important;
    transition: width 0.3s ease !important;
    width: 0% !important;
}

.progress-text {
    font-size: 14px !important;
    color: #666 !important;
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .header-logo {
        height: 28px;
    }

    .blog-title {
        font-size: 16px;
    }

    .header-actions .btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    .main-editor {
        padding: 20px 16px;
    }

    .title-input {
        font-size: 20px;
        padding: 12px 16px;
    }

    .editor-toolbar {
        padding: 8px 12px;
        gap: 8px;
    }

    .toolbar-group {
        gap: 2px;
    }

    .toolbar-btn {
        padding: 6px 8px;
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .editor-content {
        min-height: 300px;
        padding: 16px;
        font-size: 15px;
    }

    .footer-actions .pull-left,
    .footer-actions .pull-right {
        float: none !important;
        text-align: center;
        margin-bottom: 12px;
    }

    .upload-progress {
        min-width: 280px;
        margin: 0 16px;
    }
}

@media (max-width: 480px) {
    .blog-title {
        font-size: 16px;
    }

    .header-actions .btn span {
        display: none;
    }

    .title-input {
        font-size: 18px;
    }

    .image-upload-area {
        padding: 30px 16px;
    }

    .upload-placeholder i {
        font-size: 24px;
    }

    .upload-placeholder p {
        font-size: 14px;
    }
}


/* 영역 미리보기 */
#preview img {
    width: 200px;
    height: 200px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    background: #f9f9f9;
}

.input-info-label {
    padding: 5px 12px;
    font-size: 0.875rem !important;
    font-weight: bold;
}

.input-info-label span {
    color: #f56c6c;
    font-weight: bold;
}

.input-error-message {
    margin-top: 4px;
    padding: 5px 12px;
    color: #f56c6c;
    font-size: 13px;
    font-weight: bold;
}

.upload-area {
    display: flex;
    gap: 10px;
    background-color: #e7e7e7;
}


.upload-button {
    margin-right: auto;
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    background-color: #313131 !important;
    border-color: #313131;
    border-radius: 4px;
}

.upload-button:hover {
    color: lightgrey;
    background-color: #454545 !important;
}

#footer-cancel-btn, #footer-publish-btn {
    font-weight: 500;
    font-size: 0.9375rem;
}