/* PIMOUNT 상세페이지 생성기 Pro - CSS */
/* ═══════════════════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent: #C9A962;
    --accent-light: rgba(201, 169, 98, 0.15);
    --accent-dark: #B08D3F;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: 0.2s ease;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.2);
}

/* 라이트 테마 */
[data-theme="light"] {
    --bg-app: #F5F5F7;
    --bg-sidebar: #FFFFFF;
    --bg-main: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-input: #F5F5F5;
    --bg-hover: #EEEEEE;
    --text-primary: #1A1A1A;
    --text-secondary: #4A4A4A;
    --text-muted: #8A8A8A;
    --border: #E5E5E5;
    --border-focus: #1A1A1A;
}

/* 다크 테마 */
[data-theme="dark"] {
    --bg-app: #0A0A0B;
    --bg-sidebar: #111113;
    --bg-main: #18181B;
    --bg-card: #1F1F23;
    --bg-input: #27272A;
    --bg-hover: #3F3F46;
    --text-primary: #FAFAFA;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;
    --border: #27272A;
    --border-focus: var(--accent);
}

body {
    font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* 앱 레이아웃 */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* 사이드바 */
/* ═══════════════════════════════════════════════════════════════════ */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
    overflow-y: auto;
    z-index: 100;
}

.sidebar.collapsed {
    transform: translateX(-100%);
    width: 0;
    border: none;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 1px;
    transition: color var(--transition);
}

.logo:hover {
    color: var(--accent);
}

.version {
    font-size: 0.7rem;
    padding: 4px 8px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 20px;
    font-weight: 600;
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.sidebar-title svg {
    width: 16px;
    height: 16px;
}

.setting-group {
    margin-bottom: 16px;
}

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

.setting-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* 템플릿 카드 */
.template-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.template-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.template-card:hover {
    background: var(--bg-hover);
}

.template-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.template-preview {
    width: 40px;
    height: 50px;
    border-radius: 4px;
    background: var(--text-muted);
    position: relative;
    overflow: hidden;
}

.template-preview.minimal {
    background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
}

.template-preview.modern {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.template-preview.street {
    background: linear-gradient(180deg, #1a1a1a 0%, #333 100%);
}

.template-preview.classic {
    background: linear-gradient(180deg, #f5f0e6 0%, #e8dcc8 100%);
}

.template-card span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.template-card.active span {
    color: var(--accent);
    font-weight: 600;
}

/* 테마 토글 */
.theme-toggle {
    display: flex;
    gap: 8px;
}

.theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.theme-btn:hover {
    background: var(--bg-hover);
}

.theme-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-btn svg {
    width: 16px;
    height: 16px;
}

/* 컬러 피커 */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-row input[type="color"] {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: none;
}

.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-row input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
}

.color-value {
    font-size: 0.85rem;
    font-family: monospace;
    color: var(--text-secondary);
}

/* 셀렉트 */
select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: all var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238A8A8A' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

select:focus {
    border-color: var(--accent);
}

/* 저장/불러오기 버튼 */
.save-load-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    min-width: 70px;
}

.action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* 메인 영역 */
/* ═══════════════════════════════════════════════════════════════════ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 툴바 */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.toolbar-btn:hover {
    background: var(--bg-hover);
}

.toolbar-btn svg {
    width: 18px;
    height: 18px;
}

.toolbar-btn.ai-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
}

.toolbar-btn.ai-btn:hover {
    opacity: 0.9;
}

.toolbar-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
}

.toolbar-btn.primary:hover {
    background: var(--accent-dark);
}

.toolbar h1 {
    font-size: 1.1rem;
    font-weight: 600;
}

.pro-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 8px;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* 워크스페이스 */
/* ═══════════════════════════════════════════════════════════════════ */
.workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 에디터 */
.editor {
    width: 50%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.editor-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.editor-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.editor-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 섹션 리스트 */
.sections-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.section-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all var(--transition);
}

.section-item:hover {
    border-color: var(--text-muted);
}

.section-item.dragging {
    opacity: 0.5;
    border-color: var(--accent);
}

.section-item.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.section-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    cursor: grab;
    color: var(--text-muted);
    flex-shrink: 0;
}

.section-handle:active {
    cursor: grabbing;
}

.section-handle svg {
    width: 18px;
    height: 18px;
}

.section-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
}

.section-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.section-icon {
    font-size: 1.1rem;
}

.section-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 토글 스위치 */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-input);
    border-radius: 22px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #fff;
}

/* 확장 버튼 */
.expand-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: transform var(--transition);
}

.expand-btn svg {
    width: 18px;
    height: 18px;
}

.expand-btn.active {
    transform: rotate(180deg);
}

/* 섹션 콘텐츠 */
.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 16px;
}

.section-content.expanded {
    max-height: 1000px;
    padding: 0 16px 16px;
}

/* 폼 요소 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group.full {
    grid-column: span 2;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.required {
    color: var(--danger);
}

input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
    font-family: inherit;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    background: var(--bg-card);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn input {
    flex: 1;
}

.input-unit {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.input-unit:focus-within {
    border-color: var(--accent);
}

.input-unit input {
    border: none;
    background: none;
    text-align: right;
}

.input-unit span {
    padding: 0 12px 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Mini AI 버튼 */
