/**
 * Editor.js 콘텐츠 스타일
 * PENGSU Blog용 - Modern & Clean Design
 */

/* ===== 에디터 컨테이너 ===== */
#editorjs {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    min-height: 400px;
    padding: 20px;
}

#editorjs .codex-editor__redactor {
    padding-bottom: 100px !important;
}

/* ===== 콘텐츠 영역 스타일 (게시글 표시용) ===== */
.editorjs-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
    font-size: 16px;
    line-height: 1.75;
    color: #374151;
}

/* 제목 스타일 */
.editorjs-content h1 {
    font-size: 1.875em;
    font-weight: 700;
    margin: 1.5em 0 0.75em;
    color: #111827;
    letter-spacing: -0.02em;
}

.editorjs-content h2 {
    background: linear-gradient(to right, rgb(40, 167, 69), rgb(30, 126, 52));
    border-radius: 10px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    color: white;
    font-size: 22px;
    font-weight: 700;
    margin: 30px 0 15px;
    padding: 10px 25px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.editorjs-content h2 * {
    color: inherit;
}

.editorjs-content h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 1.2em 0 0.5em;
    color: #374151;
}

.editorjs-content h4 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 1em 0 0.4em;
    color: #4b5563;
}

/* 문단 스타일 */
.editorjs-content p {
    margin: 0 0 1em;
}

/* 링크 스타일 */
.editorjs-content a {
    color: #2563eb;
    text-decoration: none;
}

.editorjs-content a:hover {
    text-decoration: underline;
}

/* 리스트 스타일 */
.editorjs-content ul,
.editorjs-content ol {
    margin: 0.75em 0;
    padding-left: 1.75em;
}

.editorjs-content li {
    margin: 0.35em 0;
    line-height: 1.6;
}

.editorjs-content ul li {
    list-style-type: disc;
}

.editorjs-content ol li {
    list-style-type: decimal;
}

.editorjs-content ul ul,
.editorjs-content ol ol {
    margin: 0.25em 0;
}

/* 체크리스트 */
.editorjs-content .editorjs-checklist {
    list-style: none;
    padding-left: 0;
}

.editorjs-content .editorjs-checklist li {
    position: relative;
    padding-left: 28px;
    margin: 0.4em 0;
}

.editorjs-content .editorjs-checklist li .checkbox {
    position: absolute;
    left: 0;
    top: 3px;
    width: 16px;
    height: 16px;
    border: 1.5px solid #9ca3af;
    border-radius: 3px;
    display: inline-block;
}

.editorjs-content .editorjs-checklist li.checked .checkbox {
    background: #10b981;
    border-color: #10b981;
}

.editorjs-content .editorjs-checklist li.checked .checkbox::after {
    content: '✓';
    color: #fff;
    font-size: 11px;
    position: absolute;
    left: 2px;
    top: -1px;
}

.editorjs-content .editorjs-checklist li.checked {
    color: #9ca3af;
    text-decoration: line-through;
}

/* 인용문 스타일 - 컴팩트 */
.editorjs-content blockquote,
.editorjs-content .editorjs-quote {
    margin: 0.75em 0;
    padding: 0.5em 1em;
    background: #f9fafb;
    border-left: 3px solid #d1d5db;
    border-radius: 0 4px 4px 0;
}

.editorjs-content blockquote p,
.editorjs-content .editorjs-quote p {
    margin: 0;
    font-size: 0.95em;
    color: #4b5563;
    line-height: 1.6;
}

.editorjs-content blockquote cite,
.editorjs-content .editorjs-quote cite {
    display: block;
    margin-top: 0.5em;
    font-size: 0.85em;
    color: #6b7280;
    font-style: normal;
}

.editorjs-content blockquote cite::before,
.editorjs-content .editorjs-quote cite::before {
    content: '— ';
}

/* 코드 블록 스타일 */
.editorjs-content pre {
    margin: 1em 0;
    padding: 1em;
    background: #1f2937;
    border-radius: 6px;
    overflow-x: auto;
}

.editorjs-content pre code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875em;
    line-height: 1.6;
    color: #e5e7eb;
    background: none;
    padding: 0;
}

