/*
 * 파일명: style.css
 * 파일경로: /home/urlkr/public_html/p/html-editor/css/style.css
 * 기능: HTML 웹 에디터 스타일 정의
 * 작성일: 2025-01-21
 * 수정일: 2026-03-09
 */


/* ===================================
 * 기본 & 배경
 * =================================== */
body {
    background: #f8fafc;
    color: #1e293b;
}


/* ===================================
 * 헤더
 * =================================== */
.site-header {
    background: #1e293b;
}

.save-status {
    font-size: 0.7rem;
    color: #94a3b8;
    opacity: 0;
    transition: opacity 0.3s;
}

.save-status.visible {
    opacity: 1;
}


/* ===================================
 * 모바일 탭 전환
 * =================================== */
.mobile-tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}


/* ===================================
 * 패널 카드
 * =================================== */
.panel-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}


/* ===================================
 * 툴바
 * =================================== */
.toolbar {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 5px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.toolbar::-webkit-scrollbar         { height: 3px; }
.toolbar::-webkit-scrollbar-track   { background: transparent; }
.toolbar::-webkit-scrollbar-thumb   { background: #cbd5e1; border-radius: 2px; }

.toolbar-inner {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    white-space: nowrap;
}

.toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    padding-right: 6px;
    margin-right: 4px;
    border-right: 1px solid #e2e8f0;
}

.toolbar-group:last-child {
    border-right: none;
    padding-right: 0;
    margin-right: 0;
}

/* 툴바 버튼 */
.tbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #475569;
    font-size: 0.875rem;
    cursor: pointer;
    flex-shrink: 0;
}

.tbtn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* 색상 선택기 레이블 */
.color-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    color: #475569;
    font-size: 0.875rem;
    cursor: pointer;
    position: relative;
}

.color-label:hover {
    background: #e2e8f0;
}

.color-label input[type="color"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    border: 0;
    padding: 0;
    pointer-events: none;
}


/* ===================================
 * 에디터
 * =================================== */
#editor {
    flex: 1;
    width: 100%;
    padding: 14px 16px;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Cascadia Code', 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.7;
    color: #1e293b;
    background: #fff;
    overflow-y: auto;
}

#editor::placeholder {
    color: #94a3b8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
}

#editor.dragover {
    background: #eff6ff;
    outline: 2px dashed #2563eb;
    outline-offset: -4px;
}


/* ===================================
 * 상태바
 * =================================== */
.statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
    flex-wrap: wrap;
}

.status-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #64748b;
}

.status-select {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    outline: none;
}

/* 상태바 버튼 */
.sbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    color: #475569;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.sbtn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.sbtn.active {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #2563eb;
}


/* ===================================
 * 미리보기
 * =================================== */
.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

#preview {
    flex: 1;
    padding: 14px 16px;
    overflow-y: auto;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: #1e293b;
}


/* ===================================
 * 미리보기 내 HTML 요소 스타일
 * =================================== */
#preview h1, #preview h2, #preview h3,
#preview h4, #preview h5, #preview h6 {
    margin: 0.5em 0;
    font-weight: 600;
}

#preview p  { margin: 0.5em 0; }
#preview hr { border: none; border-top: 1px solid #e2e8f0; margin: 12px 0; }
#preview a  { color: #2563eb; }

#preview ul, #preview ol {
    padding-left: 1.5em;
    margin: 0.5em 0;
}

/* 인라인 코드 */
#preview code {
    display: inline;
    padding: 2px 6px;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 3px;
    font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
    font-size: 0.875em;
}

/* 블록 코드 (pre code) */
#preview pre code {
    display: block;
    padding: 12px 16px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.875em;
    margin: 0;
}

#preview pre {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 12px 16px;
    white-space: pre-wrap;
    font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
    font-size: 0.875em;
    margin: 8px 0;
    overflow-x: auto;
}

#preview blockquote {
    margin: 8px 0;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #475569;
    font-style: italic;
}

#preview table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 0.9em;
}

#preview th,
#preview td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    text-align: left;
}

#preview th {
    background: #f1f5f9;
    font-weight: 600;
}

#preview img {
    max-width: 100%;
    height: auto;
}


/* ===================================
 * 코드 하이라이팅 (Prism.js)
 * =================================== */
.code-container {
    position: relative;
    background: #2d2d2d;
    padding: 1em;
    border-radius: 4px;
    margin: 4px 0;
}

pre[class*="language-"] {
    background: #2d2d2d !important;
    margin: 0 !important;
    padding-top: 2.5em !important;
}

/* Prism 복사 버튼 */
div.code-toolbar > .toolbar {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    background: transparent !important;
    opacity: 1 !important;
}

div.code-toolbar > .toolbar .toolbar-item > button {
    background: #1e293b !important;
    color: #94a3b8 !important;
    padding: 4px 10px !important;
    border: 1px solid #334155 !important;
    border-radius: 4px !important;
    font-size: 0.75em !important;
    cursor: pointer;
}

div.code-toolbar > .toolbar .toolbar-item > button:hover {
    background: #334155 !important;
    color: #e2e8f0 !important;
}


/* ===================================
 * 광고
 * =================================== */
.ad-container {
    margin: 4px 0 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    text-align: center;
}

.ad-label {
    font-size: 0.7rem;
    color: #94a3b8;
    padding: 6px 0 2px;
    text-align: center;
}

ins.adsbygoogle {
    display: block !important;
    min-height: 90px;
}


/* ===================================
 * 푸터
 * =================================== */
.site-footer {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}


/* ===================================
 * 반응형 — 태블릿 (992px 미만)
 * =================================== */
@media (max-width: 991.98px) {
    .panel-card {
        height: calc(100vh - 200px);
        min-height: 420px;
    }
}


/* ===================================
 * 반응형 — 모바일 (768px 미만)
 * =================================== */
@media (max-width: 767.98px) {
    .panel-card {
        height: calc(100vh - 180px);
        min-height: 380px;
        border-radius: 4px;
    }

    .tbtn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .color-label {
        width: 28px;
        height: 28px;
    }

    .statusbar {
        padding: 4px 8px;
    }

    ins.adsbygoogle {
        min-height: 60px;
    }

    .modal-dialog {
        margin: 0.5rem;
    }
}


/* ===================================
 * 반응형 — 소형 모바일 (390px 미만)
 * =================================== */
@media (max-width: 389.98px) {
    .tbtn {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
    }

    .color-label {
        width: 26px;
        height: 26px;
    }
}
