/**
 * 학습지 관리 스타일 (18-worksheet.css)
 * WYSIWYG 편집 스타일
 */

/* Google Fonts - 귀여운 폰트 */
@import url('https://fonts.googleapis.com/css2?family=Jua&family=Noto+Sans+KR:wght@400;700&family=Nanum+Gothic:wght@400;700&family=Gamja+Flower&display=swap');

/* ============================================
   공통
   ============================================ */
.ws-container {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.ws-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ws-btn.ws-btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    gap: 0.25rem;
}

.ws-btn.primary {
    background: #4f46e5;
    color: white;
}

.ws-btn.primary:hover {
    background: #4338ca;
}

.ws-btn.secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.ws-btn.secondary:hover {
    background: #e5e7eb;
}

.ws-btn.text {
    background: none;
    color: #6b7280;
    white-space: nowrap;
}

.ws-btn.text:hover {
    color: #1f2937;
}

.ws-btn.danger {
    background: #fee2e2;
    color: #dc2626;
}

.ws-btn.danger:hover {
    background: #fecaca;
}

.ws-btn.small {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* ============================================
   목록 화면
   ============================================ */
.ws-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.ws-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.ws-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ws-list-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-list-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.ws-item-info {
    flex: 1;
}

.ws-item-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.ws-item-info p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.ws-item-actions {
    display: flex;
    gap: 0.5rem;
}

.ws-item-actions button {
    padding: 0.5rem;
    background: #f3f4f6;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.ws-item-actions button:hover {
    background: #e5e7eb;
}

.ws-item-actions button.danger:hover {
    background: #fee2e2;
}

.ws-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #9ca3af;
    font-size: 1.125rem;
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 1rem;
}

/* ============================================
   편집 화면 - 툴바
   ============================================ */
.ws-editor {
    min-height: 100vh;
}

.ws-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ws-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ws-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 페이지 탭 바 + 스타일 옵션 */
.ws-page-tabs-bar {
    position: sticky;
    top: 53px; /* ws-toolbar 높이 아래에 고정 */
    z-index: 99;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    gap: 0.5rem;
}