/* 인라인 코드 */
.editorjs-content code {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.875em;
    background: #f3f4f6;
    color: #dc2626;
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

/* 구분선 */
.editorjs-content hr,
.editorjs-content .editorjs-delimiter {
    border: none;
    margin: 1.5em 0;
    border-top: 1px solid #e5e7eb;
}

.editorjs-content hr::before,
.editorjs-content .editorjs-delimiter::before {
    content: none;
}

/* 이미지 스타일 */
.editorjs-content figure,
.editorjs-content .editorjs-image {
    margin: 1.5em 0;
    text-align: center;
}

.editorjs-content figure img,
.editorjs-content .editorjs-image img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.editorjs-content figure.with-border img,
.editorjs-content .editorjs-image.with-border img {
    border: 1px solid #e5e7eb;
}

.editorjs-content figure.stretched img,
.editorjs-content .editorjs-image.stretched img {
    width: 100%;
}

.editorjs-content figure.with-background,
.editorjs-content .editorjs-image.with-background {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
}

.editorjs-content figcaption,
.editorjs-content .editorjs-image figcaption {
    margin-top: 0.5em;
    font-size: 0.875em;
    color: #6b7280;
}

/* 임베드 스타일 */
.editorjs-content .editorjs-embed {
    margin: 1.5em 0;
    text-align: center;
}

.editorjs-content .editorjs-embed iframe {
    max-width: 100%;
    border-radius: 6px;
}

.editorjs-content .editorjs-embed .caption {
    margin-top: 0.5em;
    font-size: 0.875em;
    color: #6b7280;
}

/* 테이블 스타일 - 미니멀 */
.editorjs-content table:not(.stock-chart-container table),
.editorjs-content .editorjs-table {
    width: 100%;
    margin: 1em 0;
    border-collapse: collapse;
    font-size: 0.9em;
}

/* 주식 차트 내부 테이블 스타일 리셋 */
.stock-chart-container table,
.stock-chart-container td {
    padding: 0 !important;
    border: none !important;
    font-size: inherit !important;
    vertical-align: initial !important;
}

.editorjs-content table:not(.stock-chart-container table) th,
.editorjs-content table:not(.stock-chart-container table) td,
.editorjs-content .editorjs-table th,
.editorjs-content .editorjs-table td {
    padding: 10px 12px !important;
    border: 1px solid #e5e7eb !important;
    text-align: left;
    vertical-align: middle !important;
}

.editorjs-content table th,
.editorjs-content .editorjs-table th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
}

.editorjs-content table tbody tr:hover,
.editorjs-content .editorjs-table tbody tr:hover {
    background: #f9fafb;
}

.editorjs-content table th p,
.editorjs-content table td p,
.editorjs-content .editorjs-table th p,
.editorjs-content .editorjs-table td p {
    margin: 0 !important;
}

/* 경고 블록 */
.editorjs-content .editorjs-warning {
    margin: 1em 0;
    padding: 0.75em 1em;
    background: #fefce8;
    border-left: 3px solid #eab308;
    border-radius: 0 4px 4px 0;
}

.editorjs-content .editorjs-warning h4 {
    margin: 0 0 0.3em;
    color: #a16207;
    font-size: 0.95em;
}

.editorjs-content .editorjs-warning p {
    margin: 0;
    color: #713f12;
    font-size: 0.9em;
}

