/* ADMIN PAGE BUILDER STYLES */

/* Layout & Container */
.builder-container {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin: 0 15px;
}

/* Builder Toolbar */
.builder-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 15px;
    border-radius: 8px 8px 0 0;
}

.builder-tools {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tool-group {
    display: flex;
    gap: 5px;
    padding: 5px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.tool-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #495057;
    font-size: 14px;
}

.tool-btn:hover {
    background: #e9ecef;
    color: #007bff;
}

.tool-btn.active {
    background: #007bff;
    color: white;
}

/* Module Palette */
.module-palette {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.module-palette h5 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.module-item {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.module-item:hover {
    border-color: #007bff;
    background: #e3f2fd;
    transform: translateY(-2px);
}

.module-item.dragging {
    opacity: 0.7;
    cursor: grabbing;
}

.module-icon {
    font-size: 24px;
    color: #6c757d;
    margin-bottom: 8px;
    display: block;
}

.module-name {
    font-weight: 500;
    color: #495057;
    margin: 0;
    font-size: 14px;
}

/* Canvas Area */
.builder-canvas {
    min-height: 500px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
    position: relative;
}

.canvas-content {
    padding: 20px;
}

.drop-zone {
    min-height: 200px;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 16px;
    transition: all 0.2s ease;
}

.drop-zone.drag-over {
    border-color: #007bff;
    background: #e3f2fd;
    color: #007bff;
}

.drop-zone.has-content {
    border: none;
    background: transparent;
    min-height: 0;
}

/* Editable Modules */
.builder-module {
    position: relative;
    margin: 10px 0;
    border: 2px transparent solid;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.builder-module:hover {
    border-color: #007bff;
}

.builder-module.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

.module-controls {
    position: absolute;
    top: -35px;
    right: 0;
    background: #007bff;
    border-radius: 4px;
    display: none;
    z-index: 100;
}

.builder-module:hover .module-controls,
.builder-module.selected .module-controls {
    display: flex;
}

.control-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
}

.control-btn:hover {
    background: rgba(255,255,255,0.2);
}

.control-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.control-btn:last-child {
    border-radius: 0 4px 4px 0;
}

/* Properties Panel */
.properties-panel {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

.properties-panel h5 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.color-picker {
    width: 50px;
    height: 35px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
}

.range-input {
    width: 100%;
}

/* Save Indicator */
.save-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999;
}

.save-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

.save-indicator.saving {
    background: #ffc107;
    color: #000;
}

.save-indicator.error {
    background: #dc3545;
}

/* Responsive Design */
@media (max-width: 768px) {
    .builder-container {
        margin: 0 10px;
    }
    
    .module-grid {
        grid-template-columns: 1fr;
    }
    
    .builder-tools {
        justify-content: center;
    }
    
    .tool-group {
        flex-wrap: wrap;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .builder-container {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .builder-toolbar {
        background: #4a5568;
        border-color: #718096;
    }
    
    .module-palette,
    .properties-panel {
        background: #2d3748;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .module-item {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .module-item:hover {
        background: #2b6cb0;
        border-color: #3182ce;
    }
    
    .form-control {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
}

/* Animation for drag and drop */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.module-added {
    animation: slideIn 0.3s ease;
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}