Split monolithic index.html and style.css for maintainability

- Extract 15 modals and 3 partials from index.html into Jinja2 templates
  (templates/modals/*.html, templates/partials/*.html)
- Split style.css (3,712 lines) into 11 feature-scoped CSS files under
  static/css/ (base, layout, components, cards, modal, calibration,
  dashboard, streams, patterns, profiles, tutorials)
- Switch root route from FileResponse to Jinja2Templates
- Add jinja2 dependency
- Consolidate duplicate @keyframes spin definition
- Browser receives identical assembled HTML — zero JS changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-20 00:42:50 +03:00
parent 755077607a
commit 2b90fafb9c
35 changed files with 4986 additions and 4990 deletions

View File

@@ -0,0 +1,450 @@
/* Modal Styles */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
z-index: 2000;
align-items: center;
justify-content: center;
animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.modal-content {
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 12px;
max-width: 500px;
width: 90%;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
animation: slideUp 0.3s ease-out;
}
#template-modal .modal-content {
max-width: 500px !important;
width: 100% !important;
}
#test-template-modal .modal-content {
max-width: 420px;
}
@keyframes slideUp {
from {
transform: translateY(20px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
.modal-header {
padding: 24px 24px 16px 24px;
border-bottom: 1px solid var(--border-color);
display: flex;
align-items: center;
justify-content: space-between;
}
.modal-header h2 {
margin: 0;
font-size: 1.5rem;
color: var(--text-color);
}
.modal-header-actions {
display: flex;
align-items: center;
gap: 4px;
}
.modal-header-btn {
background: none;
border: none;
font-size: 1.1rem;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
border-radius: 4px;
transition: background 0.2s;
flex-shrink: 0;
}
.modal-header-btn:hover {
background: rgba(128, 128, 128, 0.15);
}
.modal-header-btn:disabled {
opacity: 0.4;
cursor: default;
}
.modal-close-btn {
background: none;
border: none;
color: #777;
font-size: 1.2rem;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
border-radius: 4px;
transition: color 0.2s, background 0.2s;
flex-shrink: 0;
}
.modal-close-btn:hover {
color: var(--text-color);
background: rgba(128, 128, 128, 0.15);
}
.modal-body {
padding: 24px;
}
.modal-description {
color: #999;
margin-bottom: 20px;
line-height: 1.6;
}
.password-input-wrapper {
position: relative;
display: flex;
align-items: center;
}
.password-input-wrapper input {
flex: 1;
padding-right: 45px;
}
.password-toggle {
position: absolute;
right: 8px;
background: none;
border: none;
cursor: pointer;
font-size: 1.2rem;
padding: 8px;
color: var(--text-color);
opacity: 0.6;
transition: opacity 0.2s;
}
.password-toggle:hover {
opacity: 1;
}
.label-row {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 5px;
}
.label-row label {
margin-bottom: 0;
}
.hint-toggle {
background: none;
border: 1px solid var(--border-color);
border-radius: 50%;
width: 18px;
height: 18px;
font-size: 0.7rem;
line-height: 1;
color: var(--text-secondary, #888);
cursor: pointer;
padding: 0;
display: inline-flex;
align-items: center;
justify-content: center;
opacity: 0.6;
transition: opacity 0.2s;
flex-shrink: 0;
}
.hint-toggle:hover {
opacity: 1;
}
.hint-toggle.active {
opacity: 1;
color: var(--primary-color, #4CAF50);
border-color: var(--primary-color, #4CAF50);
}
.input-hint {
display: block;
margin: 0 0 6px 0;
color: #666;
font-size: 0.85rem;
}
.fps-hint {
display: block;
margin-top: 4px;
font-size: 0.82rem;
color: var(--info-color, #2196F3);
}
.slider-row {
display: flex;
align-items: center;
gap: 12px;
}
.slider-row input[type="range"] {
flex: 1;
}
.slider-value {
min-width: 28px;
text-align: center;
font-weight: 600;
font-size: 0.95rem;
color: var(--text-primary);
}
.error-message {
background: rgba(244, 67, 54, 0.1);
border: 1px solid var(--danger-color);
color: var(--danger-color);
padding: 12px;
border-radius: 4px;
margin-top: 15px;
font-size: 0.9rem;
}
.modal-footer {
padding: 16px 24px 24px 24px;
display: flex;
justify-content: flex-end;
gap: 8px;
}
.modal-footer .btn-icon {
min-width: 60px;
padding: 10px 20px;
font-size: 1.4rem;
}
.btn-sm {
padding: 4px 10px;
font-size: 0.8rem;
min-width: auto;
}
.btn-display-picker {
width: 100%;
padding: 10px;
border: 1px solid var(--border-color);
border-radius: 4px;
background: var(--bg-color);
color: var(--text-color);
font-size: 1rem;
cursor: pointer;
text-align: left;
transition: border-color 0.2s, box-shadow 0.2s;
font-weight: 400;
}
.btn-display-picker:hover {
border-color: var(--primary-color);
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}
.modal-content-wide {
width: fit-content;
min-width: 500px;
max-width: calc(100vw - 40px);
max-height: calc(100vh - 40px);
display: flex;
flex-direction: column;
}
.modal-content-wide .modal-body {
overflow-y: auto;
scrollbar-gutter: stable;
flex: 1 1 auto;
min-height: 0;
}
@media (max-width: 768px) {
.modal-content {
width: 95%;
margin: 20px;
}
.modal-footer .btn {
min-width: 80px;
}
}
/* Image Lightbox */
.lightbox {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.92);
z-index: 10000;
justify-content: center;
align-items: center;
cursor: zoom-out;
}
.lightbox.active {
display: flex;
}
.lightbox-content {
position: relative;
max-width: 95%;
max-height: 95%;
cursor: default;
}
.lightbox-content img {
max-width: 100%;
max-height: 90vh;
object-fit: contain;
border-radius: 4px;
display: block;
}
.lightbox-close {
position: absolute;
top: 16px;
right: 16px;
background: rgba(255, 255, 255, 0.15);
border: none;
color: white;
font-size: 1.5rem;
width: 40px;
height: 40px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s;
z-index: 1;
}
.lightbox-close:hover {
background: rgba(255, 255, 255, 0.3);
}
.lightbox-refresh-btn {
position: absolute;
top: 16px;
right: 64px;
background: rgba(255, 255, 255, 0.15);
border: none;
color: white;
font-size: 1.2rem;
width: 40px;
height: 40px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s;
z-index: 1;
}
.lightbox-refresh-btn:hover {
background: rgba(255, 255, 255, 0.3);
}
.lightbox-refresh-btn.active {
background: var(--primary-color);
}
.lightbox-stats {
position: absolute;
bottom: 8px;
left: 8px;
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(8px);
color: white;
padding: 8px 14px;
border-radius: 6px;
font-size: 0.8rem;
display: flex;
gap: 16px;
flex-wrap: wrap;
}
.lightbox-stats .stat-item {
display: flex;
gap: 4px;
align-items: center;
}
.lightbox-stats .stat-item span {
opacity: 0.7;
}
.lightbox-stats .stat-item strong {
font-weight: 600;
}
/* Display Picker Lightbox */
.display-picker-content {
max-width: 900px;
width: 90%;
text-align: center;
}
.display-picker-title {
color: white;
font-size: 1.3rem;
margin-bottom: 20px;
font-weight: 500;
}
.display-picker-canvas {
background: rgba(255, 255, 255, 0.05);
border: 2px dashed rgba(255, 255, 255, 0.15);
border-radius: 8px;
padding: 24px;
width: 100%;
box-sizing: border-box;
}
.layout-display-pickable {
cursor: pointer !important;
border: 2px solid var(--border-color) !important;
background: linear-gradient(135deg, rgba(128, 128, 128, 0.08), rgba(128, 128, 128, 0.03)) !important;
}
.layout-display-pickable:hover {
box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
border-color: var(--primary-color) !important;
}
.layout-display-pickable.selected {
border-color: var(--primary-color) !important;
box-shadow: 0 0 16px rgba(76, 175, 80, 0.5);
background: rgba(76, 175, 80, 0.12) !important;
}