/* Editor Toolbar - Admin Edit Mode */

/* Floating Toolbar */
.editor-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e293b;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 13px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.editor-toolbar.visible {
    transform: translateY(0);
}

.editor-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.editor-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.editor-toolbar-btn.active {
    background: #2563eb;
    border-color: #2563eb;
}

.editor-toolbar-btn.save-btn {
    background: #059669;
    border-color: #059669;
}

.editor-toolbar-btn.save-btn:hover {
    background: #047857;
}

.editor-toolbar-btn.save-btn:disabled {
    background: rgba(5, 150, 105, 0.4);
    cursor: not-allowed;
}

.editor-toolbar-btn.publish-btn {
    background: #7c3aed;
    border-color: #7c3aed;
}

.editor-toolbar-btn.publish-btn:hover {
    background: #6d28d9;
}

.editor-toolbar-btn.rollback-btn {
    background: #dc2626;
    border-color: #dc2626;
}

.editor-toolbar-btn.rollback-btn:hover {
    background: #b91c1c;
}

.editor-toolbar-status {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    margin-left: 8px;
}

/* Editable elements in edit mode */
.edit-mode [data-edit-field] {
    outline: 2px dashed #2563eb;
    outline-offset: 2px;
    cursor: text;
    position: relative;
    min-height: 1em;
    transition: outline-color 0.2s;
}

.edit-mode [data-edit-field]:hover {
    outline-color: #f59e0b;
    background: rgba(37, 99, 235, 0.04);
}

.edit-mode [data-edit-field]:focus {
    outline-color: #f59e0b;
    outline-style: solid;
    background: rgba(245, 158, 11, 0.05);
}

.edit-mode [data-edit-field][contenteditable="true"]::before {
    content: attr(data-edit-label);
    position: absolute;
    top: -18px;
    left: 0;
    font-size: 10px;
    font-weight: 600;
    color: #2563eb;
    background: white;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid #2563eb;
    font-family: 'Noto Sans KR', sans-serif;
    pointer-events: none;
    z-index: 10;
}

/* Edit mode textarea for long content */
.edit-mode-textarea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 2px solid #2563eb;
    border-radius: 8px;
    font-family: 'Noto Serif KR', serif;
    font-size: 16px;
    line-height: 1.8;
    color: #1e293b;
    resize: vertical;
    outline: none;
    background: #fefce8;
}

.edit-mode-textarea:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Image edit overlay */
.edit-mode .editable-image-wrapper {
    position: relative;
    cursor: pointer;
}

.edit-mode .editable-image-wrapper::after {
    content: "Click to change image URL";
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Noto Sans KR', sans-serif;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.edit-mode .editable-image-wrapper:hover::after {
    opacity: 1;
}

/* Version Panel */
.version-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    font-family: 'Noto Sans KR', sans-serif;
}

.version-panel.open {
    right: 0;
}

.version-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.version-panel-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.version-panel-close {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.version-panel-close:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #dc2626;
}

.version-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.version-type-select {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.version-type-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    transition: all 0.2s;
}

.version-type-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.version-type-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.version-item:hover {
    border-color: #2563eb;
    background: #f0f7ff;
}

.version-item.selected {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.version-item-info {
    flex: 1;
    min-width: 0;
}

.version-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.version-number {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}

.version-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.version-status.published {
    background: #dcfce7;
    color: #166534;
}

.version-status.draft {
    background: #fef3c7;
    color: #92400e;
}

.version-status.backup {
    background: #e2e8f0;
    color: #475569;
}

.version-item-desc {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.version-item-meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.version-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.version-action-btn {
    padding: 5px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s;
}

.version-action-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #f0f7ff;
}

.version-action-btn.restore-btn:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: #fef2f2;
}

/* Version panel overlay */
.version-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: none;
}

.version-panel-overlay.open {
    display: block;
}

/* Notification toast for editor */
.editor-toast {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: white;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Noto Sans KR', sans-serif;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s;
    z-index: 10001;
    pointer-events: none;
}

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

.editor-toast.success {
    background: #059669;
}

.editor-toast.error {
    background: #dc2626;
}

/* Section page editable elements in edit mode */
.edit-mode .section-editable {
    outline: 2px dashed #2563eb;
    outline-offset: 2px;
    cursor: text;
    position: relative;
    min-height: 1em;
    transition: outline-color 0.2s, background 0.2s;
    border-radius: 4px;
}

.edit-mode .section-editable:hover {
    outline-color: #f59e0b;
    background: rgba(37, 99, 235, 0.04);
}

.edit-mode .section-editable:focus {
    outline-color: #f59e0b;
    outline-style: solid;
    background: rgba(245, 158, 11, 0.05);
}

.edit-mode .section-editable-img {
    cursor: pointer;
    outline: 2px dashed #059669;
    outline-offset: 2px;
    transition: outline-color 0.2s, filter 0.2s;
}

.edit-mode .section-editable-img:hover {
    outline-color: #f59e0b;
    filter: brightness(0.9);
}

.edit-mode .section-editable-img::after {
    content: "Click to change image";
}

/* Add padding to body when toolbar is visible */
body.editor-toolbar-active {
    padding-bottom: 56px;
}

/* Responsive */
@media (max-width: 768px) {
    .editor-toolbar {
        gap: 4px;
        padding: 8px 10px;
        flex-wrap: wrap;
    }

    .editor-toolbar-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .editor-toolbar-btn .btn-text {
        display: none;
    }

    .version-panel {
        width: 100%;
        max-width: 100vw;
    }
}
