/**
 * HTML Viewer Styles
 * HTML 뷰어 전용 스타일 (2컬럼 레이아웃)
 *
 * @package Zipper
 */

/* ===== 히어로 ===== */
.hv-hero {
    position: relative;
    margin-bottom: 14px;
    padding: 22px;
    background: linear-gradient(135deg, #fffdf6 0%, #f8f0dc 100%);
    border: 1px solid #eadfbe;
    border-radius: 18px;
    box-shadow: 0 16px 36px rgba(86, 63, 18, 0.08);
    overflow: hidden;
    isolation: isolate;
}

.hv-hero::after {
    content: '';
    position: absolute;
    top: -70px;
    right: -40px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.18) 0%, rgba(212, 175, 55, 0) 70%);
    pointer-events: none;
    z-index: -1;
}

.hv-hero-copy {
    max-width: 720px;
}

.hv-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.14);
    color: #8b6914;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hv-hero-title {
    margin: 0;
    color: #2d2a26;
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: -0.02em;
}

.hv-hero-description {
    margin: 12px 0 0;
    color: #5f5a56;
    font-size: 14px;
    line-height: 1.7;
}

.hv-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.hv-hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid #e8e4dc;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #2d2a26;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.hv-hero-btn:hover {
    border-color: #d4af37;
    color: #8b6914;
    box-shadow: 0 8px 18px rgba(212, 175, 55, 0.18);
    transform: translateY(-1px);
}

.hv-hero-btn:focus-visible {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.hv-hero-btn-primary {
    border-color: #d4af37;
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    color: #fff;
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.28);
}

.hv-hero-btn-primary:hover,
.hv-hero-btn-primary:focus-visible {
    background: linear-gradient(135deg, #b8860b 0%, #8b6914 100%);
    color: #fff;
}

.hv-hero-note {
    margin: 12px 0 0;
    color: #7a746d;
    font-size: 12px;
    line-height: 1.6;
}

.hv-hero-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.hv-status-card {
    min-width: 0;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(232, 228, 220, 0.96);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(86, 63, 18, 0.06);
    backdrop-filter: blur(8px);
}

.hv-status-label {
    display: block;
    color: #8c7b3b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hv-status-value {
    display: block;
    margin-top: 6px;
    color: #2d2a26;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.hv-status-meta {
    display: block;
    margin-top: 4px;
    color: #6f6963;
    font-size: 12px;
    line-height: 1.5;
}

/* ===== 툴바 ===== */
.hv-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.hv-toolbar-group {
    display: flex;
    gap: 4px;
    align-items: center;
}

.hv-toolbar-divider {
    width: 1px;
    height: 24px;
    background: #e8e4dc;
    margin: 0 4px;
}

.hv-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #faf9f7;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.hv-toolbar-btn:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.hv-toolbar-btn.active {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    border-color: #d4af37;
    color: #fff;
}

.hv-toolbar-btn i {
    font-size: 14px;
}

.hv-toolbar-btn.hv-btn-primary {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    border-color: #d4af37;
    color: #fff;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
}

.hv-toolbar-btn.hv-btn-primary:hover {
    background: linear-gradient(135deg, #b8860b 0%, #8b6914 100%);
}

/* 샘플 드롭다운 */
.hv-sample-dropdown {
    position: relative;
}

.hv-sample-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    min-width: 180px;
    margin-top: 4px;
    padding: 4px 0;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
}

.hv-sample-dropdown.open .hv-sample-menu {
    display: block;
}

.hv-sample-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    text-align: left;
    border: none;
    background: none;
    color: #2d2a26;
    cursor: pointer;
    transition: background 0.2s;
}

.hv-sample-item:hover {
    background: #faf9f7;
    color: #d4af37;
}

/* 외부 리소스 입력 */
.hv-external-section {
    display: none;
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
}

.hv-external-section.visible {
    display: block;
}

.hv-external-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.hv-external-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hv-external-group label {
    font-size: 11px;
    font-weight: 600;
    color: #5f5a56;
}

.hv-external-group input {
    padding: 8px 10px;
    font-size: 12px;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #fff;
    color: #2d2a26;
}

.hv-external-group input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.1);
}