/* 마커 (형광펜) */
.editorjs-content mark {
    background: #fef08a;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

/* Strong/Bold */
.editorjs-content strong {
    font-weight: 600;
    color: #1f2937;
}

/* 반응형 */
@media (max-width: 768px) {
    .editorjs-content {
        font-size: 15px;
    }

    .editorjs-content h1 {
        font-size: 1.5em;
    }

    .editorjs-content h2 {
        font-size: 1.3em;
    }

    .editorjs-content h3 {
        font-size: 1.15em;
    }

    .editorjs-content pre {
        padding: 0.75em;
        font-size: 0.8em;
    }

    .editorjs-content table {
        font-size: 0.8em;
    }

    .editorjs-content table th,
    .editorjs-content table td {
        padding: 8px;
    }
}

/* ===== 에디터 UI 커스텀 ===== */
.ce-toolbar__plus {
    color: #6b7280 !important;
}

.ce-toolbar__settings-btn {
    color: #6b7280 !important;
}

.ce-block--selected .ce-block__content {
    background: #f3f4f6;
}

.ce-inline-toolbar {
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ce-conversion-toolbar {
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========================================
   테마 X-ray 스타일
   ======================================== */

.themexray-container {
    margin: 1.5em 0;
    padding: 24px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 2px solid #8b5cf6;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
    font-size: 14px;
}

.themexray-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #c4b5fd;
}

.themexray-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.themexray-icon {
    font-size: 24px;
}

.themexray-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.themexray-code {
    font-size: 12px;
    color: #6b7280;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 8px;
    border-radius: 4px;
}

.themexray-comment {
    font-size: 13px;
    color: #4b5563;
    font-style: italic;
}

.themexray-date {
    font-size: 12px;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.7);
    padding: 4px 12px;
    border-radius: 6px;
}

.themexray-body {
    color: #374151;
}

.themexray-loading,
.themexray-error {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 14px;
}

.themexray-error {
    color: #dc2626;
}

/* 요약 정보 */
.themexray-summary {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border: 1px solid #ddd6fe;
}

.themexray-summary-item {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.themexray-summary-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.themexray-summary-value {
    font-size: 16px;
    font-weight: 700;
    color: #8b5cf6;
}

.themexray-major-badge {
    flex: 1 1 100%;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #fbbf24;
}

.themexray-major-badge .themexray-summary-value {
    color: #b45309;
    font-size: 14px;
}

/* 테마 그리드 레이아웃 (3열) */
.themexray-themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .themexray-themes-grid {
        grid-template-columns: 1fr;
    }
}

.themexray-theme-card {
    background: #ffffff;
    border: 1px solid #e0e7ff;
    border-radius: 12px;
    padding: 5px 16px 2px 16px;
    transition: all 0.2s ease;
}

.themexray-theme-card:hover {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
    transform: translateY(-2px);
    border-color: #8b5cf6;
}

.themexray-theme-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.themexray-theme-icon {
    font-size: 20px;
}

.themexray-theme-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}

.themexray-major-icon {
    font-size: 16px;
}

.themexray-theme-score {
    font-size: 15px;
    color: #8b5cf6;
    margin-bottom: 0px;
    font-weight: 600;
}

.themexray-theme-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.themexray-theme-tag {
    font-size: 11px;
    color: #6366f1;
    background: #eef2ff;
    padding: 3px 8px;
    border-radius: 4px;
}

.themexray-theme-category {
    font-size: 11px;
    color: #6b7280;
    text-align: right;
}

.themexray-theme-ended {
    opacity: 0.6;
    filter: grayscale(50%);
}

/* 테마 리스트 레이아웃 (세로) */
.themexray-themes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.themexray-theme-item {
    background: #ffffff;
    border: 1px solid #e0e7ff;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #374151;
    transition: all 0.2s ease;
}

.themexray-theme-item:hover {
    background: #faf5ff;
    border-color: #8b5cf6;
}

/* 투자 포인트 */
.themexray-insights {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.themexray-insights-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
}

.themexray-insights-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.themexray-insights-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    line-height: 1.6;
    color: #4b5563;
}

.themexray-insights-list li:last-child {
    border-bottom: none;
}

.themexray-insights-list strong {
    color: #8b5cf6;
    font-weight: 600;
}

/* 관련 이벤트 */
.themexray-events {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    padding: 16px;
}

.themexray-events-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
}

.themexray-events-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.themexray-events-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    line-height: 1.6;
    color: #4b5563;
}

.themexray-events-list li:last-child {
    border-bottom: none;
}

.themexray-event-date {
    color: #6b7280;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #f9fafb;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
}

.themexray-impact-high {
    color: #dc2626;
    font-weight: 600;
    font-size: 12px;
}

.themexray-impact-medium {
    color: #f59e0b;
    font-weight: 600;
    font-size: 12px;
}

.themexray-impact-low {
    color: #6b7280;
    font-size: 12px;
}

/* Admin Only 표시 */
.themexray-admin-only {
    color: #ec4899;
    animation: themexrayPulse 2s ease-in-out infinite;
}

@keyframes themexrayPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}