.ws-tabs-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ws-style-options {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.ws-style-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ws-style-label {
    font-size: 0.65rem;
    color: #9ca3af;
    font-weight: 500;
    white-space: nowrap;
}

.ws-style-select {
    padding: 0.2rem 0.4rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    background: white;
    cursor: pointer;
    min-width: 50px;
}

.ws-color-picker {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    cursor: pointer;
    background: none;
}

.ws-title-input {
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    background: transparent;
    padding: 0.25rem 0.5rem;
    color: #1f2937;
    min-width: 150px;
}

.ws-title-input:focus {
    outline: none;
    background: #f3f4f6;
    border-radius: 0.375rem;
}

.ws-theme-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.ws-save-status {
    font-size: 0.875rem;
    color: #6b7280;
}

.ws-save-status.saving {
    color: #f59e0b;
}

.ws-save-status.saved {
    color: #22c55e;
}

/* ============================================
   편집 화면 - 페이지 탭
   ============================================ */
.ws-page-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ws-page-tab {
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border: none;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-page-tab:hover {
    background: #e5e7eb;
}

.ws-page-tab.active {
    color: white;
}

.ws-page-tab.add {
    background: transparent;
    border: 2px dashed #d1d5db;
    color: #9ca3af;
}

.ws-page-tab.add:hover {
    border-color: #9ca3af;
    color: #6b7280;
}

/* ============================================
   편집 화면 - 페이지 헤더
   ============================================ */
.ws-page-header {
    position: relative;
    padding: 1rem 1.5rem;
    text-align: center;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

/* 로고 */
.ws-header-logo {
    position: absolute;
    top: 0.75rem;
    left: 1.5rem;
    height: 28px;
    width: auto;
}

.ws-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

/* 부제목 - contenteditable */
.ws-page-subtitle {
    min-width: 100px;
    max-width: none;
    padding: 0.25rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    text-align: center;
    outline: none;
    cursor: text;
    white-space: nowrap;
}

.ws-page-subtitle:empty::before {
    content: attr(data-placeholder);
    color: #d1d5db;
}

.ws-page-subtitle:focus {
    background: #f3f4f6;
    border-radius: 1rem;
}

/* 제목 - contenteditable */
.ws-page-title {
    min-width: 150px;
    max-width: none;
    padding: 0.25rem 1rem;
    font-size: 1.75rem;
    font-weight: 800;
    color: #111827;
    background: transparent;
    border: none;
    text-align: center;
    outline: none;
    cursor: text;
    white-space: nowrap;
}

.ws-page-title:empty::before {
    content: attr(data-placeholder);
    color: #d1d5db;
}

.ws-page-title:focus {
    background: #f3f4f6;
    border-radius: 0.5rem;
}

/* ============================================
   레이아웃 선택 바
   ============================================ */
.ws-layout-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

.ws-layout-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.ws-layout-btn {
    padding: 0.4rem 0.6rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    color: #6b7280;
    cursor: pointer;
    letter-spacing: -2px;
}

.ws-layout-btn:hover {
    background: #e5e7eb;
}

.ws-layout-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* ============================================
   편집 화면 - 블록 영역
   ============================================ */
.ws-blocks-area {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem 6rem;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-flow: dense; /* ★ 빈 공간 자동 채움 */
    gap: 1rem;
    align-items: start; /* ★ 블록 독립 높이 - stretch에서 start로 변경 */
    min-height: 300px;
    transition: background 0.2s;
}

.ws-blocks-area.drag-active {
    background: #f0f9ff;
    border: 2px dashed #3b82f6;
    border-radius: 1rem;
}

.ws-blocks-area .ws-block {
    min-width: 0;
    max-width: 100%;
}

.ws-blocks-area .ws-add-block-bar {
    grid-column: 1 / -1;
}

.ws-blocks-area .ws-empty-blocks {
    grid-column: 1 / -1;
}

/* 블록 추가 버튼 - 하단 고정 */
.ws-add-block-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}

.ws-add-block-fixed button {
    padding: 0.625rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-add-block-fixed button:hover {
    border-color: #4f46e5;
    color: #4f46e5;
    background: #f5f3ff;
}

.ws-empty-blocks {
    text-align: center;
    padding: 4rem 2rem;
    color: #9ca3af;
    font-size: 1.125rem;
    background: white;
    border: 2px dashed #e5e7eb;
    border-radius: 1.5rem;
}

.ws-add-block-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background: white;
    border: 2px dashed #e5e7eb;
    border-radius: 1rem;
    flex-wrap: wrap;
}

.ws-add-block-bar span {
    font-size: 0.875rem;
    color: #9ca3af;
    font-weight: 600;
}

.ws-add-block-bar button {
    padding: 0.625rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-add-block-bar button:hover {
    border-color: #4f46e5;
    color: #4f46e5;
    background: #f5f3ff;
}

/* ============================================
   블록 공통
   ============================================ */
.ws-block {
    position: relative;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 2px solid transparent;
    transition: all 0.15s ease;
    min-width: 0;
    cursor: grab;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ws-block:hover {
    border-color: #e5e7eb;
}

.ws-block:active {
    cursor: grabbing;
}

/* 드래그 중인 블록 */
.ws-block.ws-dragging {
    opacity: 0.4;
    transform: scale(0.95);
    border-color: #3b82f6;
}

/* 드롭 대상 블록 */
.ws-block.ws-drag-over {
    border: 3px dashed #3b82f6 !important;
    background: #dbeafe !important;
    transform: scale(1.02);
}

.ws-block-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 1.5rem 1.5rem 0 0;
    cursor: grab;
}

.ws-block-toolbar:active {
    cursor: grabbing;
}

.ws-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.ws-block-type {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 0.25rem;
}

.ws-block[data-type="text"] .ws-block-type { background: #dbeafe; color: #1d4ed8; }
.ws-block[data-type="hero"] .ws-block-type { background: #fef3c7; color: #b45309; }
.ws-block[data-type="gallery"] .ws-block-type { background: #d1fae5; color: #047857; }
.ws-block[data-type="video"] .ws-block-type { background: #fce7f3; color: #be185d; }
.ws-block[data-type="model"] .ws-block-type { background: #e0e7ff; color: #4338ca; }

.ws-block-actions {
    display: flex;
    gap: 0.25rem;
}

.ws-block-actions button {
    padding: 0.25rem 0.5rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-block-actions button:hover:not(:disabled) {
    background: #f3f4f6;
}

.ws-block-actions button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ws-block-actions button.danger:hover {
    background: #fee2e2;
    border-color: #fecaca;
}

/* 드래그 핸들 */
.ws-drag-handle {
    cursor: grab;
    padding: 0.25rem 0.5rem;
    font-size: 1.2rem;
    color: #9ca3af;
    user-select: none;
    transition: all 0.2s;
    border-radius: 0.25rem;
}

.ws-drag-handle:hover {
    color: #4b5563;
    background: #e5e7eb;
}

.ws-drag-handle:active {
    cursor: grabbing;
    background: #d1d5db;
}

.ws-block-content.ws-drag-over-content {
    background: #dbeafe;
}

/* 블록 크기 선택 버튼 (가로 × 세로) */
.ws-span-group {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    background: #f3f4f6;
    padding: 0.15rem 0.3rem;
    border-radius: 0.375rem;
}

.ws-span-separator {
    color: #9ca3af;
    font-size: 0.65rem;
    font-weight: bold;
}

.ws-span-btns {
    display: flex;
    gap: 1px;
}

.ws-span-btns button {
    width: 1.2rem;
    height: 1.2rem;
    padding: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.2rem;
    font-size: 0.6rem;
    font-weight: bold;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ws-span-btns button:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.ws-span-btns button.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* 세로 버튼 색상 구분 */
.ws-row-btns button.active {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

/* 삭제 버튼 */
.ws-delete-btn {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ws-delete-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
}

.ws-block-content {
    padding: 0.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ws-block-edit {
    padding: 1rem 1.5rem 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

/* ============================================
   리사이즈 가능한 블록
   ============================================ */
.ws-resizable {
    resize: both;
    overflow: auto;
    min-width: 100px;
    max-width: 100%;
    min-height: 30px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    cursor: default;
    box-sizing: border-box;
}

.ws-resizable:hover {
    border-color: #d1d5db;
}

.ws-resizable:active {
    border-color: #4f46e5;
}

/* resize 핸들 스타일 */
.ws-resizable::-webkit-resizer {
    background: linear-gradient(135deg, transparent 50%, #9ca3af 50%, #9ca3af 60%, transparent 60%, transparent 70%, #9ca3af 70%, #9ca3af 80%, transparent 80%);
    cursor: nwse-resize;
}

/* ============================================
   블록별 스타일 - 텍스트
   ============================================ */
.ws-block-text {
    background: white;
    border-radius: 1.5rem;
    border: 2px solid #f3f4f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    min-height: 30px;
}

.ws-text-content {
    padding: 0.5rem 0.75rem;
    line-height: 1.8;
    white-space: pre-wrap;
    outline: none;
    box-sizing: border-box;
    min-height: 30px;
}

.ws-text-content:focus {
    background: #fefce8;
    border-radius: 1rem;
}

/* 선택 텍스트 스타일링 */
.ws-text-content::selection {
    background: #fef08a;
}

.ws-text-content b, .ws-text-content strong {
    font-weight: 700;
}

.ws-text-content i, .ws-text-content em {
    font-style: italic;
}

.ws-text-content u {
    text-decoration: underline;
}

/* ============================================
   블록별 스타일 - 히어로 이미지
   ============================================ */
.ws-block-hero {
    height: 100%;
    border-radius: 1rem;
    overflow: hidden;
}

.ws-block-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1rem;
}

.ws-img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 1rem;
    color: #9ca3af;
    font-size: 1rem;
    font-weight: 600;
}

.ws-caption {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.75rem;
}

/* ============================================
   블록별 스타일 - 갤러리
   ============================================ */
.ws-block-gallery {
    background: #fef9c3;
    padding: 1.5rem;
    border-radius: 1.5rem;
}

.ws-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.ws-block-gallery.small .ws-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 400px;
    margin: 0 auto;
}

.ws-block-gallery.medium .ws-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
}

.ws-gallery-item {
    aspect-ratio: 1;
    border-radius: 1rem;
    overflow: hidden;
    background: white;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ws-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ws-gallery-item .ws-img-placeholder {
    height: 100%;
    min-height: auto;
    border: none;
    background: #f9fafb;
}

.ws-gallery-caption {
    text-align: center;
    color: #854d0e;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 1rem;
}

/* ============================================
   블록별 스타일 - 동영상 (기본 - 탭 UI 이전 호환용)
   ============================================ */
.ws-video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #1f2937;
    border-radius: 1rem;
    color: #9ca3af;
    font-size: 3rem;
}

/* ============================================
   블록별 스타일 - 3D 모델
   ============================================ */
.ws-block-model {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ws-model-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.ws-model-tab {
    padding: 0.4rem 0.8rem;
    border: none;
    background: #e5e7eb;
    border-radius: 0.5rem 0.5rem 0 0;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.2s;
}

.ws-model-tab.active {
    background: #3b82f6;
    color: white;
}

.ws-model-tab:hover:not(.active) {
    background: #d1d5db;
}

.ws-model-content {
    flex: 1;
    position: relative;
    min-height: 250px;
}

.ws-model-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
}

.ws-model-panel.active {
    display: block;
}

/* 썸네일 패널은 active일 때 flex 유지 (가운데 정렬) */
.ws-model-thumb-panel.active,
.ws-video-thumb-panel.active {
    display: flex;
}

.ws-model-thumb-panel {
    border: 2px dashed #d1d5db;
    border-radius: 1rem;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-model-thumb-panel:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.ws-model-thumb-panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1rem;
}

.ws-model-thumb-panel .thumb-placeholder {
    text-align: center;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ws-model-thumb-panel .thumb-placeholder span {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.ws-model-wrapper {
    position: relative;
    height: 100%;
    border-radius: 1rem;
    overflow: hidden;
    background: linear-gradient(to bottom, #e0f2fe, white);
}

.ws-model-wrapper iframe {
    width: 100%;
    height: 100%;
}

/* ============================================
   블록별 스타일 - 비디오 (탭 포함)
   ============================================ */
.ws-block-video {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ws-video-thumb-panel {
    border: 2px dashed #d1d5db;
    border-radius: 1rem;
    background: #fef2f2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-video-thumb-panel:hover {
    border-color: #ef4444;
    background: #fee2e2;
}

.ws-video-thumb-panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1rem;
}

.ws-video-thumb-panel .thumb-placeholder {
    text-align: center;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ws-video-thumb-panel .thumb-placeholder span {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.ws-video-wrapper {
    position: relative;
    height: 100%;
    border-radius: 1rem;
    overflow: hidden;
    background: #1f2937;
}

.ws-video-wrapper iframe {
    width: 100%;
    height: 100%;
}

.ws-model-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #0284c7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ws-model-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: linear-gradient(to bottom, #e0f2fe, #f0f9ff);
    border-radius: 1.5rem;
    color: #0284c7;
    font-size: 1.25rem;
    font-weight: 600;
}

/* ============================================
   편집 패널
   ============================================ */
.ws-edit-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ws-edit-panel input,
.ws-edit-panel select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    height: 38px;
    box-sizing: border-box;
    line-height: 1.4;
}

.ws-edit-panel input:focus,
.ws-edit-panel select:focus {
    outline: none;
    border-color: #4f46e5;
}

.ws-edit-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.ws-edit-row input {
    flex: 1;
}

.ws-edit-row label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.ws-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    height: 38px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
    font-size: 1rem;
}

.ws-upload-btn:hover {
    background: #f3f4f6;
}

.ws-gallery-edit-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ws-gallery-edit-item {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.ws-gallery-edit-item input {
    flex: 1;
}

.ws-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.625rem;
    height: 38px;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 600;
    box-sizing: border-box;
}

.ws-remove-btn:hover {
    background: #fecaca;
}

.ws-add-img-btn {
    padding: 0.5rem;
    background: white;
    border: 1px dashed #d1d5db;
    border-radius: 0.375rem;
    color: #6b7280;
    font-size: 0.75rem;
    cursor: pointer;
    text-align: center;
}

.ws-add-img-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* ============================================
   반응형
   ============================================ */
@media (max-width: 768px) {
    .ws-toolbar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .ws-toolbar-left {
        width: 100%;
    }
    
    .ws-toolbar-center {
        width: 100%;
        justify-content: flex-start;
    }
    
    .ws-toolbar-right {
        width: 100%;
        justify-content: flex-end;
    }
    
    .ws-style-label {
        font-size: 0.6rem;
    }
    
    .ws-style-select {
        padding: 0.2rem 0.3rem;
        font-size: 0.7rem;
    }
    
    .ws-color-picker {
        width: 20px;
        height: 20px;
    }
    
    .ws-title-input {
        font-size: 0.9rem;
        min-width: 100px;
    }
    
    .ws-page-title {
        font-size: 1.75rem;
        min-width: 200px;
    }
    
    .ws-page-subtitle {
        font-size: 0.875rem;
        min-width: 150px;
    }
    
    .ws-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ws-add-block-fixed {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .ws-add-block-fixed button {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .ws-resizable {
        min-width: 100%;
    }
    
    .ws-style-options {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* 모바일에서 2열 */
    .ws-blocks-area {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ws-blocks-area .ws-block {
        grid-column: span 2 !important;
    }
    
    .ws-header-logo {
        position: static;
        display: block;
        margin: 0 auto 1rem;
    }
    
    .ws-page-header {
        text-align: center;
    }
    
    /* 블록 툴바 반응형 */
    .ws-block-toolbar {
        flex-wrap: wrap;
        gap: 0.3rem;
        padding: 0.4rem 0.5rem;
    }
    
    .ws-span-group {
        padding: 0.1rem 0.2rem;
        gap: 0.1rem;
    }
    
    .ws-span-btns button {
        width: 1rem;
        height: 1rem;
        font-size: 0.55rem;
    }
    
    .ws-span-separator {
        font-size: 0.5rem;
    }
    
    .ws-delete-btn {
        width: 1.3rem;
        height: 1.3rem;
        font-size: 0.6rem;
    }
}

/* 태블릿 */
@media (min-width: 769px) and (max-width: 1024px) {
    .ws-blocks-area {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .ws-blocks-area .ws-block[style*="span 6"] {
        grid-column: span 4 !important;
    }
    
    .ws-blocks-area .ws-block[style*="span 5"] {
        grid-column: span 4 !important;
    }
}

/* ============================================
   플로팅 툴바 (텍스트 선택 시)
   ============================================ */
.ws-floating-toolbar {
    position: absolute;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #1f2937;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ws-floating-toolbar::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1f2937;
}

.ws-floating-toolbar button {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ws-floating-toolbar button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ws-floating-toolbar select {
    padding: 4px;
    font-size: 11px;
    border: 1px solid #4b5563;
    border-radius: 4px;
    background: #374151;
    color: white;
    cursor: pointer;
}

.ws-floating-toolbar input[type="color"] {
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.ws-color-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.ws-color-label {
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.ws-color-label.bg {
    color: #fef08a;
}

/* ============================================
   리사이즈 핸들 및 스냅 가이드라인
   ============================================ */

/* 리사이즈 핸들 - 오른쪽 */
.ws-resize-right {
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 40px;
    background: #3b82f6;
    border-radius: 4px;
    cursor: ew-resize;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

/* 리사이즈 핸들 - 아래 */
.ws-resize-bottom {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 8px;
    background: #8b5cf6;
    border-radius: 4px;
    cursor: ns-resize;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

/* 리사이즈 핸들 - 코너 */
.ws-resize-corner {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, #3b82f6 50%, #8b5cf6 50%);
    border-radius: 3px;
    cursor: nwse-resize;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 11;
}

/* 호버 시 핸들 표시 */
.ws-block:hover .ws-resize-handle {
    opacity: 1;
}

.ws-block.ws-resizing .ws-resize-handle {
    opacity: 1;
}

/* 리사이즈 중 스타일 */
.ws-block.ws-resizing {
    z-index: 100;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
}

/* 스냅 가이드라인 컨테이너 */
.ws-snap-guide-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 50;
}

/* 스냅 가이드라인 - 세로 */
.ws-snap-guide-v {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(59, 130, 246, 0.3);
    transition: all 0.15s;
}

.ws-snap-guide-v span {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(59, 130, 246, 0.8);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.ws-snap-guide-v.active {
    background: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.7);
    width: 3px;
}

.ws-snap-guide-v.active span {
    background: #3b82f6;
    transform: translateX(-50%) scale(1.2);
}

/* 스냅 가이드라인 - 가로 */
.ws-snap-guide-h {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.15s, box-shadow 0.15s;
}

.ws-snap-guide-h.active {
    background: #8b5cf6;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* 크기 표시 툴팁 */
.ws-resize-tooltip {
    position: fixed;
    background: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

/* ============================================
   썸네일 드래그 앤 드롭 영역
   ============================================ */
.ws-thumbnail-drop {
    margin-top: 0.5rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f9fafb;
}

.ws-thumbnail-drop:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.ws-thumbnail-drop.dragover {
    border-color: #3b82f6;
    background: #dbeafe;
    transform: scale(1.02);
}

.ws-thumbnail-placeholder {
    color: #9ca3af;
}

.ws-thumbnail-placeholder span {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.25rem;
}

.ws-thumbnail-placeholder p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
}

.ws-thumbnail-placeholder small {
    font-size: 0.75rem;
    color: #9ca3af;
}

.ws-thumbnail-preview {
    position: relative;
    display: inline-block;
}

.ws-thumbnail-preview img {
    max-width: 100%;
    max-height: 120px;
    border-radius: 0.375rem;
    object-fit: contain;
}

.ws-thumbnail-preview button {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.ws-thumbnail-preview button:hover {
    background: #dc2626;
}

.ws-thumbnail-loading {
    color: #3b82f6;
    font-size: 0.875rem;
    padding: 1rem;
}

/* 인쇄 전용 표시 라벨 */
.ws-thumbnail-drop::after {
    content: '🖨️ 인쇄시만 표시';
    display: block;
    font-size: 0.65rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

/* 썸네일 토글 버튼 */
.ws-thumb-toggle {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-thumb-toggle:hover {
    background: #e5e7eb;
    color: #374151;
}

.ws-thumb-toggle.collapsed {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #3b82f6;
}

/* 썸네일 영역 숨김 */
.ws-thumbnail-drop.hidden {
    display: none;
}

/* ============================================
   내부 리사이즈 스냅 가이드 (수평)
   ============================================ */
.ws-inner-snap-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 100;
}

.ws-inner-snap-guide {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(139, 92, 246, 0.3);
    transition: all 0.15s;
}

.ws-inner-snap-guide span {
    position: absolute;
    right: 10px;
    top: -10px;
    background: rgba(139, 92, 246, 0.7);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0.5;
}

.ws-inner-snap-guide.near {
    background: rgba(139, 92, 246, 0.5);
    height: 2px;
}

.ws-inner-snap-guide.near span {
    opacity: 0.8;
}

.ws-inner-snap-guide.active {
    background: #8b5cf6;
    height: 3px;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.7);
}

.ws-inner-snap-guide.active span {
    opacity: 1;
    background: #8b5cf6;
    transform: scale(1.1);
}

/* ============================================
   인쇄 설정 패널
   ============================================ */
.ws-print-settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ws-print-settings-content {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 240px;
    max-height: 90vh;
    overflow: auto;
}

.ws-print-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.ws-print-settings-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: #374151;
}

.ws-close-btn {
    background: none;
    border: none;
    font-size: 1rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.ws-close-btn:hover {
    color: #374151;
}

.ws-print-settings-body {
    padding: 0.75rem 1rem;
}

.ws-setting-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.ws-setting-row:last-child {
    margin-bottom: 0;
}

.ws-setting-row label {
    font-size: 0.75rem;
    color: #374151;
    font-weight: 500;
    width: 45px;
    flex-shrink: 0;
}

.ws-setting-row select {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    background: white;
}

.ws-setting-row select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.ws-print-settings-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
}

/* 테이블 행 높이 조절 */
.ws-text-content table {
    border-collapse: collapse;
}

.ws-text-content table td,
.ws-text-content table th {
    position: relative;
    min-height: 24px;
    vertical-align: middle;
}

.ws-text-content table td[data-can-resize="true"],
.ws-text-content table th[data-can-resize="true"] {
    cursor: row-resize;
}

/* 테이블 열 너비 조절 커서 */
.ws-text-content table td[data-can-resize-col="true"],
.ws-text-content table th[data-can-resize-col="true"] {
    cursor: col-resize;
}

/* 테이블 리사이즈 중 */
.ws-table-resizing {
    user-select: none;
}

.ws-table-resizing td,
.ws-table-resizing th {
    transition: none !important;
}

/* ============================================
   테이블 전체 크기 조절
   ============================================ */
.ws-table-resize-wrapper {
    position: relative;
    display: inline-block;
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
    margin: 4px 0;
}

.ws-table-resize-wrapper table {
    margin: 0 !important;
}

/* 테이블 리사이즈 핸들 - 공통 */
.ws-table-resize-handle {
    position: absolute;
    background: #3b82f6;
    cursor: pointer;
    z-index: 10;
    opacity: 0.9;
    transition: opacity 0.2s, transform 0.2s;
}

.ws-table-resize-handle:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* 오른쪽 핸들 - 너비 조절 */
.ws-table-resize-right {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 32px;
    border-radius: 4px;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.ws-table-resize-right:hover {
    transform: translateY(-50%) scale(1.1);
}

/* 코너 핸들 - 전체 크기 조절 */
.ws-table-resize-corner {
    right: -8px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, #3b82f6 50%, #8b5cf6 50%);
}

.ws-table-resize-corner::after {
    content: '';
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 6px;
    height: 6px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
}

/* 하단 핸들 - 높이 조절 */
.ws-table-resize-bottom-handle {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 8px;
    border-radius: 4px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: bold;
    background: #8b5cf6;
}

.ws-table-resize-bottom-handle:hover {
    transform: translateX(-50%) scale(1.1);
}