.hv-external-group input::placeholder {
    color: #a09a94;
}

.hv-external-hint {
    font-size: 10px;
    color: #a09a94;
    margin-top: 4px;
}

/* ===== 2컬럼 레이아웃 (데스크탑) ===== */
.hv-main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: stretch;
    min-height: 500px;
}

.hv-editor-col,
.hv-preview-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* 컬럼 헤더 */
.hv-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-bottom: none;
    border-radius: 12px 10px 0 0;
}

.hv-col-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
}

.hv-col-title i {
    color: #d4af37;
}

.hv-col-actions {
    display: flex;
    gap: 4px;
}

.hv-col-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #e8e4dc;
    border-radius: 4px;
    background: #fff;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
}

.hv-col-btn:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.hv-col-btn.active {
    background: #d4af37;
    border-color: #d4af37;
    color: #fff;
}

/* ===== 에디터 영역 ===== */
.hv-editor-wrapper {
    flex: 1;
    display: flex;
    border: 1px solid #e8e4dc;
    border-top: none;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    background: #fff;
}

.hv-line-numbers {
    flex-shrink: 0;
    padding: 12px 8px 12px 12px;
    background: #faf9f7;
    color: #a09a94;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 20px;
    text-align: right;
    user-select: none;
    border-right: 1px solid #e8e4dc;
    min-width: 48px;
    overflow: hidden;
}

.hv-line-numbers-inner {
    display: flex;
    flex-direction: column;
}

.hv-line-numbers .hv-line-num {
    display: block;
    height: 20px;
    line-height: 20px;
}

.hv-editor-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.hv-editor-highlight,
.hv-editor-textarea {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 12px;
    box-sizing: border-box;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 20px;
    white-space: pre;
    overflow: auto;
    word-wrap: normal;
    -webkit-font-smoothing: antialiased;
}

.hv-editor-highlight {
    pointer-events: none;
    color: #2d2a26;
}

.hv-editor-textarea {
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: transparent;
    caret-color: #d4af37;
}

.hv-editor-textarea::placeholder {
    color: #a09a94;
}

/* 구문 강조 색상 (라이트 테마) */
.hv-editor-highlight .tag {
    color: #0550ae;
}

.hv-editor-highlight .attr-name {
    color: #116329;
}

.hv-editor-highlight .attr-value {
    color: #a40e26;
}

.hv-editor-highlight .comment {
    color: #6e7781;
    font-style: italic;
}

.hv-editor-highlight .doctype {
    color: #6e7781;
}

.hv-editor-highlight .entity {
    color: #8250df;
}

/* ===== 미리보기 영역 ===== */
.hv-preview-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid #e8e4dc;
    border-top: none;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    background: #fff;
}

/* 뷰포트 컨테이너 */
.hv-viewport-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 12px;
    background: #f0f0f0;
    overflow: auto;
}

.hv-viewport-frame {
    width: 100%;
    height: 100%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: width 0.3s, max-width 0.3s;
    border-radius: 4px;
    overflow: hidden;
}

/* 뷰포트 크기 */
.hv-viewport-frame.desktop {
    max-width: 100%;
}

.hv-viewport-frame.tablet {
    max-width: 768px;
}

.hv-viewport-frame.mobile {
    max-width: 375px;
}

.hv-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* 전체화면 모드 */
.hv-fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: #fff;
}

.hv-fullscreen-overlay.active {
    display: flex;
    flex-direction: column;
}

.hv-fullscreen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #faf9f7;
    border-bottom: 1px solid #e8e4dc;
    color: #2d2a26;
}

.hv-fullscreen-title {
    font-size: 14px;
    font-weight: 600;
}

.hv-fullscreen-close {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #fff;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
}

.hv-fullscreen-close:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.hv-fullscreen-content {
    flex: 1;
    overflow: auto;
}

.hv-fullscreen-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ===== 유효성 검사 결과 ===== */
.hv-validation-section {
    margin-top: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
}

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

.hv-validation-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
}

.hv-validation-title i {
    color: #d4af37;
}

.hv-validation-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

