<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }} - {{ page_title }}</title>
<style>
:root {
--primary: #3b82f6;
--primary-dark: #2563eb;
--sidebar-bg: #1e293b;
--sidebar-text: #f8fafc;
--bg: #f1f5f9;
--text: #334155;
--text-light: #64748b;
--border: #e2e8f0;
--white: #ffffff;
--error: #ef4444;
--success: #22c55e;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background: var(--bg);
color: var(--text);
display: flex;
min-height: 100vh;
}
aside {
width: 260px;
background: var(--sidebar-bg);
color: var(--sidebar-text);
display: flex;
flex-direction: column;
transition: transform 0.3s ease;
}
.sidebar-header {
padding: 1.5rem;
font-size: 1.25rem;
font-weight: bold;
border-bottom: 1px solid rgba(255,255,255,0.1);
}
nav {
flex: 1;
padding: 1rem 0;
}
nav a {
display: flex;
align-items: center;
padding: 0.75rem 1.5rem;
color: var(--sidebar-text);
text-decoration: none;
transition: background 0.2s;
opacity: 0.8;
}
nav a:hover, nav a.active {
background: rgba(255,255,255,0.1);
opacity: 1;
}
.main {
flex: 1;
display: flex;
flex-direction: column;
}
header {
height: 64px;
background: var(--white);
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 2rem;
}
.user-menu {
display: flex;
align-items: center;
gap: 1rem;
font-size: 0.875rem;
}
.logout-btn {
color: var(--error);
text-decoration: none;
font-weight: 500;
}
.content {
padding: 2rem;
max-width: 1200px;
width: 100%;
margin: 0 auto;
}
.flash {
padding: 1rem;
border-radius: 0.5rem;
margin-bottom: 1.5rem;
font-weight: 500;
}
.flash-error { background: #fee2e2; color: var(--error); border: 1px solid #fecaca; }
.flash-success { background: #dcfce7; color: var(--success); border: 1px solid #bbf7d0; }
table {
width: 100%;
border-collapse: collapse;
background: var(--white);
border-radius: 0.5rem;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th, td {
padding: 0.75rem 1rem;
text-align: left;
border-bottom: 1px solid var(--border);
}
th {
background: #f8fafc;
font-weight: 600;
color: var(--text-light);
cursor: pointer;
}
th:hover { background: #f1f5f9; }
tr:hover { background: #f8fafc; }
.btn {
display: inline-block;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
text-decoration: none;
font-weight: 500;
cursor: pointer;
border: 1px solid transparent;
transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--error); border-color: var(--error); background: transparent; }
.btn-danger:hover { background: var(--error); color: white; }
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-control {
width: 100%;
padding: 0.625rem;
border: 1px solid var(--border);
border-radius: 0.375rem;
box-sizing: border-box;
font-size: 1rem;
}
.form-control:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-help { font-size: 0.875rem; color: var(--text-light); margin-top: 0.25rem; }
.form-error { color: var(--error); font-size: 0.875rem; margin-top: 0.25rem; }
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 1.5rem;
}
.card {
background: var(--white);
padding: 1.5rem;
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
text-decoration: none;
color: inherit;
display: flex;
align-items: center;
gap: 1rem;
transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.card-icon {
font-size: 1.5rem;
width: 48px;
height: 48px;
background: var(--bg);
display: flex;
align-items: center;
justify-content: center;
border-radius: 0.5rem;
}
.pagination {
display: flex;
justify-content: center;
gap: 0.5rem;
margin-top: 2rem;
}
.pagination a {
padding: 0.5rem 0.75rem;
border: 1px solid var(--border);
background: var(--white);
color: var(--text);
text-decoration: none;
border-radius: 0.375rem;
}
.pagination a.active {
background: var(--primary);
color: white;
border-color: var(--primary);
}
@media (max-width: 768px) {
aside {
position: fixed;
z-index: 100;
height: 100%;
transform: translateX(-100%);
}
aside.open { transform: translateX(0); }
}
</style>
</head>
<body>
<aside id="sidebar">
<div class="sidebar-header">{{ title }}</div>
<nav>
{% if user %}
<a href="{{ path_dashboard }}" class="{% if page_title == 'Dashboard' %}active{% endif %}">Dashboard</a>
{% for res in resources %}
<a href="{{ res.path_list }}" class="{% if current_slug == res.slug %}active{% endif %}">
{{ res.plural_name }}
</a>
{% endfor %}
{% endif %}
</nav>
</aside>
<div class="main">
<header>
<div style="display: flex; align-items: center; gap: 1rem;">
<button id="sidebar-toggle" style="display:none; background:none; border:none; cursor:pointer; font-size: 1.5rem;">☰</button>
<span style="font-weight: 600;">{{ page_title }}</span>
</div>
<div class="user-menu">
{% if user %}
<span>Logged in as <strong>{{ user }}</strong></span>
<a href="{{ path_logout }}" class="logout-btn">Logout</a>
{% endif %}
</div>
</header>
<div class="content">
{% if flash_error %}<div class="flash flash-error">{{ flash_error }}</div>{% endif %}
{% if flash_success %}<div class="flash flash-success">{{ flash_success }}</div>{% endif %}
{% block content %}{% endblock %}
</div>
</div>
<script>
document.getElementById('sidebar-toggle')?.addEventListener('click', () => {
document.getElementById('sidebar').classList.toggle('open');
});
</script>
</body>
</html>