/* Custom Page Editor Styles */

/* Editor Toggle Button */
.custom-editor-toggle {
    background: #0073aa !important;
    color: white !important;
    border-radius: 3px !important;
    padding: 5px 10px !important;
}

.custom-editor-toggle:hover {
    background: #005a87 !important;
}

/* Editor Panel */
.custom-editor-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 999999;
    transition: right 0.3s ease;
    overflow-y: auto;
    border-left: 1px solid #ddd;
}

.custom-editor-panel.active {
    right: 0;
}

.editor-panel-header {
    background: #0073aa;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-panel-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

.editor-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.editor-close-btn:hover {
    background: rgba(255,255,255,0.2);
}

.editor-panel-content {
    padding: 20px;
}

/* Editor Sections */
.editor-section {
    margin-bottom: 30px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.editor-section-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-section-title {
    font-size: 16px;
    font-weight: bold;
    margin: 0;
    color: #333;
}

.editor-section-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
}

.editor-section-content {
    padding: 20px;
    display: none;
}

.editor-section.active .editor-section-content {
    display: block;
}

/* Form Elements */
.editor-form-group {
    margin-bottom: 20px;
}

.editor-form-label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.editor-form-input,
.editor-form-textarea,
.editor-form-select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.editor-form-input:focus,
.editor-form-textarea:focus,
.editor-form-select:focus {
    outline: none;
    border-color: #0073aa;
}

.editor-form-textarea {
    resize: vertical;
    min-height: 80px;
}

.editor-form-color {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Buttons */
.editor-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.editor-btn:hover {
    background: #005a87;
}

.editor-btn-secondary {
    background: #6c757d;
}

.editor-btn-secondary:hover {
    background: #5a6268;
}

.editor-btn-success {
    background: #28a745;
}

.editor-btn-success:hover {
    background: #218838;
}

/* Live Preview */
.live-preview {
    position: relative;
    border: 2px solid #0073aa;
    border-radius: 5px;
    margin: 10px 0;
}

.live-preview::before {
    content: "Live Preview";
    position: absolute;
    top: -12px;
    left: 10px;
    background: #0073aa;
    color: white;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 3px;
    z-index: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .custom-editor-panel {
        width: 100%;
        right: -100%;
    }
    
    .editor-panel-content {
        padding: 15px;
    }
    
    .editor-section-content {
        padding: 15px;
    }
}

/* Animation */
@keyframes slideIn {
    from {
        right: -400px;
    }
    to {
        right: 0;
    }
}

@keyframes slideOut {
    from {
        right: 0;
    }
    to {
        right: -400px;
    }
}

.custom-editor-panel.slide-in {
    animation: slideIn 0.3s ease;
}

.custom-editor-panel.slide-out {
    animation: slideOut 0.3s ease;
}

/* Overlay */
.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999998;
    display: none;
}

.editor-overlay.active {
    display: block;
}

/* Loading State */
.editor-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.editor-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success Message */
.editor-success {
    background: #d4edda;
    color: #155724;
    padding: 10px 15px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid #c3e6cb;
}

/* Error Message */
.editor-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid #f5c6cb;
}

/* Quick Edit Buttons */
.quick-edit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #0073aa;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.editable-section:hover .quick-edit-btn {
    opacity: 1;
}

/* Section Highlight */
.editable-section {
    position: relative;
    transition: all 0.3s ease;
}

.editable-section:hover {
    outline: 2px dashed #0073aa;
    outline-offset: 2px;
}

.editable-section.editing {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    background: rgba(0,115,170,0.1);
}

/* Color Picker */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-preview {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 2px solid #ddd;
    cursor: pointer;
}

/* Icon Picker */
.icon-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
}

.icon-option {
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s ease;
    font-size: 20px;
}

.icon-option:hover {
    background: #f8f9fa;
}

.icon-option.selected {
    background: #0073aa;
    color: white;
}

/* Drag and Drop */
.draggable-item {
    cursor: move;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    background: white;
    transition: all 0.3s ease;
}

.draggable-item:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.draggable-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.drop-zone {
    border: 2px dashed #0073aa;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    color: #0073aa;
    background: rgba(0,115,170,0.1);
    margin: 10px 0;
}

.drop-zone.active {
    background: rgba(0,115,170,0.2);
    border-color: #005a87;
}

/* Tooltip */
.editor-tooltip {
    position: relative;
    cursor: help;
}

.editor-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.editor-tooltip:hover::after {
    opacity: 1;
}