.hv-validation-status.valid {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.hv-validation-status.invalid {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.hv-validation-status.warning {
    background: rgba(241, 196, 15, 0.1);
    color: #f39c12;
}

.hv-validation-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 150px;
    overflow-y: auto;
}

.hv-validation-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.hv-validation-item.error {
    background: rgba(231, 76, 60, 0.08);
    color: #c0392b;
}

.hv-validation-item.warning {
    background: rgba(241, 196, 15, 0.08);
    color: #d68910;
}

.hv-validation-item i {
    flex-shrink: 0;
    margin-top: 1px;
}

.hv-validation-line {
    flex-shrink: 0;
    font-weight: 600;
    color: #5f5a56;
}

.hv-validation-empty {
    text-align: center;
    padding: 20px;
    color: #27ae60;
    font-size: 13px;
}

.hv-validation-empty i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

/* ===== 자동 저장 표시 ===== */
.hv-autosave-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #a09a94;
    margin-left: auto;
}

.hv-autosave-indicator i {
    font-size: 12px;
}

.hv-autosave-indicator.saving {
    color: #f39c12;
}

.hv-autosave-indicator.saved {
    color: #27ae60;
}

/* ===== 면책조항 ===== */
.hv-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: rgba(108, 117, 125, 0.08);
    border-radius: 8px;
    margin-top: 12px;
}

.hv-disclaimer i {
    color: #6c757d;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.hv-disclaimer-text {
    font-size: 12px;
    color: #5f5a56;
    line-height: 1.5;
}

/* ===== 반응형 - 태블릿 ===== */
@media (max-width: 900px) {
    .hv-hero {
        padding: 18px;
        border-radius: 16px;
    }

    .hv-hero-title {
        font-size: 28px;
    }

    .hv-hero-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hv-main-layout {
        min-height: 400px;
    }

    .hv-toolbar {
        gap: 6px;
        padding: 10px;
    }

    .hv-toolbar-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .hv-toolbar-btn span {
        display: none;
    }

    .hv-toolbar-btn i {
        font-size: 16px;
    }

    .hv-external-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* ===== 반응형 - 모바일 ===== */
@media (max-width: 768px) {
    .hv-hero {
        padding: 16px;
    }

    .hv-hero-title {
        font-size: 24px;
    }

    .hv-hero-description {
        font-size: 13px;
        line-height: 1.65;
    }

    .hv-hero-actions {
        gap: 8px;
    }

    .hv-hero-btn {
        min-height: 40px;
        padding: 9px 14px;
        font-size: 12px;
    }

    .hv-status-card {
        padding: 13px 14px;
    }

    .hv-main-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .hv-editor-col,
    .hv-preview-col {
        min-height: 300px;
    }

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

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

    .hv-line-numbers {
        padding: 10px 6px 10px 8px;
        font-size: 12px;
        line-height: 18px;
        min-width: 36px;
    }

    .hv-line-numbers .hv-line-num {
        height: 18px;
        line-height: 18px;
    }

    .hv-editor-textarea,
    .hv-editor-highlight {
        padding: 10px;
        font-size: 12px;
        line-height: 18px;
    }

    .hv-validation-list {
        max-height: 120px;
    }
}

/* ===== 반응형 - 작은 모바일 ===== */
@media (max-width: 480px) {
    .hv-hero {
        padding: 14px;
        margin-bottom: 12px;
    }

    .hv-hero-eyebrow {
        padding: 5px 8px;
        font-size: 10px;
    }

    .hv-hero-title {
        font-size: 22px;
    }

    .hv-hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hv-hero-btn {
        width: 100%;
    }

    .hv-hero-status-grid {
        grid-template-columns: 1fr;
    }

    .hv-status-value {
        font-size: 17px;
    }

    .hv-toolbar {
        padding: 8px;
    }

    .hv-toolbar-btn {
        padding: 4px 6px;
        font-size: 10px;
    }

    .hv-col-header {
        padding: 8px 10px;
    }

    .hv-col-title {
        font-size: 12px;
    }

    .hv-col-btn {
        width: 24px;
        height: 24px;
    }

    .hv-editor-col,
    .hv-preview-col {
        min-height: 250px;
    }

    .hv-viewport-container {
        padding: 8px;
    }
}
