Refactor admin frontend into modular SPA

This commit is contained in:
Zuev
2026-02-26 00:27:10 +03:00
parent 18f47c6d3d
commit 772b110762
21 changed files with 2204 additions and 2351 deletions

View File

@@ -0,0 +1,586 @@
/* ===== Cards ===== */
.card {
background: var(--bg-card);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid var(--bg-card-border);
border-radius: var(--radius-md);
padding: 1.75rem;
position: relative;
overflow: visible;
transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
animation: slideUpCard 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) both;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
opacity: 0;
transition: opacity var(--transition);
}
.card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
border-color: rgba(255, 255, 255, 0.12);
}
.card:hover::before {
opacity: 1;
}
.create-card {
z-index: 10;
}
.card h2 {
font-size: 0.8rem;
font-weight: 600;
margin-bottom: 1rem;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.04em;
}
/* ===== Form Structure ===== */
.form-row {
display: flex;
gap: 1rem;
align-items: flex-end;
flex-wrap: wrap;
}
.form-group {
flex: 1;
min-width: 160px;
}
.form-group label {
display: block;
font-size: 0.78rem;
font-weight: 500;
color: var(--text-secondary);
margin-bottom: 0.4rem;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.form-group input,
.form-group select {
width: 100%;
padding: 0.75rem 1rem;
background: var(--bg-input);
border: 1px solid var(--bg-card-border);
border-radius: var(--radius-sm);
color: var(--text-primary);
font-family: inherit;
font-size: 0.95rem;
outline: none;
transition: all var(--transition);
}
.form-group input::placeholder {
color: var(--text-placeholder);
transition: opacity var(--transition);
}
.form-group input:focus,
.form-group select:focus {
background: var(--bg-input-focus);
border-color: var(--accent);
box-shadow: 0 0 0 4px var(--accent-glow);
transform: translateY(-1px);
}
.form-group input:focus::placeholder {
opacity: 0.5;
}
/* Hide Number Arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input[type="number"] {
-moz-appearance: textfield;
}
/* Select Base Style */
.form-group select,
.filter-row select {
cursor: pointer;
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 0.75rem center;
padding-right: 2.25rem;
}
.form-group select option,
.filter-row select option {
background: #1a1a2e;
color: var(--text-primary);
}
/* Light theme selects */
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .filter-row select {
border-color: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .form-group select option,
[data-theme="light"] .filter-row select option {
background: #fff;
color: #1a1a2e;
}
/* Filter Row */
.card-header-row {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 0.75rem;
}
.card-header-row h2 {
margin-bottom: 0;
}
.filter-row {
display: flex;
align-items: center;
gap: 0.5rem;
}
.filter-row label {
font-size: 0.78rem;
font-weight: 500;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.04em;
white-space: nowrap;
}
.filter-row select {
padding: 0.45rem 2rem 0.45rem 0.7rem;
background: var(--bg-input);
border: 1px solid transparent;
border-radius: var(--radius-sm);
color: var(--text-primary);
font-size: 0.85rem;
transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.filter-row select:focus {
background-color: var(--bg-input-focus);
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-glow);
}
/* ===== Custom Multi-Select ===== */
.custom-multi-select {
position: relative;
user-select: none;
width: 100%;
}
.select-box {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 0.75rem 1rem;
background: var(--bg-input);
border: 1px solid var(--bg-card-border);
border-radius: var(--radius-sm);
color: var(--text-primary);
font-size: 0.95rem;
cursor: pointer;
transition: all var(--transition);
}
.select-box:hover {
background: var(--bg-hover);
}
.select-box.active {
border-color: var(--accent);
box-shadow: 0 0 0 4px var(--accent-glow);
}
.dropdown-icon {
transition: transform var(--transition);
}
.select-box.active .dropdown-icon {
transform: rotate(180deg);
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
width: 100%;
margin-top: 0.5rem;
background: rgba(15, 23, 42, 0.95);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid var(--bg-card-border);
border-radius: var(--radius-sm);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
padding: 1rem;
z-index: 100;
opacity: 0;
visibility: hidden;
transform: translateY(-10px);
transition: all var(--transition);
}
[data-theme="light"] .custom-multi-select .dropdown-menu {
background: rgba(255, 255, 255, 0.98);
}
.dropdown-menu.open {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.checkbox-group-vertical {
display: flex;
flex-direction: column;
gap: 0.75rem;
max-height: 200px;
overflow-y: auto;
}
.checkbox-item {
display: flex;
align-items: center;
gap: 0.75rem;
cursor: pointer;
font-size: 0.9rem;
color: var(--text-primary);
padding: 0.25rem 0;
}
.checkbox-item input[type="checkbox"] {
cursor: pointer;
width: 1.1rem;
height: 1.1rem;
accent-color: var(--accent);
}
/* ===== Buttons ===== */
.btn-primary {
position: relative;
overflow: hidden;
padding: 0.75rem 1.75rem;
background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
border: none;
border-radius: var(--radius-sm);
color: #fff;
font-family: inherit;
font-size: 0.95rem;
font-weight: 600;
letter-spacing: 0.02em;
cursor: pointer;
white-space: nowrap;
transition: all var(--transition);
box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
border-radius: inherit;
opacity: 0;
transition: opacity var(--transition);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px var(--accent-glow);
}
.btn-primary:hover::before {
opacity: 1;
}
.btn-primary:active {
transform: translateY(1px);
box-shadow: 0 2px 10px var(--accent-glow);
}
.btn-delete {
padding: 0.35rem 0.7rem;
background: rgba(248, 113, 113, 0.1);
border: 1px solid rgba(248, 113, 113, 0.2);
border-radius: var(--radius-sm);
color: var(--error);
font-family: inherit;
font-size: 0.8rem;
cursor: pointer;
transition: background var(--transition), transform var(--transition);
position: relative;
overflow: hidden;
}
.btn-delete:hover {
background: rgba(248, 113, 113, 0.2);
transform: scale(1.05);
}
.btn-icon-toggle {
background: transparent;
border: 1px solid var(--bg-card-border);
color: var(--text-secondary);
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
padding: 0;
}
.btn-icon-toggle:hover {
background: var(--bg-card);
border-color: var(--accent);
color: var(--accent);
transform: rotate(45deg);
box-shadow: 0 0 10px var(--accent-glow);
}
.btn-edit-classroom {
padding: 0.35rem 0.7rem;
background: rgba(99, 102, 241, 0.1);
border: 1px solid rgba(99, 102, 241, 0.2);
border-radius: var(--radius-sm);
color: var(--accent-hover);
cursor: pointer;
transition: all var(--transition);
}
.btn-edit-classroom:hover {
background: rgba(99, 102, 241, 0.2);
transform: translateY(-1px);
}
/* ===== Alerts ===== */
.form-alert {
display: none;
padding: 0.6rem 1rem;
border-radius: var(--radius-sm);
font-size: 0.85rem;
margin-top: 0.75rem;
}
.form-alert.error {
display: block;
background: rgba(248, 113, 113, 0.1);
border: 1px solid rgba(248, 113, 113, 0.2);
color: var(--error);
animation: slideDownAlert 0.3s ease-out both;
}
.form-alert.success {
display: block;
background: rgba(52, 211, 153, 0.1);
border: 1px solid rgba(52, 211, 153, 0.2);
color: var(--success);
animation: slideDownAlert 0.3s ease-out both;
}
/* ===== Table ===== */
.table-wrap {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
thead th {
text-align: left;
font-size: 0.78rem;
font-weight: 600;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.04em;
padding: 0.6rem 0.8rem;
border-bottom: 1px solid var(--bg-card-border);
}
tbody td {
padding: 0.85rem 1rem;
font-size: 0.95rem;
border-bottom: 1px solid var(--bg-card-border);
transition: background var(--transition);
}
[data-theme="light"] tbody td {
border-bottom-color: rgba(0, 0, 0, 0.08);
}
tbody tr {
transition: background var(--transition);
animation: slideInRow 0.3s ease-out both;
}
/* Animation delays */
tbody tr:nth-child(1) {
animation-delay: 0.05s;
}
tbody tr:nth-child(2) {
animation-delay: 0.1s;
}
tbody tr:nth-child(3) {
animation-delay: 0.15s;
}
tbody tr:nth-child(4) {
animation-delay: 0.2s;
}
tbody tr:nth-child(5) {
animation-delay: 0.25s;
}
tbody tr:nth-child(n+6) {
animation-delay: 0.3s;
}
tbody tr:hover {
background: var(--bg-hover);
}
.loading-row {
text-align: center;
color: var(--text-secondary);
padding: 2rem !important;
}
/* ===== Badges ===== */
.badge {
display: inline-block;
padding: 0.2rem 0.6rem;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.03em;
}
.badge-admin {
background: rgba(248, 113, 113, 0.15);
color: var(--error);
}
.badge-teacher {
background: rgba(251, 191, 36, 0.15);
color: var(--warning);
}
.badge-student {
background: rgba(52, 211, 153, 0.15);
color: var(--success);
}
.badge-ef {
background: rgba(99, 102, 241, 0.15);
color: var(--accent-hover);
}
/* Classroom Status */
.badge-available {
background: rgba(16, 185, 129, 0.15);
color: var(--success);
}
.badge-unavailable {
background: rgba(248, 113, 113, 0.15);
color: var(--error);
}
.status-cell {
display: flex;
align-items: center;
gap: 8px;
}
/* ===== Modal ===== */
.modal-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
z-index: 1000;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity var(--transition);
}
.modal-overlay.open {
display: flex;
opacity: 1;
}
.modal-content {
background: var(--bg-primary);
border: 1px solid var(--bg-card-border);
border-radius: var(--radius-md);
padding: 2rem;
width: 90%;
max-width: 500px;
position: relative;
transform: scale(0.95);
transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.modal-overlay.open .modal-content {
transform: scale(1);
}
.modal-close {
position: absolute;
top: 1rem;
right: 1rem;
background: none;
border: none;
font-size: 1.5rem;
color: var(--text-secondary);
cursor: pointer;
transition: color var(--transition);
}
.modal-close:hover {
color: var(--error);
}

View File

@@ -0,0 +1,216 @@
/* ===== Sidebar ===== */
.sidebar {
width: 260px;
min-height: 100vh;
background: var(--bg-sidebar);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-right: 1px solid var(--bg-card-border);
display: flex;
flex-direction: column;
position: fixed;
left: 0;
top: 0;
bottom: 0;
z-index: 10;
transition: background 0.4s ease, border-color 0.4s ease, transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.sidebar-header {
padding: 1.25rem;
border-bottom: 1px solid var(--bg-card-border);
}
.logo {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 1.15rem;
font-weight: 700;
letter-spacing: -0.02em;
}
.sidebar-nav {
flex: 1;
padding: 0.75rem;
}
.nav-item {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem 1rem;
margin-bottom: 0.25rem;
border-radius: var(--radius-sm);
color: var(--text-secondary);
text-decoration: none;
font-size: 0.95rem;
font-weight: 500;
transition: all var(--transition);
position: relative;
overflow: hidden;
}
.nav-item::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 3px;
background: var(--accent);
border-radius: 0 4px 4px 0;
transform: scaleY(0);
transition: transform var(--transition);
opacity: 0;
}
.nav-item:hover {
background: var(--bg-hover);
color: var(--text-primary);
transform: translateX(4px);
}
.nav-item.active {
background: rgba(139, 92, 246, 0.12);
color: var(--accent-hover);
}
[data-theme="light"] .nav-item.active {
background: rgba(99, 102, 241, 0.18);
}
.nav-item.active::before {
transform: scaleY(1);
opacity: 1;
}
.nav-item svg {
transition: transform var(--transition);
}
.nav-item:hover svg,
.nav-item.active svg {
transform: scale(1.15) rotate(-5deg);
}
.sidebar-footer {
padding: 0.75rem;
border-top: 1px solid var(--bg-card-border);
}
.btn-logout {
width: 100%;
display: flex;
align-items: center;
gap: 0.6rem;
padding: 0.65rem 0.8rem;
border: none;
border-radius: var(--radius-sm);
background: none;
color: var(--text-secondary);
font-family: inherit;
font-size: 0.9rem;
cursor: pointer;
transition: background var(--transition), color var(--transition);
position: relative;
}
.btn-logout:hover {
background: rgba(248, 113, 113, 0.1);
color: var(--error);
}
/* ===== Main ===== */
.main {
flex: 1;
margin-left: 260px;
min-height: 100vh;
}
.topbar {
padding: 1.5rem 2rem;
border-bottom: 1px solid var(--bg-card-border);
transition: border-color 0.4s ease;
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
}
.topbar h1 {
font-size: 1.3rem;
font-weight: 700;
letter-spacing: -0.02em;
flex: 1;
}
.content {
padding: 1.5rem 2rem;
display: flex;
flex-direction: column;
gap: 1.5rem;
animation: fadeIn 0.2s ease;
}
/* ===== Mobile Menu Toggle ===== */
.menu-toggle {
display: none;
padding: 0.4rem;
background: none;
border: none;
color: var(--text-primary);
cursor: pointer;
border-radius: var(--radius-sm);
transition: background var(--transition);
}
.menu-toggle:hover {
background: var(--bg-hover);
}
.sidebar-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(2px);
z-index: 9;
opacity: 0;
transition: opacity var(--transition);
}
/* ===== Responsive Mobile ===== */
@media (max-width: 768px) {
.sidebar {
transform: translateX(-100%);
}
.sidebar.open {
transform: translateX(0);
}
.main {
margin-left: 0;
}
.topbar {
padding: 1rem 1.25rem;
}
.content {
padding: 1.25rem;
}
.menu-toggle,
.sidebar-overlay {
display: block;
}
.sidebar-overlay.open {
opacity: 1;
}
}

110
frontend/admin/css/main.css Normal file
View File

@@ -0,0 +1,110 @@
/* ===== Reset & Base ===== */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
/* Deep dark premium background */
--bg-primary: #0a0a0f;
--bg-sidebar: rgba(255, 255, 255, 0.02);
--bg-card: rgba(255, 255, 255, 0.03);
--bg-card-border: rgba(255, 255, 255, 0.05);
--bg-input: rgba(255, 255, 255, 0.04);
--bg-input-focus: rgba(255, 255, 255, 0.08);
--bg-hover: rgba(255, 255, 255, 0.06);
/* Typography */
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--text-placeholder: #475569;
/* Vibrant Accents */
--accent: #8b5cf6;
--accent-hover: #a78bfa;
--accent-glow: rgba(139, 92, 246, 0.4);
--accent-secondary: #ec4899;
/* Status Colors */
--error: #ef4444;
--success: #10b981;
--warning: #f59e0b;
/* Spatial */
--radius-sm: 10px;
--radius-md: 16px;
--transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
/* ===== Light Theme ===== */
[data-theme="light"] {
--bg-primary: #f8fafc;
--bg-sidebar: rgba(255, 255, 255, 0.7);
--bg-card: rgba(255, 255, 255, 0.75);
--bg-card-border: rgba(0, 0, 0, 0.08);
--bg-input: rgba(0, 0, 0, 0.03);
--bg-input-focus: rgba(0, 0, 0, 0.06);
--bg-hover: rgba(0, 0, 0, 0.05);
--text-primary: #0f172a;
--text-secondary: #475569;
--text-placeholder: #94a3b8;
--accent: #6366f1;
--accent-hover: #4f46e5;
--accent-glow: rgba(99, 102, 241, 0.3);
--accent-secondary: #d946ef;
--error: #ef4444;
--success: #10b981;
--warning: #f59e0b;
}
html {
font-size: 16px;
-webkit-font-smoothing: antialiased;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
display: flex;
transition: background 0.4s ease, color 0.4s ease;
}
/* ===== Animations ===== */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(4px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUpCard {
from { opacity: 0; transform: translateY(15px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDownAlert {
from { opacity: 0; transform: translateY(-10px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRow {
from { opacity: 0; transform: translateX(-10px); }
to { opacity: 1; transform: translateX(0); }
}
@keyframes admin-ripple {
to { transform: scale(4); opacity: 0; }
}
.ripple {
position: absolute;
border-radius: 50%;
transform: scale(0);
animation: admin-ripple 0.6s linear;
background-color: rgba(255, 255, 255, 0.3);
pointer-events: none;
}