/**
 * Markdown to HTML Converter Styles
 * Markdown → HTML 변환기 전용 스타일
 *
 * @package Zipper
 */

/* 변환 영역 */
.md-converter-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.md-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

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

.md-panel-label {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
    display: flex;
    align-items: center;
    gap: 6px;
}

.md-panel-label i {
    color: #d4af37;
}

.md-panel-actions {
    display: flex;
    gap: 8px;
}

.md-action-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    font-size: 13px;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.md-action-btn:hover {
    background: #faf9f7;
    border-color: #d4af37;
    color: #d4af37;
}

.md-action-btn i {
    font-size: 14px;
}

.md-textarea {
    width: 100%;
    height: 350px;
    padding: 16px;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #2d2a26;
    background: #faf9f7;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    tab-size: 4;
}

.md-textarea:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.md-textarea::placeholder {
    color: #8c8579;
}

.md-textarea[readonly] {
    background: #fff;
    cursor: default;
}

/* 출력 탭 */
.md-output-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.md-output-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #e8e4dc;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
}

.md-output-tab.active {
    background: #fff;
    border-color: #d4af37;
    border-bottom-color: #fff;
    color: #d4af37;
}

.md-output-tab:hover:not(.active) {
    background: #faf9f7;
}

.md-output-content {
    display: none;
    width: 100%;
}

.md-output-content.active {
    display: block;
    width: 100%;
}

/* HTML 미리보기 */
.md-preview {
    width: 100%;
    height: 350px;
    padding: 16px;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    background: #fff;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
    color: #2d2a26;
}

.md-preview h1, .md-preview h2, .md-preview h3,
.md-preview h4, .md-preview h5, .md-preview h6 {
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    font-weight: 600;
    color: #2d2a26;
    line-height: 1.3;
}

.md-preview h1 {
    font-size: 1.8em;
    border-bottom: 2px solid #e8e4dc;
    padding-bottom: 0.3em;
}

.md-preview h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #e8e4dc;
    padding-bottom: 0.3em;
}

.md-preview h3 { font-size: 1.25em; }
.md-preview h4 { font-size: 1.1em; }
.md-preview h5 { font-size: 1em; }
.md-preview h6 { font-size: 0.9em; color: #5f5a56; }

.md-preview p {
    margin: 0.8em 0;
}

.md-preview a {
    color: #d4af37;
    text-decoration: none;
}

.md-preview a:hover {
    text-decoration: underline;
}

.md-preview ul, .md-preview ol {
    margin: 0.8em 0;
    padding-left: 2em;
}

.md-preview li {
    margin: 0.3em 0;
}

.md-preview blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid #d4af37;
    background: #faf9f7;
    color: #5f5a56;
}

.md-preview blockquote p {
    margin: 0;
}

.md-preview code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    background: #faf9f7;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: #c7254e;
}

.md-preview pre {
    margin: 1em 0;
    padding: 16px;
    background: #2d2a26;
    border-radius: 8px;
    overflow-x: auto;
}

.md-preview pre code {
    background: transparent;
    padding: 0;
    color: #f8f8f2;
    font-size: 13px;
    line-height: 1.5;
}

.md-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.md-preview th, .md-preview td {
    border: 1px solid #e8e4dc;
    padding: 10px 12px;
    text-align: left;
}

.md-preview th {
    background: #faf9f7;
    font-weight: 600;
}

.md-preview tr:hover {
    background: #faf9f7;
}

.md-preview hr {
    border: none;
    border-top: 1px solid #e8e4dc;
    margin: 1.5em 0;
}

.md-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* 체크박스 리스트 (GFM) */
.md-preview input[type="checkbox"] {
    margin-right: 8px;
}

.md-preview .task-list-item {
    list-style: none;
    margin-left: -1.5em;
}

/* 취소선 */
.md-preview del {
    color: #8c8579;
}

/* 옵션 및 액션 영역 */
.md-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: #faf9f7;
    border-radius: 10px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.md-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.md-toolbar-label {
    font-size: 13px;
    color: #5f5a56;
}

.md-toolbar-divider {
    width: 1px;
    height: 24px;
    background: #e8e4dc;
}

.md-file-input {
    display: none;
}

.md-file-label {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    font-size: 13px;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.md-file-label:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.md-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.md-btn-primary {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    color: #fff;
}

.md-btn-primary:hover {
    background: linear-gradient(135deg, #e5c158 0%, #d4af37 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.md-btn-secondary {
    background: #fff;
    color: #5f5a56;
    border: 1px solid #e8e4dc;
}

.md-btn-secondary:hover {
    background: #faf9f7;
    border-color: #d4af37;
    color: #d4af37;
}

/* 샘플 버튼 */
.md-sample-btn {
    padding: 8px 14px;
    background: transparent;
    border: 1px dashed #d4af37;
    border-radius: 6px;
    font-size: 13px;
    color: #d4af37;
    cursor: pointer;
    transition: all 0.2s;
}

.md-sample-btn:hover {
    background: rgba(212, 175, 55, 0.1);
}

/* 상태 표시 */
.md-status {
    display: flex;
    gap: 20px;
    padding: 14px 16px;
    background: #faf9f7;
    border-radius: 8px;
    margin-top: 16px;
    width: 100%;
    box-sizing: border-box;
}

.md-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #5f5a56;
}

.md-status-value {
    font-weight: 600;
    color: #d4af37;
}

/* 구문 강조 (Highlight.js 기본 테마 오버라이드) */
.md-preview .hljs {
    background: #2d2a26;
}

.md-preview .hljs-keyword,
.md-preview .hljs-selector-tag,
.md-preview .hljs-literal,
.md-preview .hljs-section,
.md-preview .hljs-link {
    color: #ff79c6;
}

.md-preview .hljs-string,
.md-preview .hljs-title,
.md-preview .hljs-name,
.md-preview .hljs-type,
.md-preview .hljs-attribute,
.md-preview .hljs-symbol,
.md-preview .hljs-bullet,
.md-preview .hljs-addition,
.md-preview .hljs-variable,
.md-preview .hljs-template-tag,
.md-preview .hljs-template-variable {
    color: #f1fa8c;
}

.md-preview .hljs-comment,
.md-preview .hljs-quote,
.md-preview .hljs-deletion,
.md-preview .hljs-meta {
    color: #6272a4;
}

.md-preview .hljs-number,
.md-preview .hljs-regexp,
.md-preview .hljs-literal,
.md-preview .hljs-selector-class {
    color: #bd93f9;
}

.md-preview .hljs-function {
    color: #50fa7b;
}

.md-preview .hljs-attr,
.md-preview .hljs-tag {
    color: #8be9fd;
}

/* Responsive */
@media (max-width: 768px) {
    .md-converter-area {
        grid-template-columns: 1fr;
    }

    .md-textarea,
    .md-preview {
        height: 250px;
    }

    .md-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .md-toolbar-group {
        flex-wrap: wrap;
    }

    .md-toolbar-divider {
        display: none;
    }

    .md-status {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .md-textarea,
    .md-preview {
        height: 200px;
        font-size: 12px;
        padding: 12px;
    }

    .md-panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .md-panel-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .md-output-tabs {
        flex-wrap: wrap;
    }

    .md-btn {
        width: 100%;
        justify-content: center;
    }
}
