/**
* Demonstration System Module for AlgorithmPress
* A system for showcasing and generating demo applications
*/
const DemoSystem = (function() {
'use strict';
// Module state
let _initialized = false;
let _panel = null;
let _panelVisible = false;
// Demo categories
const _categories = [
{
id: 'web-app',
name: 'Web Applications',
description: 'Web-based applications and demos',
icon: 'globe'
},
{
id: 'business',
name: 'Business Applications',
description: 'Business management and productivity tools',
icon: 'briefcase'
},
{
id: 'education',
name: 'Educational Resources',
description: 'Learning materials and interactive education tools',
icon: 'graduation-cap'
},
{
id: 'productivity',
name: 'Productivity Tools',
description: 'Tools to enhance productivity and workflow',
icon: 'tasks'
},
{
id: 'games',
name: 'Games & Entertainment',
description: 'Interactive games and entertainment applications',
icon: 'gamepad'
}
];
// Demo templates
const _templates = [
{
id: 'todo-app',
name: 'Todo Application',
description: 'A simple todo list application with CRUD operations',
category: 'productivity',
image: 'todo-app.jpg',
difficulty: 'beginner',
technologies: ['PHP', 'HTML', 'CSS', 'JavaScript'],
features: [
'Add, edit, and delete tasks',
'Mark tasks as complete',
'Filter tasks by status',
'Local storage persistence'
]
},
{
id: 'blog-system',
name: 'Blog System',
description: 'A functional blog system with posts and comments',
category: 'web-app',
image: 'blog-system.jpg',
difficulty: 'intermediate',
technologies: ['PHP', 'MySQL', 'Bootstrap', 'jQuery'],
features: [
'Create and manage blog posts',
'Comment system',
'Categories and tags',
'User authentication'
]
},
{
id: 'e-commerce',
name: 'E-Commerce Store',
description: 'A simple e-commerce store with product listings and cart',
category: 'business',
image: 'e-commerce.jpg',
difficulty: 'advanced',
technologies: ['PHP', 'MySQL', 'Bootstrap', 'JavaScript'],
features: [
'Product catalog',
'Shopping cart',
'Checkout process',
'Order management'
]
},
{
id: 'quiz-app',
name: 'Interactive Quiz',
description: 'An interactive quiz application with multiple choice questions',
category: 'education',
image: 'quiz-app.jpg',
difficulty: 'beginner',
technologies: ['PHP', 'HTML', 'CSS', 'JavaScript'],
features: [
'Multiple choice questions',
'Score tracking',
'Timer',
'Results summary'
]
},
{
id: 'memory-game',
name: 'Memory Game',
description: 'A card matching memory game',
category: 'games',
image: 'memory-game.jpg',
difficulty: 'beginner',
technologies: ['HTML', 'CSS', 'JavaScript'],
features: [
'Card matching gameplay',
'Score tracking',
'Timer',
'Difficulty levels'
]
},
{
id: 'inventory-system',
name: 'Inventory Management',
description: 'An inventory management system for small businesses',
category: 'business',
image: 'inventory-system.jpg',
difficulty: 'intermediate',
technologies: ['PHP', 'MySQL', 'Bootstrap', 'jQuery'],
features: [
'Product management',
'Stock tracking',
'Order processing',
'Reports and analytics'
]
},
{
id: 'weather-app',
name: 'Weather Dashboard',
description: 'A weather dashboard showing current conditions and forecast',
category: 'web-app',
image: 'weather-app.jpg',
difficulty: 'intermediate',
technologies: ['PHP', 'JavaScript', 'APIs', 'Chart.js'],
features: [
'Current weather conditions',
'5-day forecast',
'Location search',
'Weather maps'
]
},
{
id: 'chat-application',
name: 'Chat Application',
description: 'A real-time chat application',
category: 'web-app',
image: 'chat-application.jpg',
difficulty: 'advanced',
technologies: ['PHP', 'WebSockets', 'JavaScript', 'MySQL'],
features: [
'Real-time messaging',
'User authentication',
'Message history',
'User presence indicators'
]
},
{
id: 'flashcards',
name: 'Flashcard Study App',
description: 'A flashcard application for studying',
category: 'education',
image: 'flashcards.jpg',
difficulty: 'beginner',
technologies: ['PHP', 'HTML', 'CSS', 'JavaScript'],
features: [
'Create and manage flashcard decks',
'Study mode with card flipping',
'Progress tracking',
'Spaced repetition algorithm'
]
},
{
id: 'snake-game',
name: 'Snake Game',
description: 'A classic snake game implementation',
category: 'games',
image: 'snake-game.jpg',
difficulty: 'intermediate',
technologies: ['HTML', 'CSS', 'JavaScript'],
features: [
'Classic snake gameplay',
'Score tracking',
'Increasing difficulty',
'Game over and restart'
]
},
{
id: 'kanban-board',
name: 'Kanban Board',
description: 'A Kanban board for task management',
category: 'productivity',
image: 'kanban-board.jpg',
difficulty: 'intermediate',
technologies: ['PHP', 'MySQL', 'JavaScript', 'Drag & Drop API'],
features: [
'Customizable columns',
'Drag and drop task cards',
'Task details and comments',
'Progress tracking'
]
},
{
id: 'note-taking',
name: 'Note Taking App',
description: 'A simple note taking application',
category: 'productivity',
image: 'note-taking.jpg',
difficulty: 'beginner',
technologies: ['PHP', 'HTML', 'CSS', 'JavaScript'],
features: [
'Create, edit, and delete notes',
'Rich text editor',
'Tags and categories',
'Search functionality'
]
}
];
// Current selected category
let _selectedCategory = 'all';
// Current selected template
let _selectedTemplate = null;
/**
* Initialize the demo system
* @param {Object} options - Initialization options
* @returns {Promise} Promise that resolves when initialization is complete
*/
function initialize(options = {}) {
return new Promise((resolve) => {
if (_initialized) {
console.warn('Demo system already initialized');
resolve();
return;
}
console.log('Initializing Demo System...');
// Create panel
createPanel();
// Register with module framework if available
if (window.ModuleFramework) {
window.ModuleFramework.registerModule({
id: 'demo-system',
name: 'Demonstration System',
version: '1.0.0',
instance: DemoSystem,
status: window.ModuleFramework.MODULE_STATUS.ACTIVE
});
}
// Register Demo System API if API Gateway is available
if (window.ApiGateway) {
window.ApiGateway.registerApi({
namespace: 'demo-system',
provider: 'demo-system',
version: '1.0.0',
description: 'Demo System API for accessing demo templates',
methods: {
getCategories: {
handler: function() {
return _categories;
},
permissions: ['*'],
description: 'Get all demo categories'
},
getTemplates: {
handler: function(params) {
const category = params.category || 'all';
return getTemplatesByCategory(category);
},
permissions: ['*'],
description: 'Get demo templates by category',
schema: {
properties: {
category: { type: 'string' }
}
}
},
getTemplate: {
handler: function(params) {
return getTemplateById(params.id);
},
permissions: ['*'],
description: 'Get demo template by ID',
schema: {
required: ['id'],
properties: {
id: { type: 'string' }
}
}
}
}
});
}
_initialized = true;
console.log('Demo System initialized');
resolve();
});
}
/**
* Create demo system panel
*/
function createPanel() {
// Check if panel already exists
if (_panel) return;
// Create panel element
_panel = document.createElement('div');
_panel.id = 'demo-system-panel';
_panel.className = 'system-panel demo-system-panel hidden';
_panel.innerHTML = `
`;
// Add to document
document.body.appendChild(_panel);
// Add close button event listener
document.getElementById('demo-system-close-btn')?.addEventListener('click', function() {
togglePanel();
});
// Add category selection
document.querySelectorAll('.category-item').forEach(item => {
item.addEventListener('click', function() {
// Update selected category
_selectedCategory = this.getAttribute('data-category');
// Update active class
document.querySelectorAll('.category-item').forEach(cat => {
cat.classList.remove('active');
});
this.classList.add('active');
// Load templates for selected category
loadTemplates();
});
});
// Add view option selection
document.querySelectorAll('.view-option').forEach(option => {
option.addEventListener('click', function() {
// Update active class
document.querySelectorAll('.view-option').forEach(opt => {
opt.classList.remove('active');
});
this.classList.add('active');
// Update view mode
const viewMode = this.getAttribute('data-view');
const templatesContainer = document.getElementById('demo-templates');
if (viewMode === 'grid') {
templatesContainer.classList.remove('view-list');
templatesContainer.classList.add('view-grid');
} else {
templatesContainer.classList.remove('view-grid');
templatesContainer.classList.add('view-list');
}
});
});
// Add search functionality
document.getElementById('demo-search-btn')?.addEventListener('click', function() {
const searchQuery = document.getElementById('demo-search-input').value.toLowerCase();
searchTemplates(searchQuery);
});
document.getElementById('demo-search-input')?.addEventListener('keyup', function(e) {
if (e.key === 'Enter') {
const searchQuery = this.value.toLowerCase();
searchTemplates(searchQuery);
}
});
// Add filter functionality
document.querySelectorAll('.filter-option input').forEach(filter => {
filter.addEventListener('change', function() {
loadTemplates();
});
});
// Load initial templates
loadTemplates();
}
/**
* Load templates for the selected category
*/
function loadTemplates() {
const templatesContainer = document.getElementById('demo-templates');
if (!templatesContainer) return;
// Get templates for selected category
let templates = getTemplatesByCategory(_selectedCategory);
// Apply filters
const selectedDifficulties = Array.from(document.querySelectorAll('.filter-option input[type="checkbox"][value="beginner"], .filter-option input[type="checkbox"][value="intermediate"], .filter-option input[type="checkbox"][value="advanced"]'))
.filter(input => input.checked)
.map(input => input.value);
const selectedTechnologies = Array.from(document.querySelectorAll('.filter-option input[type="checkbox"][value="PHP"], .filter-option input[type="checkbox"][value="JavaScript"], .filter-option input[type="checkbox"][value="MySQL"]'))
.filter(input => input.checked)
.map(input => input.value);
if (selectedDifficulties.length > 0) {
templates = templates.filter(template => selectedDifficulties.includes(template.difficulty));
}
if (selectedTechnologies.length > 0) {
templates = templates.filter(template => {
return template.technologies.some(tech => selectedTechnologies.includes(tech));
});
}
// Render templates
if (templates.length === 0) {
templatesContainer.innerHTML = `
`;
return;
}
let html = '';
templates.forEach(template => {
html += `
${template.name}
${template.description}
${capitalize(template.difficulty)}
${getCategoryName(template.category)}
Preview
Create
`;
});
templatesContainer.innerHTML = html;
// Add template card click events
document.querySelectorAll('.template-card').forEach(card => {
card.addEventListener('click', function(e) {
// Ignore clicks on buttons
if (e.target.closest('.template-actions')) return;
const templateId = this.getAttribute('data-template-id');
showTemplateDetails(templateId);
});
});
// Add preview button click events
document.querySelectorAll('.template-preview-btn').forEach(button => {
button.addEventListener('click', function(e) {
e.stopPropagation();
const templateId = this.getAttribute('data-template-id');
previewTemplate(templateId);
});
});
// Add create button click events
document.querySelectorAll('.template-create-btn').forEach(button => {
button.addEventListener('click', function(e) {
e.stopPropagation();
const templateId = this.getAttribute('data-template-id');
createFromTemplate(templateId);
});
});
}
/**
* Search templates by query
* @param {string} query - Search query
*/
function searchTemplates(query) {
const templatesContainer = document.getElementById('demo-templates');
if (!templatesContainer) return;
if (!query) {
loadTemplates();
return;
}
// Filter templates by query
const filteredTemplates = _templates.filter(template => {
return (
template.name.toLowerCase().includes(query) ||
template.description.toLowerCase().includes(query) ||
template.category.toLowerCase().includes(query) ||
template.technologies.some(tech => tech.toLowerCase().includes(query))
);
});
// Update templates display
if (filteredTemplates.length === 0) {
templatesContainer.innerHTML = `
No templates found for "${query}"
`;
return;
}
let html = '';
filteredTemplates.forEach(template => {
html += `
${template.name}
${template.description}
${capitalize(template.difficulty)}
${getCategoryName(template.category)}
Preview
Create
`;
});
templatesContainer.innerHTML = html;
// Add template card click events
document.querySelectorAll('.template-card').forEach(card => {
card.addEventListener('click', function(e) {
// Ignore clicks on buttons
if (e.target.closest('.template-actions')) return;
const templateId = this.getAttribute('data-template-id');
showTemplateDetails(templateId);
});
});
// Add preview button click events
document.querySelectorAll('.template-preview-btn').forEach(button => {
button.addEventListener('click', function(e) {
e.stopPropagation();
const templateId = this.getAttribute('data-template-id');
previewTemplate(templateId);
});
});
// Add create button click events
document.querySelectorAll('.template-create-btn').forEach(button => {
button.addEventListener('click', function(e) {
e.stopPropagation();
const templateId = this.getAttribute('data-template-id');
createFromTemplate(templateId);
});
});
}
/**
* Show template details
* @param {string} templateId - Template ID
*/
function showTemplateDetails(templateId) {
const template = getTemplateById(templateId);
if (!template) return;
// Store selected template
_selectedTemplate = template;
// Update UI
document.querySelector('.demo-system-container').classList.add('hidden');
const detailsContainer = document.getElementById('demo-details');
detailsContainer.classList.remove('hidden');
detailsContainer.innerHTML = `
Description
${template.description}
Technologies
${template.technologies.map(tech => `
${tech}
`).join('')}
Features
${template.features.map(feature => `
${feature}
`).join('')}
Preview Demo
Create From Template
`;
// Add back button event
detailsContainer.querySelector('.back-btn')?.addEventListener('click', function() {
document.querySelector('.demo-system-container').classList.remove('hidden');
detailsContainer.classList.add('hidden');
_selectedTemplate = null;
});
// Add preview button event
detailsContainer.querySelector('.template-preview-btn-full')?.addEventListener('click', function() {
previewTemplate(templateId);
});
// Add create button event
detailsContainer.querySelector('.template-create-btn-full')?.addEventListener('click', function() {
createFromTemplate(templateId);
});
}
/**
* Preview a template
* @param {string} templateId - Template ID
*/
function previewTemplate(templateId) {
const template = getTemplateById(templateId);
if (!template) return;
// Create preview dialog
const dialog = document.createElement('div');
dialog.className = 'modal-overlay';
dialog.innerHTML = `
`;
// Add to document
document.body.appendChild(dialog);
// Simulate loading preview
const iframe = dialog.querySelector('iframe');
iframe.onload = function() {
if (iframe.src === 'about:blank') {
// Generate preview HTML based on template
let previewHtml = '';
switch (template.id) {
case 'todo-app':
previewHtml = generateTodoAppPreview();
break;
case 'blog-system':
previewHtml = generateBlogSystemPreview();
break;
default:
previewHtml = generateGenericPreview(template);
break;
}
// Set preview content
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write(previewHtml);
iframeDoc.close();
}
};
// Set initial src to trigger onload
iframe.src = 'about:blank';
// Add close button event
dialog.querySelector('.modal-close-btn')?.addEventListener('click', function() {
dialog.remove();
});
dialog.querySelector('.close-preview-btn')?.addEventListener('click', function() {
dialog.remove();
});
// Add create button event
dialog.querySelector('.create-from-preview-btn')?.addEventListener('click', function() {
dialog.remove();
createFromTemplate(templateId);
});
}
/**
* Create a project from template
* @param {string} templateId - Template ID
*/
function createFromTemplate(templateId) {
const template = getTemplateById(templateId);
if (!template) return;
// Create configuration dialog
const dialog = document.createElement('div');
dialog.className = 'modal-overlay';
dialog.innerHTML = `
`;
// Add to document
document.body.appendChild(dialog);
// Add close button event
dialog.querySelector('.modal-close-btn')?.addEventListener('click', function() {
dialog.remove();
});
dialog.querySelector('.cancel-create-btn')?.addEventListener('click', function() {
dialog.remove();
});
// Add create button event
dialog.querySelector('.create-project-btn')?.addEventListener('click', function() {
// Get configuration
const config = {
name: document.getElementById('project-name').value,
description: document.getElementById('project-description').value,
includeDemoData: document.getElementById('include-demo-data').checked,
includeDocumentation: document.getElementById('include-documentation').checked
};
// Show progress
dialog.querySelector('.config-form').classList.add('hidden');
dialog.querySelector('.creation-progress').classList.remove('hidden');
dialog.querySelector('.create-project-btn').disabled = true;
dialog.querySelector('.cancel-create-btn').disabled = true;
// Simulate project creation
let progress = 0;
const progressBar = dialog.querySelector('.progress-bar');
const progressStatus = dialog.querySelector('.progress-status');
const progressInterval = setInterval(() => {
progress += 5;
progressBar.style.width = `${progress}%`;
progressBar.setAttribute('aria-valuenow', progress);
if (progress === 25) {
progressStatus.textContent = 'Generating project files...';
} else if (progress === 50) {
progressStatus.textContent = 'Adding template code...';
} else if (progress === 75) {
progressStatus.textContent = 'Finalizing project...';
}
if (progress >= 100) {
clearInterval(progressInterval);
progressStatus.textContent = 'Project created successfully!';
// Enable close button
dialog.querySelector('.cancel-create-btn').disabled = false;
dialog.querySelector('.cancel-create-btn').textContent = 'Close';
// Add open project button
const openProjectBtn = document.createElement('button');
openProjectBtn.className = 'btn btn-success open-project-btn';
openProjectBtn.textContent = 'Open Project';
dialog.querySelector('.modal-footer').insertBefore(openProjectBtn, dialog.querySelector('.cancel-create-btn'));
openProjectBtn.addEventListener('click', function() {
// Simulate opening project
showToast('success', `Project "${config.name}" opened`);
dialog.remove();
});
}
}, 200);
});
}
/**
* Generate Todo App preview HTML
* @returns {string} Preview HTML
*/
function generateTodoAppPreview() {
return `
Todo App
`;
}
/**
* Generate Blog System preview HTML
* @returns {string} Preview HTML
*/
function generateBlogSystemPreview() {
return `
Blog System
Getting Started with PHP
Admin ·
June 10, 2023 ·
Tutorials ·
5 Comments
PHP is a widely-used open-source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
This tutorial will guide you through the basics of PHP programming and help you understand its core concepts.
What You'll Learn
Basic PHP syntax
Variables and data types
Control structures
Functions and classes
Connecting to databases
By the end of this tutorial, you'll be able to create simple web applications using PHP.
Working with MySQL Databases
Admin ·
June 8, 2023 ·
Databases ·
3 Comments
MySQL is one of the most popular database systems used with PHP. This post will cover how to integrate MySQL with your PHP applications.
Building a Simple Login System
Admin ·
June 5, 2023 ·
Security ·
7 Comments
Authentication is a critical part of web applications. Learn how to create a secure login system using PHP and MySQL.
`;
}
/**
* Generate generic preview HTML
* @param {Object} template - Template object
* @returns {string} Preview HTML
*/
function generateGenericPreview(template) {
return `
${template.name}
About This Template
This is a preview of the ${template.name} template. This template is designed to help you quickly build a functional application with all the basic features you need.
It's a great starting point for your project and can be customized to suit your specific requirements.
Technologies
${template.technologies.map(tech => `
${tech}
`).join('')}
Features
${template.features.map(feature => `
${feature}
`).join('')}
Getting Started
To use this template, simply click the "Create From Template" button. This will generate a new project based on this template.
You'll be able to customize the project name, description, and other options before creating the project.
`;
}
/**
* Get templates by category
* @param {string} category - Category ID
* @returns {Array} Filtered templates
*/
function getTemplatesByCategory(category) {
if (category === 'all') {
return _templates;
}
return _templates.filter(template => template.category === category);
}
/**
* Get template by ID
* @param {string} id - Template ID
* @returns {Object|null} Template object or null if not found
*/
function getTemplateById(id) {
return _templates.find(template => template.id === id) || null;
}
/**
* Get category name by ID
* @param {string} categoryId - Category ID
* @returns {string} Category name
*/
function getCategoryName(categoryId) {
const category = _categories.find(cat => cat.id === categoryId);
return category ? category.name : categoryId;
}
/**
* Get category icon by ID
* @param {string} categoryId - Category ID
* @returns {string} Category icon
*/
function getCategoryIcon(categoryId) {
const category = _categories.find(cat => cat.id === categoryId);
return category ? category.icon : 'folder';
}
/**
* Get difficulty icon
* @param {string} difficulty - Difficulty level
* @returns {string} Icon name
*/
function getDifficultyIcon(difficulty) {
switch (difficulty) {
case 'beginner':
return 'smile';
case 'intermediate':
return 'meh';
case 'advanced':
return 'graduation-cap';
default:
return 'info-circle';
}
}
/**
* Capitalize first letter of a string
* @param {string} str - String to capitalize
* @returns {string} Capitalized string
*/
function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
/**
* Toggle panel visibility
*/
function togglePanel() {
if (!_panel) {
createPanel();
}
_panelVisible = !_panelVisible;
if (_panelVisible) {
_panel.classList.remove('hidden');
// Reset to template list view if needed
if (_selectedTemplate) {
document.querySelector('.demo-system-container').classList.remove('hidden');
document.getElementById('demo-details').classList.add('hidden');
_selectedTemplate = null;
}
} else {
_panel.classList.add('hidden');
}
return _panelVisible;
}
/**
* Show a toast notification
* @param {string} type - Notification type (success, info, warning, error)
* @param {string} message - Notification message
*/
function showToast(type, message) {
// Check if function exists in the global scope
if (typeof window.showToast === 'function') {
window.showToast(type, message);
return;
}
console.log(`${type}: ${message}`);
}
// Public API
return {
initialize,
togglePanel,
getCategories: () => _categories,
getTemplates: getTemplatesByCategory,
getTemplate: getTemplateById,
isInitialized: () => _initialized,
isPanelVisible: () => _panelVisible
};
})();
// Auto-initialize on DOM ready if not using module framework
document.addEventListener('DOMContentLoaded', function() {
if (!window.ModuleFramework) {
DemoSystem.initialize();
}
});
// Add the module to the global scope
window.DemoSystem = DemoSystem;
// Add demo system styles
(function() {
const style = document.createElement('style');
style.textContent = `
/* Demo System Styles */
.demo-system-panel {
width: 90% !important;
height: 90% !important;
max-width: 1400px !important;
}
.demo-system-container {
display: flex;
width: 100%;
height: 100%;
}
.demo-sidebar {
width: 260px;
border-right: 1px solid rgba(255, 255, 255, 0.1);
overflow-y: auto;
padding-right: 15px;
}
.demo-content {
flex: 1;
overflow: hidden;
display: flex;
flex-direction: column;
}
.demo-search {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 0 15px 15px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
margin-bottom: 15px;
}
.search-box {
display: flex;
width: 300px;
}
.search-box input {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-right: none;
background-color: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.2);
color: rgba(255, 255, 255, 0.9);
}
.search-box button {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
background-color: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.2);
color: rgba(255, 255, 255, 0.9);
}
.view-options {
display: flex;
gap: 5px;
}
.view-option {
width: 36px;
height: 36px;
border-radius: 4px;
border: 1px solid rgba(255, 255, 255, 0.2);
background-color: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.7);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s ease;
}
.view-option:hover {
background-color: rgba(255, 255, 255, 0.15);
color: rgba(255, 255, 255, 0.9);
}
.view-option.active {
background-color: rgba(13, 110, 253, 0.3);
color: rgba(255, 255, 255, 0.9);
border-color: rgba(13, 110, 253, 0.5);
}
.categories-section h3, .filters-section h3 {
font-size: 1.1rem;
margin: 0 0 15px 0;
padding-bottom: 10px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.categories-list {
display: flex;
flex-direction: column;
gap: 5px;
margin-bottom: 25px;
}
.category-item {
display: flex;
align-items: center;
gap: 10px;
padding: 10px;
border-radius: 6px;
background-color: rgba(255, 255, 255, 0.05);
cursor: pointer;
transition: all 0.2s ease;
}
.category-item:hover {
background-color: rgba(255, 255, 255, 0.1);
}
.category-item.active {
background-color: rgba(13, 110, 253, 0.3);
}
.category-item i {
width: 24px;
text-align: center;
}
.filter-group {
margin-bottom: 20px;
}
.filter-group label {
display: block;
margin-bottom: 10px;
font-weight: 500;
}
.filter-options {
display: flex;
flex-direction: column;
gap: 8px;
}
.filter-option {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
font-weight: normal;
}
.demo-templates {
padding: 15px;
overflow-y: auto;
flex: 1;
}
.demo-templates.view-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
}
.demo-templates.view-list {
display: flex;
flex-direction: column;
gap: 15px;
}
.template-card {
background-color: rgba(255, 255, 255, 0.05);
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
transition: all 0.2s ease;
cursor: pointer;
display: flex;
flex-direction: column;
}
.template-card:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
background-color: rgba(255, 255, 255, 0.08);
}
.view-list .template-card {
flex-direction: row;
height: 120px;
}
.template-image {
height: 150px;
width: 100%;
overflow: hidden;
}
.view-list .template-image {
height: 100%;
width: 160px;
flex-shrink: 0;
}
.template-image img {
width: 100%;
height: 100%;
object-fit: cover;
}
.template-info {
padding: 15px;
flex: 1;
}
.view-list .template-info {
padding: 10px 15px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.template-name {
font-size: 1.1rem;
margin: 0 0 10px 0;
}
.view-list .template-name {
margin-bottom: 5px;
}
.template-description {
font-size: 0.9rem;
color: rgba(255, 255, 255, 0.7);
margin-bottom: 15px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.view-list .template-description {
-webkit-line-clamp: 1;
margin-bottom: 5px;
}
.template-meta {
display: flex;
justify-content: space-between;
font-size: 0.8rem;
}
.template-difficulty, .template-category {
display: inline-flex;
align-items: center;
gap: 5px;
}
.template-difficulty.beginner {
color: #28a745;
}
.template-difficulty.intermediate {
color: #fd7e14;
}
.template-difficulty.advanced {
color: #dc3545;
}
.template-actions {
padding: 10px 15px;
display: flex;
gap: 10px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.view-list .template-actions {
border-top: none;
border-left: 1px solid rgba(255, 255, 255, 0.1);
flex-direction: column;
justify-content: center;
padding: 10px;
}
.no-templates {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 200px;
color: rgba(255, 255, 255, 0.5);
}
.no-templates i {
font-size: 3rem;
margin-bottom: 15px;
}
.demo-details {
width: 100%;
height: 100%;
overflow-y: auto;
padding: 0 15px;
}
.details-header {
padding: 15px 0;
margin-bottom: 20px;
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 5px;
color: rgba(255, 255, 255, 0.8);
text-decoration: none;
padding: 5px 0;
}
.back-btn:hover {
color: rgba(13, 110, 253, 0.9);
}
.template-details {
background-color: rgba(255, 255, 255, 0.05);
border-radius: 10px;
padding: 20px;
margin-bottom: 30px;
}
.template-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.template-header h3 {
margin: 0;
font-size: 1.5rem;
}
.template-badges {
display: flex;
gap: 10px;
}
.template-content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 30px;
margin-bottom: 20px;
}
.template-preview {
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.template-preview img {
width: 100%;
height: auto;
display: block;
}
.template-info-details {
display: flex;
flex-direction: column;
gap: 20px;
}
.template-description-full h4, .template-tech h4, .template-features h4 {
font-size: 1.1rem;
margin-bottom: 15px;
padding-bottom: 10px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.tech-tags {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.tech-tag {
display: inline-block;
padding: 5px 12px;
background-color: rgba(255, 255, 255, 0.1);
border-radius: 20px;
font-size: 0.9rem;
}
.template-features ul {
padding-left: 0;
list-style: none;
}
.template-features li {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
}
.template-features li i {
color: #198754;
}
.template-actions-full {
display: flex;
gap: 15px;
justify-content: center;
margin-top: 10px;
}
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 10000;
}
.modal-dialog {
background-color: rgba(30, 30, 30, 0.9);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-radius: 10px;
width: 90%;
max-width: 900px;
max-height: 90vh;
display: flex;
flex-direction: column;
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}
.modal-content {
display: flex;
flex-direction: column;
height: 100%;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-header h3 {
margin: 0;
font-size: 1.3rem;
}
.modal-close-btn {
width: 30px;
height: 30px;
border-radius: 50%;
border: none;
background-color: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.8);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s ease;
}
.modal-close-btn:hover {
background-color: rgba(255, 87, 34, 0.3);
transform: rotate(90deg);
}
.modal-body {
flex: 1;
padding: 20px;
overflow-y: auto;
}
.modal-footer {
display: flex;
justify-content: flex-end;
gap: 10px;
padding: 15px 20px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.progress {
height: 10px;
margin-bottom: 15px;
border-radius: 5px;
background-color: rgba(255, 255, 255, 0.1);
}
.progress-bar {
background-color: #0d6efd;
border-radius: 5px;
transition: width 0.2s ease;
}
.progress-status {
text-align: center;
font-size: 0.9rem;
color: rgba(255, 255, 255, 0.7);
}
.creation-progress {
margin-top: 20px;
}
.config-form {
max-width: 600px;
margin: 0 auto;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 8px;
}
.form-check {
margin-bottom: 15px;
}
.hidden {
display: none !important;
}
`;
document.head.appendChild(style);
})();