/* css/style.css */

/* =============================================================== */
/* 🎨 Dashboard Global Styles */
/* =============================================================== */
body { font-family: 'Noto Sans KR', sans-serif; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1e293b; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

#view-title[contenteditable="true"] {
    cursor: text; padding: 5px 10px; border-radius: 6px; outline: none; transition: all 0.2s;
}
#view-title[contenteditable="true"]:hover { background-color: #334155; }
#view-title[contenteditable="true"]:focus {
    background-color: #0f172a; box-shadow: 0 0 0 2px var(--primary-color, #34d399);
}

.button-disabled { background-color: #475569; cursor: not-allowed; }
.spinner {
    border: 2px solid rgba(255, 255, 255, 0.2); border-radius: 50%; border-top-color: #fff;
    width: 16px; height: 16px; animation: spin 1s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.nav-link { border-left: 3px solid transparent; transition: all 0.2s; }
.nav-link.active { background-color: #1e293b; color: #34d399; border-left-color: #34d399; }
.nav-link.active svg { stroke: #34d399; }

.toggle-switch { position: relative; display: inline-block; width: 50px; height: 30px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #475569; transition: .4s; border-radius: 30px; }
.toggle-slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .toggle-slider { background-color: #34d399; }
input:checked + .toggle-slider:before { transform: translateX(20px); }

/* =============================================================== */
/* 📝 Page Editor Styles */
/* =============================================================== */
#editor-view { --primary-color: #34d399; --background-color: #1e293b; --panel-bg: #0f172a; --text-color: #e2e8f0; --border-color: #334155; --input-bg: #1e293b; }
.editor-main-container { display: flex; gap: 0; width: 100%; height: 100%; align-items: stretch; }
#editor-controls-wrapper { flex: 0 0 400px; position: relative; max-height: 100%; overflow-y: auto; background-color: #020617; }
.editor-control-panel { padding: 25px; }
.editor-control-panel h2, .editor-control-panel h3 { color: var(--text-color); border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-top: 0; }
#editor-preview-container { flex: 1; display: flex; flex-direction: column; }
.editor-panel { border: 1px solid var(--border-color); border-radius: 8px; padding: 15px; margin-bottom: 15px; background-color: var(--panel-bg); }
.editor-panel.selected { border-color: var(--primary-color); box-shadow: 0 0 10px rgba(52, 211, 153, 0.3); }
.editor-panel h4 { margin: 0 0 15px 0; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; cursor: grab; color: var(--text-color); }
.editor-panel.sortable-ghost { background: #1e293b; opacity: 0.5; }
.panel-controls .delete-btn { background: none; border: none; cursor: pointer; font-size: 18px; padding: 5px; color: #94a3b8; }
.panel-controls .delete-btn:hover { color: #f87171; }
.control-group { margin-bottom: 15px; }
.control-group label { display: block; margin-bottom: 5px; color: #94a3b8; font-weight: 500; font-size: 14px; }
.control-group button, .control-group select, .viewport-btn { cursor: pointer; }
.control-group button, .control-group select, .control-group input, .control-group textarea { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 16px; background-color: var(--input-bg); color: var(--text-color); }
.control-group button { background-color: var(--primary-color); color: black; font-weight: bold; }

.inline-group { display: flex; align-items: center; }
.inline-group label { margin-bottom: 0; margin-right: 10px; flex-shrink: 0; }
.style-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px; align-items: end; }
.style-grid .control-group { margin-bottom: 0; }
.style-grid + .control-group { margin-top: 15px; }

.clr-field { border: 1px solid var(--border-color) !important; border-radius: 6px !important; }
.clr-field button { width: 42px !important; height: 42px !important; border-radius: 6px !important; }
.clr-field input { background-color: var(--input-bg) !important; color: var(--text-color) !important; padding-left: 10px !important; }
.inline-group .clr-field { width: 120px; flex-shrink: 0; }

.viewport-controls { display: flex; justify-content: center; gap: 5px; padding: 10px; }
.viewport-btn { background-color: #334155; border: 1px solid #475569; color: var(--text-color); padding: 8px 12px; font-size: 14px; border-radius: 6px; }
.viewport-btn.active { background-color: var(--primary-color); color: black; border-color: var(--primary-color); }
#editor-preview-wrapper { width: 100%; flex-grow: 1; background-color: var(--background-color); display: flex; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; }
#editor-preview { background-color: var(--panel-bg); border-radius: 8px; position: relative; overflow: hidden; transition: all 0.4s ease-in-out; box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
#editor-preview.has-background { color: white; }
#editor-preview .background-video { position: absolute; top: 50%; left: 50%; width: auto; height: auto; min-width: 100%; min-height: 100%; transform: translate(-50%, -50%); z-index: 0; }
#editor-preview .background-image-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; z-index: 1; transition: background-image: 0.3s; }
#editor-preview .background-image-overlay::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.4); z-index: 2; }
#editor-preview .content-area { position: relative; z-index: 3; display: flex; flex-direction: column; height: 100%; padding: 40px; box-sizing: border-box; }
.preview-wrapper { width: 100%; padding: 10px 0; border: 2px solid transparent; transition: all 0.3s; cursor: pointer; }
.preview-wrapper.selected { background-color: rgba(52, 211, 153, 0.1); border-radius: 8px; }
.preview-wrapper .component-content { text-shadow: 1px 1px 3px rgba(0,0,0,0.5); }

/* =============================================================== */
/* 🗂️ Content Card Styles */
/* =============================================================== */
.drag-handle { cursor: grab; }
.sortable-ghost { background: #334155; opacity: 0.5; }

.form-container-mobile {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: flex-start;
    overflow-y: auto; z-index: 50;
    opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s;
}
.form-container-mobile.active { 
    opacity: 1; visibility: visible; 
}

#media-upload-status { transition: opacity 0.3s; }
.preview-media-container {
    position: relative; width: 100%; padding-top: 56.25%; background-color: #1e293b; border-radius: 0.5rem;
}
.preview-media-container img,
.preview-media-container video {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0.5rem;
}
.progress-bar {
    width: 100%; background-color: #334155; border-radius: 9999px; height: 8px; overflow: hidden;
}
.progress-bar-fill {
    background-color: #34d399; height: 100%; width: 0%; transition: width 0.2s ease-in-out;
}
.file-input-button {
    display: inline-block; padding: 0.75rem 1.25rem; background-color: #4f46e5; color: white;
    border-radius: 0.5rem; cursor: pointer; font-weight: 500; transition: background-color 0.2s;
}
.file-input-button:hover { background-color: #4338ca; }
.file-input-hidden { display: none; }
.status-badge {
    font-size: 0.75rem; font-weight: 600; padding: 0.125rem 0.5rem; border-radius: 9999px;
}

/* css/style.css 파일 맨 아래에 추가 */

/* =============================================================== */
/* 🖼️ Page Management Card View Styles */
/* =============================================================== */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.page-card {
    background-color: #1e293b; /* bg-slate-800 */
    border-radius: 0.75rem; /* rounded-xl */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.page-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.page-card-preview {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-size: cover;
    background-position: center;
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
}

.page-card-preview h4 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem; /* text-xl */
    font-weight: 700; /* font-bold */
    padding: 0.5rem 1rem;
    background-color: rgba(0,0,0,0.4);
    border-radius: 0.5rem;
    text-align: center;
    width: calc(100% - 2rem);
}

.page-card-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.page-card-info {
    font-size: 0.875rem; /* text-sm */
    color: #94a3b8; /* text-slate-400 */
    margin-bottom: 1rem;
}

.page-card-actions {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid #334155; /* border-slate-700 */
    padding-top: 1rem;
}

.page-card-actions .publish-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-card-actions .action-buttons {
    display: flex;
    gap: 0.5rem;
}

.page-card-actions .action-buttons button {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 9999px; /* rounded-full */
    transition: background-color 0.2s;
}

.page-card-actions .action-buttons button:hover {
    background-color: #334155; /* bg-slate-700 */
}

/* css/style.css 파일 맨 아래에 추가 */

/* =============================================================== */
/* 🗂️ Content Card Management Card View Styles */
/* =============================================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.content-card {
    background-color: #1e293b; /* bg-slate-800 */
    border-radius: 0.75rem; /* rounded-xl */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.content-card-preview {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #0f172a; /* bg-slate-900 */
}

.content-card-preview img,
.content-card-preview video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.content-card-type-icon {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(0,0,0,0.6);
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border: 1px solid rgba(255,255,255,0.2);
}

.content-card-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.content-card-header {
    margin-bottom: 0.5rem;
}

.content-card-header .title {
    font-weight: 700;
    color: #f1f5f9; /* text-slate-100 */
    /* 긴 제목은 말줄임표(...) 처리 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-card-info {
    font-size: 0.75rem; /* text-xs */
    color: #94a3b8; /* text-slate-400 */
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.content-card-actions {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid #334155; /* border-slate-700 */
    padding-top: 1rem;
}

.content-card-actions .publish-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-card-actions .action-buttons {
    display: flex;
    gap: 0.5rem;
}

.content-card-actions .action-buttons button {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 9999px; /* rounded-full */
    transition: background-color 0.2s;
}

.content-card-actions .action-buttons button:hover {
    background-color: #334155; /* bg-slate-700 */
}

/* css/style.css 파일 맨 아래에 추가 */

.content-card-drag-handle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    cursor: grab;
    padding: 0.5rem;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.2s;
}
.content-card-drag-handle:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* 미디어가 없을 때 미리보기 영역의 배경을 더 밝게 */
.content-card-preview.no-media {
    background-color: #334155; /* bg-slate-700 */
    border: 1px dashed rgba(255, 255, 255, 0.2); /* 점선 테두리 추가 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1; /* text-slate-300 */
    font-size: 0.9rem;
}

.content-card-preview.no-media::before {
    content: "미디어 없음";
}
/* css/style.css 파일 맨 아래에 추가 */

/* =============================================================== */
/* 🎨 Add Content Modal Styles */
/* =============================================================== */
.tab-button {
    flex: 1;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: #94a3b8; /* text-slate-400 */
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.tab-button:hover {
    background-color: #1e293b; /* bg-slate-800 */
}
.tab-button.active {
    color: #34d399; /* text-emerald-400 */
    border-bottom-color: #34d399; /* border-emerald-400 */
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

.add-content-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}
.add-content-item:hover {
    background-color: #334155; /* bg-slate-700 */
}
.add-content-item .item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.add-content-item .item-info .preview {
    width: 3rem;
    height: 3rem;
    border-radius: 0.375rem;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.add-content-item .item-info .title {
    font-weight: 500;
}

.add-content-item .add-button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    background-color: #34d399; /* bg-emerald-500 */
    color: #1e293b;
    cursor: pointer;
    transition: background-color 0.2s;
}
.add-content-item .add-button:hover {
    background-color: #10b981; /* bg-emerald-600 */
}
.add-content-item .add-button:disabled {
    background-color: #475569; /* bg-slate-600 */
    color: #94a3b8;
    cursor: not-allowed;
}
/* css/style.css */

/* --- Toast Notification Styles --- */
.toast-notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 1;
  transition: opacity 0.5s ease, bottom 0.5s ease;
  animation: slide-in 0.5s ease forwards;
}

.toast-notification.success {
  background-color: #10B981; /* Emerald 500 */
}

.toast-notification.error {
  background-color: #EF4444; /* Red 500 */
}

.toast-notification.fade-out {
  opacity: 0;
  bottom: 0px;
}

@keyframes slide-in {
  from {
    opacity: 0;
    bottom: 0px;
  }
  to {
    opacity: 1;
    bottom: 20px;
  }
}

/* ✨ [추가] 스토리 페이지일 때 페이지 배경 설정 UI를 비활성화하는 스타일 */
#page-background-controls.is-disabled {
    opacity: 0.4;
    pointer-events: none; /* 클릭 등 모든 마우스 이벤트 비활성화 */
    transition: opacity 0.3s ease;
}

#page-background-controls.is-disabled h3 {
    text-decoration: line-through; /* 취소선 효과 */
}

/* ✨ [추가] 장면 미리보기 wrapper가 항상 꽉 차도록 설정 */
.preview-wrapper.scene-preview-active {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    text-align: center;
}