Files
GOV_QR_Codes_Management/templates/create_qr_code.html
T
2025-07-29 17:02:08 -04:00

1319 lines
36 KiB
HTML

{% extends "base.html" %}
{% block title %}Create QR Code - QR Code Management{% endblock %}
{% block content %}
<div class="form-page">
<div class="form-card">
<div class="form-header">
<h1>
<i class="fas fa-qrcode"></i>
Create New QR Code
</h1>
<p>Generate a QR code for your location or event</p>
</div>
<form method="POST" class="form" id="createQRForm">
<!-- QR Code Preview Section -->
<div class="qr-preview-section" id="qrPreviewSection" style="display: none;">
<div class="preview-header">
<h3>
<i class="fas fa-eye"></i>
QR Code Preview
</h3>
<p>This is how your QR code will appear</p>
</div>
<div class="qr-preview-container">
<div class="qr-preview-image">
<canvas id="qrCanvas" width="200" height="200"></canvas>
</div>
<div class="qr-preview-info">
<div class="preview-item">
<strong>Name:</strong> <span id="previewName">-</span>
</div>
<div class="preview-item">
<strong>Location:</strong> <span id="previewLocation">-</span>
</div>
<div class="preview-item">
<strong>Event:</strong> <span id="previewEvent">-</span>
</div>
</div>
</div>
</div>
<!-- Basic Information Section -->
<div class="form-section">
<div class="section-header">
<h3>
<i class="fas fa-info-circle"></i>
Basic Information
</h3>
<p>Provide the essential details for your QR code</p>
</div>
<div class="form-group">
<label for="name">
<i class="fas fa-tag"></i>
QR Code Name
</label>
<input type="text" id="name" name="name" required
placeholder="Enter a descriptive name for this QR code"
maxlength="100">
<small class="form-help">This name will help you identify the QR code in your dashboard</small>
<div class="character-counter">
<span id="nameCounter">0/100</span>
</div>
</div>
<div class="form-group">
<label for="location">
<i class="fas fa-map-marker-alt"></i>
Location Name
</label>
<input type="text" id="location" name="location" required
placeholder="e.g., Conference Room A, Main Lobby, etc."
maxlength="100">
<small class="form-help">The name of the physical location where this QR code will be used</small>
<div class="character-counter">
<span id="locationCounter">0/100</span>
</div>
</div>
</div>
<!-- Location Details Section -->
<div class="form-section">
<div class="section-header">
<h3>
<i class="fas fa-building"></i>
Location Details
</h3>
<p>Provide the complete address and event information</p>
</div>
<div class="form-group">
<label for="location_address">
<i class="fas fa-home"></i>
Complete Address
</label>
<textarea id="location_address" name="location_address" required
placeholder="Enter the full address including street, city, state, and ZIP code"
rows="3" maxlength="500"></textarea>
<small class="form-help">Include all address details for accurate location identification</small>
<div class="character-counter">
<span id="addressCounter">0/500</span>
</div>
</div>
<div class="form-group">
<label for="location_event">
<i class="fas fa-calendar-alt"></i>
Event or Purpose
</label>
<input type="text" id="location_event" name="location_event" required
placeholder="e.g., Weekly Team Meeting, Customer Check-in, Training Session"
maxlength="200">
<small class="form-help">Describe the event or purpose for this QR code</small>
<div class="character-counter">
<span id="eventCounter">0/200</span>
</div>
</div>
</div>
<!-- QR Code Options Section -->
<div class="form-section">
<div class="section-header">
<h3>
<i class="fas fa-cog"></i>
QR Code Options
</h3>
<p>Customize how your QR code will be generated</p>
</div>
<div class="form-row">
<div class="form-group">
<label for="qr_size">
<i class="fas fa-expand-arrows-alt"></i>
QR Code Size
</label>
<select id="qr_size" name="qr_size">
<option value="small">Small (200x200px)</option>
<option value="medium" selected>Medium (300x300px)</option>
<option value="large">Large (400x400px)</option>
</select>
<small class="form-help">Choose the size that best fits your intended use</small>
</div>
<div class="form-group">
<label for="qr_format">
<i class="fas fa-file-image"></i>
Output Format
</label>
<select id="qr_format" name="qr_format">
<option value="png" selected>PNG (Recommended)</option>
<option value="jpg">JPEG</option>
<option value="svg">SVG (Vector)</option>
</select>
<small class="form-help">PNG provides the best quality for QR codes</small>
</div>
</div>
<div class="form-group">
<label for="include_text">
<input type="checkbox" id="include_text" name="include_text" checked>
<span class="checkbox-label">Include readable text below QR code</span>
</label>
<small class="form-help">This will add the location name as text below the QR code for easier identification</small>
</div>
</div>
<!-- Data Preview Section -->
<div class="form-section">
<div class="section-header">
<h3>
<i class="fas fa-database"></i>
QR Code Data Preview
</h3>
<p>This is the information that will be encoded in your QR code</p>
</div>
<div class="data-preview">
<div class="data-preview-content">
<pre id="qrDataPreview">Fill in the form above to see the QR code data...</pre>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">
<i class="fas fa-arrow-left"></i>
Back to Dashboard
</a>
<button type="button" class="btn btn-info" id="generatePreview">
<i class="fas fa-eye"></i>
Generate Preview
</button>
<button type="submit" class="btn btn-primary">
<i class="fas fa-plus"></i>
Create QR Code
</button>
</div>
</form>
</div>
</div>
<!-- QR Code Preview Modal -->
<div id="qrPreviewModal" class="modal">
<div class="modal-content qr-modal">
<div class="modal-header">
<h3>QR Code Preview</h3>
<button class="modal-close" onclick="closePreviewModal()">
<i class="fas fa-times"></i>
</button>
</div>
<div class="modal-body">
<div class="modal-qr-preview">
<div class="modal-qr-image">
<canvas id="modalQRCanvas" width="300" height="300"></canvas>
</div>
<div class="modal-qr-info">
<h4>QR Code Information</h4>
<div class="modal-info-grid">
<div class="info-item">
<strong>Name:</strong>
<span id="modalPreviewName">-</span>
</div>
<div class="info-item">
<strong>Location:</strong>
<span id="modalPreviewLocation">-</span>
</div>
<div class="info-item">
<strong>Event:</strong>
<span id="modalPreviewEvent">-</span>
</div>
<div class="info-item">
<strong>Address:</strong>
<span id="modalPreviewAddress">-</span>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button onclick="downloadPreviewQR()" class="btn btn-info">
<i class="fas fa-download"></i>
Download Preview
</button>
<button onclick="closePreviewModal()" class="btn btn-secondary">
Close Preview
</button>
</div>
</div>
</div>
{% endblock %}
{% block extra_scripts %}
<!-- QR Code Generation Library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
initializeQRCodeCreation();
});
function initializeQRCodeCreation() {
const form = document.getElementById('createQRForm');
const previewBtn = document.getElementById('generatePreview');
// Form inputs
const nameInput = document.getElementById('name');
const locationInput = document.getElementById('location');
const addressInput = document.getElementById('location_address');
const eventInput = document.getElementById('location_event');
// Initialize character counters
initializeCharacterCounters();
// Initialize real-time preview updates
initializeRealTimePreview();
// Preview button functionality
previewBtn.addEventListener('click', function() {
if (validateForm()) {
generateQRPreview();
showPreviewModal();
}
});
// Form submission
form.addEventListener('submit', function(e) {
if (!validateForm()) {
e.preventDefault();
return false;
}
// Show loading state
const submitBtn = form.querySelector('button[type="submit"]');
submitBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Creating QR Code...';
submitBtn.disabled = true;
});
// Real-time form validation
[nameInput, locationInput, addressInput, eventInput].forEach(input => {
input.addEventListener('input', function() {
updateDataPreview();
clearFieldError(this);
});
input.addEventListener('blur', function() {
validateField(this);
});
});
}
function initializeCharacterCounters() {
const counters = [
{ input: 'name', counter: 'nameCounter', max: 100 },
{ input: 'location', counter: 'locationCounter', max: 100 },
{ input: 'location_address', counter: 'addressCounter', max: 500 },
{ input: 'location_event', counter: 'eventCounter', max: 200 }
];
counters.forEach(item => {
const input = document.getElementById(item.input);
const counter = document.getElementById(item.counter);
if (input && counter) {
input.addEventListener('input', function() {
const length = this.value.length;
counter.textContent = `${length}/${item.max}`;
if (length > item.max * 0.9) {
counter.classList.add('warning');
} else {
counter.classList.remove('warning');
}
});
}
});
}
function initializeRealTimePreview() {
const inputs = document.querySelectorAll('#name, #location, #location_event');
inputs.forEach(input => {
input.addEventListener('input', updateInlinePreview);
});
}
function updateInlinePreview() {
const name = document.getElementById('name').value || '-';
const location = document.getElementById('location').value || '-';
const event = document.getElementById('location_event').value || '-';
document.getElementById('previewName').textContent = name;
document.getElementById('previewLocation').textContent = location;
document.getElementById('previewEvent').textContent = event;
// Show/hide preview section
const previewSection = document.getElementById('qrPreviewSection');
if (name !== '-' || location !== '-' || event !== '-') {
previewSection.style.display = 'block';
previewSection.classList.add('fade-in');
}
}
function updateDataPreview() {
const name = document.getElementById('name').value;
const location = document.getElementById('location').value;
const address = document.getElementById('location_address').value;
const event = document.getElementById('location_event').value;
let qrData = '';
if (event) qrData += `Event: ${event}\n`;
if (location) qrData += `Location: ${location}\n`;
if (address) qrData += `Address: ${address}`;
document.getElementById('qrDataPreview').textContent =
qrData || 'Fill in the form above to see the QR code data...';
}
function validateForm() {
const requiredFields = [
{ id: 'name', name: 'QR Code Name' },
{ id: 'location', name: 'Location Name' },
{ id: 'location_address', name: 'Complete Address' },
{ id: 'location_event', name: 'Event or Purpose' }
];
let isValid = true;
requiredFields.forEach(field => {
const input = document.getElementById(field.id);
if (!input.value.trim()) {
showFieldError(input, `${field.name} is required`);
isValid = false;
} else {
clearFieldError(input);
}
});
// Additional validation
const name = document.getElementById('name').value.trim();
if (name && name.length < 3) {
showFieldError(document.getElementById('name'), 'QR Code name must be at least 3 characters');
isValid = false;
}
const address = document.getElementById('location_address').value.trim();
if (address && address.length < 10) {
showFieldError(document.getElementById('location_address'), 'Please provide a complete address');
isValid = false;
}
return isValid;
}
function validateField(input) {
const value = input.value.trim();
if (input.hasAttribute('required') && !value) {
showFieldError(input, 'This field is required');
return false;
}
// Specific field validations
if (input.id === 'name' && value && value.length < 3) {
showFieldError(input, 'Name must be at least 3 characters');
return false;
}
if (input.id === 'location_address' && value && value.length < 10) {
showFieldError(input, 'Please provide a complete address');
return false;
}
clearFieldError(input);
return true;
}
function showFieldError(input, message) {
const formGroup = input.closest('.form-group');
formGroup.classList.add('has-error');
let errorElement = formGroup.querySelector('.error-message');
if (!errorElement) {
errorElement = document.createElement('div');
errorElement.className = 'error-message';
formGroup.appendChild(errorElement);
}
errorElement.textContent = message;
}
function clearFieldError(input) {
const formGroup = input.closest('.form-group');
formGroup.classList.remove('has-error');
const errorElement = formGroup.querySelector('.error-message');
if (errorElement) {
errorElement.remove();
}
}
function generateQRPreview() {
const name = document.getElementById('name').value;
const location = document.getElementById('location').value;
const address = document.getElementById('location_address').value;
const event = document.getElementById('location_event').value;
// Generate QR code data
const qrData = `Event: ${event}\nLocation: ${location}\nAddress: ${address}`;
// Generate QR code using QRious library
const canvas = document.getElementById('modalQRCanvas');
const qr = new QRious({
element: canvas,
value: qrData,
size: 300,
level: 'M'
});
// Update modal preview info
document.getElementById('modalPreviewName').textContent = name;
document.getElementById('modalPreviewLocation').textContent = location;
document.getElementById('modalPreviewEvent').textContent = event;
document.getElementById('modalPreviewAddress').textContent = address;
// Store QR data for download
window.currentPreviewQR = {
name: name,
canvas: canvas
};
}
function showPreviewModal() {
const modal = document.getElementById('qrPreviewModal');
modal.style.display = 'flex';
setTimeout(() => modal.classList.add('show'), 10);
}
function closePreviewModal() {
const modal = document.getElementById('qrPreviewModal');
modal.classList.remove('show');
setTimeout(() => {
modal.style.display = 'none';
}, 200);
}
function downloadPreviewQR() {
if (window.currentPreviewQR) {
const canvas = window.currentPreviewQR.canvas;
const link = document.createElement('a');
link.download = window.currentPreviewQR.name.replace(/[^a-z0-9]/gi, '_').toLowerCase() + '_qr_preview.png';
link.href = canvas.toDataURL();
link.click();
showToast('QR code preview downloaded!', 'success');
}
}
function showToast(message, type = 'info') {
const toast = document.createElement('div');
toast.className = `toast toast-${type}`;
toast.innerHTML = `
<div class="toast-content">
<i class="fas ${getToastIcon(type)}"></i>
<span>${message}</span>
</div>
`;
toast.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
background: white;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
padding: 1rem;
z-index: 1000;
opacity: 0;
transform: translateX(100%);
transition: all 0.3s ease;
border-left: 4px solid ${getToastColor(type)};
max-width: 400px;
`;
document.body.appendChild(toast);
setTimeout(() => {
toast.style.opacity = '1';
toast.style.transform = 'translateX(0)';
}, 100);
setTimeout(() => {
toast.style.opacity = '0';
toast.style.transform = 'translateX(100%)';
setTimeout(() => {
if (document.body.contains(toast)) {
document.body.removeChild(toast);
}
}, 300);
}, 3000);
}
function getToastIcon(type) {
const icons = {
success: 'fa-check-circle',
error: 'fa-exclamation-circle',
warning: 'fa-exclamation-triangle',
info: 'fa-info-circle'
};
return icons[type] || icons.info;
}
function getToastColor(type) {
const colors = {
success: '#059669',
error: '#dc2626',
warning: '#d97706',
info: '#0891b2'
};
return colors[type] || colors.info;
}
// Close modals when clicking outside
document.addEventListener('click', function(e) {
const modal = document.getElementById('qrPreviewModal');
if (e.target === modal) {
closePreviewModal();
}
});
// Close modals with Escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closePreviewModal();
}
});
</script>
<style>
/* Create QR Code Page Specific Styles */
.form-page {
max-width: 800px;
margin: 0 auto;
padding: 0 1rem;
}
.form-card {
background: var(--white);
border-radius: var(--radius-2xl);
box-shadow: var(--shadow);
padding: 2rem;
margin-bottom: 2rem;
}
.form-header {
text-align: center;
margin-bottom: 2rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid var(--gray-200);
}
.form-header h1 {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
font-size: 2rem;
font-weight: 700;
color: var(--gray-900);
margin-bottom: 0.5rem;
}
.form-header p {
color: var(--gray-500);
font-size: 1rem;
}
/* Form Sections */
.form-section {
margin-bottom: 2rem;
padding: 1.5rem;
background: var(--gray-50);
border-radius: var(--radius-xl);
border: 1px solid var(--gray-200);
}
.section-header {
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--gray-200);
}
.section-header h3 {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
color: var(--gray-800);
margin-bottom: 0.5rem;
}
.section-header p {
color: var(--gray-600);
font-size: 0.875rem;
}
/* Form Groups and Inputs */
.form-group {
position: relative;
margin-bottom: 1.5rem;
}
.form-group label {
display: flex;
align-items: center;
gap: 0.5rem;
font-weight: 600;
color: var(--gray-700);
margin-bottom: 0.5rem;
font-size: 0.875rem;
}
.form-group input,
.form-group select,
.form-group textarea {
width: 100%;
padding: 0.75rem;
border: 2px solid var(--gray-200);
border-radius: var(--radius-lg);
font-size: var(--font-size-base);
transition: var(--transition);
background-color: var(--white);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-group textarea {
resize: vertical;
min-height: 80px;
}
.form-help {
display: block;
margin-top: 0.5rem;
font-size: 0.75rem;
color: var(--gray-500);
}
/* Character Counters */
.character-counter {
position: absolute;
bottom: -1.5rem;
right: 0;
font-size: 0.75rem;
color: var(--gray-400);
}
.character-counter.warning {
color: var(--warning-color);
font-weight: 600;
}
/* Form Row Layout */
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1.5rem;
}
/* Checkbox Styling */
.checkbox-label {
display: flex;
align-items: center;
gap: 0.5rem;
font-weight: 500;
color: var(--gray-700);
cursor: pointer;
}
input[type="checkbox"] {
width: auto !important;
margin-right: 0.5rem;
}
/* QR Preview Section */
.qr-preview-section {
margin-bottom: 2rem;
padding: 1.5rem;
background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
color: var(--white);
border-radius: var(--radius-xl);
opacity: 0;
transform: translateY(-20px);
transition: all 0.3s ease;
}
.qr-preview-section.fade-in {
opacity: 1;
transform: translateY(0);
}
.preview-header {
text-align: center;
margin-bottom: 1.5rem;
}
.preview-header h3 {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 0.5rem;
}
.qr-preview-container {
display: grid;
grid-template-columns: auto 1fr;
gap: 1.5rem;
align-items: center;
}
.qr-preview-image {
display: flex;
justify-content: center;
align-items: center;
width: 120px;
height: 120px;
background: var(--white);
border-radius: var(--radius-lg);
box-shadow: var(--shadow);
}
.qr-preview-info {
display: grid;
gap: 0.5rem;
}
.preview-item {
font-size: 0.875rem;
opacity: 0.9;
}
.preview-item strong {
opacity: 1;
}
/* Data Preview */
.data-preview {
margin-top: 1rem;
}
.data-preview-content {
background: var(--white);
border: 1px solid var(--gray-200);
border-radius: var(--radius);
padding: 1rem;
}
.data-preview-content pre {
margin: 0;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 0.875rem;
color: var(--gray-700);
white-space: pre-wrap;
word-wrap: break-word;
}
/* Form Actions */
.form-actions {
display: flex;
justify-content: space-between;
align-items: center;
gap: 1rem;
margin-top: 2rem;
padding-top: 1.5rem;
border-top: 1px solid var(--gray-200);
}
/* Error States */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
border-color: var(--danger-color);
box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.error-message {
margin-top: 0.5rem;
font-size: 0.75rem;
color: var(--danger-color);
font-weight: 500;
}
/* Modal Specific Styles */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
z-index: 2000;
align-items: center;
justify-content: center;
padding: 1rem;
opacity: 0;
transition: opacity 0.3s ease;
}
.modal.show {
opacity: 1;
}
.modal-content.qr-modal {
max-width: 700px;
width: 100%;
}
.modal-qr-preview {
display: grid;
grid-template-columns: auto 1fr;
gap: 2rem;
align-items: center;
}
.modal-qr-image {
display: flex;
justify-content: center;
align-items: center;
padding: 1rem;
background: var(--gray-50);
border-radius: var(--radius-lg);
border: 1px solid var(--gray-200);
}
.modal-qr-info h4 {
font-size: 1.125rem;
font-weight: 600;
color: var(--gray-900);
margin-bottom: 1rem;
}
.modal-info-grid {
display: grid;
gap: 0.75rem;
}
.info-item {
display: grid;
grid-template-columns: 100px 1fr;
gap: 0.5rem;
font-size: 0.875rem;
}
.info-item strong {
color: var(--gray-700);
font-weight: 600;
}
.info-item span {
color: var(--gray-900);
word-break: break-word;
}
/* Responsive Design */
@media (max-width: 768px) {
.form-page {
padding: 0 0.5rem;
}
.form-card {
padding: 1.5rem;
}
.form-section {
padding: 1rem;
}
.form-row {
grid-template-columns: 1fr;
gap: 1rem;
}
.form-actions {
flex-direction: column;
align-items: stretch;
}
.qr-preview-container {
grid-template-columns: 1fr;
gap: 1rem;
text-align: center;
}
.modal-qr-preview {
grid-template-columns: 1fr;
gap: 1rem;
text-align: center;
}
.info-item {
grid-template-columns: 1fr;
gap: 0.25rem;
}
.character-counter {
position: static;
text-align: right;
margin-top: 0.5rem;
}
}
@media (max-width: 480px) {
.form-header h1 {
font-size: 1.5rem;
flex-direction: column;
gap: 0.25rem;
}
.section-header h3 {
font-size: 1.125rem;
flex-direction: column;
gap: 0.25rem;
text-align: center;
}
.modal-content {
margin: 0.5rem;
max-height: calc(100vh - 1rem);
}
}
/* Loading States */
.btn.loading {
position: relative;
pointer-events: none;
}
.btn.loading::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 16px;
height: 16px;
margin: -8px 0 0 -8px;
border: 2px solid transparent;
border-top: 2px solid currentColor;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Success States */
.form-group.has-success input,
.form-group.has-success select,
.form-group.has-success textarea {
border-color: var(--success-color);
box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}
/* Focus Styles for Accessibility */
.btn:focus,
input:focus,
select:focus,
textarea:focus {
outline: 2px solid var(--primary-color);
outline-offset: 2px;
}
/* High Contrast Mode Support */
@media (prefers-contrast: high) {
.form-section {
border: 2px solid var(--gray-600);
}
.qr-preview-section {
border: 2px solid var(--primary-color);
}
.data-preview-content {
border: 2px solid var(--gray-600);
}
}
/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
.qr-preview-section {
opacity: 1;
transform: none;
}
}
/* Print Styles */
@media print {
.form-actions,
.modal,
.character-counter {
display: none !important;
}
.form-page {
max-width: none;
padding: 0;
}
.form-card {
box-shadow: none;
border: 1px solid #000;
}
.form-section {
break-inside: avoid;
box-shadow: none;
border: 1px solid #000;
}
}
/* Toast Notification Styles */
.toast {
position: fixed;
top: 20px;
right: 20px;
background: white;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-xl);
padding: 1rem;
z-index: 1000;
opacity: 0;
transform: translateX(100%);
transition: all 0.3s ease;
max-width: 400px;
border-left: 4px solid;
}
.toast.show {
opacity: 1;
transform: translateX(0);
}
.toast-content {
display: flex;
align-items: center;
gap: 0.5rem;
font-weight: 500;
}
.toast.toast-success {
border-left-color: var(--success-color);
}
.toast.toast-error {
border-left-color: var(--danger-color);
}
.toast.toast-warning {
border-left-color: var(--warning-color);
}
.toast.toast-info {
border-left-color: var(--info-color);
}
.toast.toast-success .toast-content {
color: var(--success-color);
}
.toast.toast-error .toast-content {
color: var(--danger-color);
}
.toast.toast-warning .toast-content {
color: var(--warning-color);
}
.toast.toast-info .toast-content {
color: var(--info-color);
}
/* Custom Scrollbar */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: var(--gray-100);
border-radius: var(--radius);
}
::-webkit-scrollbar-thumb {
background: var(--gray-300);
border-radius: var(--radius);
}
::-webkit-scrollbar-thumb:hover {
background: var(--gray-400);
}
/* Selection Styles */
::selection {
background: rgba(37, 99, 235, 0.2);
color: var(--gray-900);
}
/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.fade-in {
animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Canvas Styling */
canvas {
max-width: 100%;
height: auto;
border-radius: var(--radius);
}
/* Form Validation Visual Cues */
.form-group {
transition: var(--transition);
}
.form-group.focused label {
color: var(--primary-color);
}
.form-group.has-error label {
color: var(--danger-color);
}
.form-group.has-success label {
color: var(--success-color);
}
/* Enhanced Button Styles */
.btn {
position: relative;
overflow: hidden;
}
.btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
transition: left 0.5s;
}
.btn:hover::before {
left: 100%;
}
/* Improved Modal Styles */
.modal-content {
background: var(--white);
border-radius: var(--radius-2xl);
box-shadow: var(--shadow-xl);
max-height: 90vh;
overflow-y: auto;
animation: modalSlideUp 0.3s ease-out;
}
@keyframes modalSlideUp {
from {
opacity: 0;
transform: translateY(30px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem;
border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 {
font-size: 1.25rem;
font-weight: 700;
color: var(--gray-900);
}
.modal-close {
background: none;
border: none;
padding: 0.5rem;
border-radius: var(--radius);
cursor: pointer;
color: var(--gray-500);
transition: var(--transition);
}
.modal-close:hover {
background-color: var(--gray-100);
color: var(--gray-700);
}
.modal-body {
padding: 1.5rem;
}
.modal-footer {
display: flex;
justify-content: flex-end;
gap: 0.75rem;
padding: 1.5rem;
border-top: 1px solid var(--gray-200);
}
</style>
{% endblock %}