.mini-ai-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: opacity var(--transition);
    white-space: nowrap;
}

.mini-ai-btn:hover {
    opacity: 0.9;
}

.mini-ai-btn.full {
    width: 100%;
    margin-top: 8px;
}

/* 컬러 칩 */
.color-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.color-chip::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--c);
    border: 1px solid var(--border);
}

.color-chip:hover {
    border-color: var(--text-muted);
}

.color-chip.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.color-chip.add {
    border-style: dashed;
    border-color: var(--border);
}

.color-chip.add::before {
    display: none;
}

/* 사이즈 칩 */
.size-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.size-chip {
    width: 50px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.size-chip:hover {
    border-color: var(--text-muted);
}

.size-chip.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

/* 특징 리스트 */
.features-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.feature-icon {
    width: 50px;
    padding: 8px;
    text-align: center;
}

.feature-text {
    flex: 1;
}

.remove-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition);
}

.remove-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.add-item-btn {
    width: 100%;
    padding: 10px;
    background: none;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 8px;
}

.add-item-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* 소재 입력 */
.material-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.mat-name {
    flex: 2;
}

.mat-percent {
    flex: 1;
    text-align: center;
}

/* 세탁 아이콘 */
.wash-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wash-btn {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.wash-btn:hover {
    border-color: var(--text-muted);
}

.wash-btn.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

/* 타입 버튼 */
.type-btns {
    display: flex;
    gap: 8px;
}

.type-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.type-btn:hover {
    border-color: var(--text-muted);
}

.type-btn.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

/* 사이즈 테이블 */
.size-table-wrapper {
    overflow-x: auto;
    margin: 12px 0;
}

.size-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.size-table th,
.size-table td {
    padding: 10px;
    text-align: center;
    border: 1px solid var(--border);
}

.size-table th {
    background: var(--bg-input);
    font-weight: 500;
    color: var(--text-secondary);
}

.size-table input {
    width: 60px;
    padding: 6px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* 모델 정보 */
.model-info-inputs {
    display: flex;
    gap: 8px;
}

.model-info-inputs .input-unit {
    flex: 1;
}

.model-info-inputs select {
    flex: 1;
}

/* 빠른 주의사항 */
.quick-cautions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.quick-btn {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.quick-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* 리뷰 옵션 */
.review-templates {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.review-option:hover {
    border-color: var(--text-muted);
}

.review-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-light);
}

.review-option span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 이미지 업로드 */
.image-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--bg-input);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
}

.image-upload-area:hover,
.image-upload-area.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}

.image-upload-area svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.image-upload-area p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.image-upload-area span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.uploaded-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.uploaded-image {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.uploaded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uploaded-image .remove-img-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition);
}

.uploaded-image:hover .remove-img-btn {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* 미리보기 패널 */
/* ═══════════════════════════════════════════════════════════════════ */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
}

.preview-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
}

.preview-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.preview-tab:hover {
    color: var(--text-secondary);
}

.preview-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.preview-tab svg {
    width: 16px;
    height: 16px;
}

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

.preview-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.preview-btn:hover {
    background: var(--bg-hover);
}

.preview-btn svg {
    width: 18px;
    height: 18px;
}

/* 미리보기 프레임 */
.preview-frame {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 20px;
    overflow: auto;
}

.preview-frame.mobile iframe {
    width: 375px;
    max-width: 100%;
    height: 100%;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.preview-frame.pc iframe {
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.preview-frame iframe {
    border: none;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* 모달 */
/* ═══════════════════════════════════════════════════════════════════ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
}

.modal-content.large {
    max-width: 700px;
}

.modal-content.small {
    max-width: 350px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* 내보내기 탭 */
.export-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.export-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.export-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.code-block {
    background: #1E1E1E;
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 300px;
    overflow: auto;
    margin-bottom: 16px;
}

.code-block pre {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    color: #D4D4D4;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

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

.export-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.export-action-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.export-action-btn svg {
    width: 18px;
    height: 18px;
}

/* 저장된 템플릿 */
.saved-templates {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.saved-template-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
}

.saved-template-item span {
    font-size: 0.9rem;
}

.saved-template-item .template-actions {
    display: flex;
    gap: 6px;
}

.saved-template-item button {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.saved-template-item button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.saved-template-item button.delete:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* 색상 모달 */
#colorModal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#colorModal input[type="color"] {
    width: 100%;
    height: 60px;
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.confirm-btn {
    padding: 12px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    color: #000;
    cursor: pointer;
    transition: all var(--transition);
}

.confirm-btn:hover {
    background: var(--accent-dark);
}

/* AI 로딩 */
.ai-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    z-index: 2000;
}

.ai-loading.hidden {
    display: none;
}

.ai-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.ai-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--bg-input);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-loading p {
    color: #fff;
    font-size: 0.9rem;
}

/* 토스트 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 28px;
    background: var(--text-primary);
    color: var(--bg-main);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 숨김 클래스 */
.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* 반응형 */
/* ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 200;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .workspace {
        flex-direction: column;
    }

    .editor {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: span 1;
    }

    .template-cards {
        grid-template-columns: repeat(4, 1fr);
    }

    .toolbar h1 {
        display: none;
    }

    .uploaded-images {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 스크롤바 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-input);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
