<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Админ-панель{% endblock %} — CS2 Simulator</title>
    <link rel="stylesheet" href="/static/css/style.css">
    <style>
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
        html { font-size: 15px; }
        body {
            background: #0b0c10;
            color: #e8e8e8;
            font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
            min-height: 100vh;
            display: flex;
        }

        /* ─── Sidebar ─── */
        .admin-sidebar {
            width: 240px;
            min-height: 100vh;
            background: linear-gradient(180deg, #111216 0%, #0d0e12 100%);
            border-right: 1px solid rgba(255,255,255,0.04);
            display: flex;
            flex-direction: column;
            position: sticky; top: 0; height: 100vh;
            flex-shrink: 0;
        }
        .admin-sidebar .sb-brand {
            padding: 1.25rem 1.25rem 0.75rem;
            font-size: 1rem;
            font-weight: 700;
            letter-spacing: 0.02em;
            display: flex; align-items: center; gap: 0.5rem;
            border-bottom: 1px solid rgba(255,255,255,0.04);
        }
        .admin-sidebar .sb-brand span { color: #f59e0b; }
        .admin-sidebar .sb-nav {
            flex: 1; padding: 0.75rem 0;
            display: flex; flex-direction: column; gap: 0.15rem;
        }
        .admin-sidebar .sb-nav a {
            display: flex; align-items: center; gap: 0.65rem;
            padding: 0.65rem 1.25rem;
            font-size: 0.85rem;
            color: rgba(255,255,255,0.55);
            text-decoration: none;
            transition: all 0.15s;
            border-left: 2px solid transparent;
            font-weight: 450;
        }
        .admin-sidebar .sb-nav a:hover {
            color: rgba(255,255,255,0.85);
            background: rgba(255,255,255,0.03);
        }
        .admin-sidebar .sb-nav a.active {
            color: #f59e0b;
            background: rgba(245,158,11,0.06);
            border-left-color: #f59e0b;
        }
        .admin-sidebar .sb-nav a .sb-icon { font-size: 1rem; width: 20px; text-align: center; }
        .admin-sidebar .sb-footer {
            padding: 0.75rem 1.25rem;
            border-top: 1px solid rgba(255,255,255,0.04);
            font-size: 0.75rem;
            color: rgba(255,255,255,0.3);
        }
        .admin-sidebar .sb-footer a {
            color: rgba(255,255,255,0.5);
            text-decoration: none;
            display: flex; align-items: center; gap: 0.4rem;
        }
        .admin-sidebar .sb-footer a:hover { color: #f59e0b; }

        /* ─── Main area ─── */
        .admin-main {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
        }
        .admin-topbar {
            display: flex; align-items: center; justify-content: space-between;
            padding: 0.85rem 1.5rem;
            background: rgba(17,18,22,0.8);
            backdrop-filter: blur(8px);
            border-bottom: 1px solid rgba(255,255,255,0.04);
            position: sticky; top: 0; z-index: 10;
        }
        .admin-topbar .at-title {
            font-size: 1rem; font-weight: 600;
            display: flex; align-items: center; gap: 0.5rem;
        }
        .admin-topbar .at-title .at-sub {
            font-size: 0.75rem; color: rgba(255,255,255,0.35);
            font-weight: 400;
        }
        .admin-topbar .at-actions { display: flex; align-items: center; gap: 0.75rem; }
        .admin-topbar .at-actions .at-back {
            color: rgba(255,255,255,0.5); text-decoration: none;
            font-size: 0.8rem; display: flex; align-items: center; gap: 0.3rem;
            transition: color 0.15s;
        }
        .admin-topbar .at-actions .at-back:hover { color: #f59e0b; }
        .admin-topbar .at-actions .at-user {
            color: rgba(255,255,255,0.5); font-size: 0.8rem;
            display: flex; align-items: center; gap: 0.3rem;
        }

        .admin-content {
            flex: 1;
            padding: 1.5rem;
            overflow-y: auto;
        }

        /* ─── Cards ─── */
        .a-card {
            background: rgba(17,18,22,0.6);
            border: 1px solid rgba(255,255,255,0.05);
            border-radius: 12px;
            padding: 1.25rem;
            margin-bottom: 1.25rem;
        }
        .a-card-header {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 1rem;
            font-size: 0.85rem; font-weight: 600;
            color: rgba(255,255,255,0.7);
        }

        /* ─── Stats grid ─── */
        .a-stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
            gap: 1rem;
            margin-bottom: 1.5rem;
        }
        .a-stat {
            background: rgba(17,18,22,0.6);
            border: 1px solid rgba(255,255,255,0.05);
            border-radius: 12px;
            padding: 1.25rem;
            display: flex; flex-direction: column; gap: 0.25rem;
            position: relative; overflow: hidden;
        }
        .a-stat .as-label {
            font-size: 0.7rem; text-transform: uppercase;
            letter-spacing: 0.06em;
            color: rgba(255,255,255,0.35);
        }
        .a-stat .as-value {
            font-size: 1.8rem; font-weight: 700;
            line-height: 1.1;
        }
        .a-stat .as-bar {
            position: absolute; bottom: 0; left: 0; height: 2px;
            border-radius: 0 2px 0 0;
            transition: width 0.6s ease;
        }
        .a-stat .as-sub {
            font-size: 0.75rem; color: rgba(255,255,255,0.35);
        }

        /* ─── Tables ─── */
        .a-table-wrap {
            overflow-x: auto;
            border: 1px solid rgba(255,255,255,0.05);
            border-radius: 10px;
        }
        .a-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.82rem;
        }
        .a-table th {
            text-align: left;
            padding: 0.7rem 0.9rem;
            font-weight: 600;
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: rgba(255,255,255,0.35);
            background: rgba(0,0,0,0.2);
            border-bottom: 1px solid rgba(255,255,255,0.04);
        }
        .a-table td {
            padding: 0.65rem 0.9rem;
            border-bottom: 1px solid rgba(255,255,255,0.03);
            vertical-align: middle;
        }
        .a-table tr:last-child td { border-bottom: none; }
        .a-table tr:hover td { background: rgba(255,255,255,0.02); }
        .a-table .td-actions {
            display: flex; gap: 0.35rem;
            flex-wrap: wrap;
        }

        /* ─── Buttons ─── */
        .a-btn {
            display: inline-flex; align-items: center; gap: 0.35rem;
            padding: 0.45rem 0.9rem;
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 7px;
            font-size: 0.78rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.15s;
            background: rgba(255,255,255,0.04);
            color: rgba(255,255,255,0.7);
            text-decoration: none;
            line-height: 1.3;
            white-space: nowrap;
        }
        .a-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); color: #fff; }
        .a-btn-primary {
            background: rgba(245,158,11,0.12);
            border-color: rgba(245,158,11,0.2);
            color: #f59e0b;
        }
        .a-btn-primary:hover { background: rgba(245,158,11,0.2); border-color: #f59e0b; }
        .a-btn-danger {
            background: rgba(239,68,68,0.1);
            border-color: rgba(239,68,68,0.15);
            color: #ef4444;
        }
        .a-btn-danger:hover { background: rgba(239,68,68,0.2); border-color: #ef4444; }
        .a-btn-success {
            background: rgba(34,197,94,0.1);
            border-color: rgba(34,197,94,0.15);
            color: #22c55e;
        }
        .a-btn-success:hover { background: rgba(34,197,94,0.2); border-color: #22c55e; }
        .a-btn-sm { padding: 0.3rem 0.55rem; font-size: 0.7rem; }
        .a-btn:disabled { opacity: 0.4; cursor: not-allowed; }

        /* ─── Form inputs ─── */
        .a-input {
            background: rgba(0,0,0,0.3);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 7px;
            padding: 0.5rem 0.75rem;
            color: #e8e8e8;
            font-size: 0.82rem;
            outline: none;
            transition: border-color 0.15s;
            width: 100%;
        }
        .a-input:focus { border-color: rgba(245,158,11,0.4); }
        .a-input-sm { padding: 0.35rem 0.5rem; font-size: 0.78rem; }
        .a-label {
            display: block;
            font-size: 0.75rem;
            font-weight: 600;
            color: rgba(255,255,255,0.5);
            margin-bottom: 0.35rem;
        }

        /* ─── Badge ─── */
        .a-badge {
            display: inline-flex;
            padding: 0.15rem 0.45rem;
            border-radius: 4px;
            font-size: 0.7rem;
            font-weight: 600;
        }
        .a-badge-admin { background: rgba(245,158,11,0.12); color: #f59e0b; }
        .a-badge-user { background: rgba(59,130,246,0.12); color: #60a5fa; }
        .a-badge-banned { background: rgba(239,68,68,0.12); color: #ef4444; }

        /* ─── Modal ─── */
        .a-overlay {
            position: fixed; inset: 0;
            background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
            z-index: 100; display: none; align-items: center; justify-content: center;
            padding: 1rem;
        }
        .a-overlay.open { display: flex; }
        .a-modal {
            background: #16171d;
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 16px;
            padding: 1.5rem;
            max-width: 460px; width: 100%;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
        }
        .a-modal-title {
            font-size: 1rem; font-weight: 600; margin-bottom: 1rem;
        }
        .a-modal-actions {
            display: flex; gap: 0.5rem; margin-top: 1rem;
            justify-content: flex-end;
        }

        /* ─── Grid helpers ─── */
        .a-row { display: flex; gap: 1rem; flex-wrap: wrap; }
        .a-row > * { flex: 1; min-width: 0; }
        .a-gap-sm { gap: 0.5rem; }
        .a-mt { margin-top: 1rem; }
        .a-mb { margin-bottom: 1rem; }
        .a-flex { display: flex; align-items: center; gap: 0.5rem; }

        /* ─── Empty state ─── */
        .a-empty {
            text-align: center; padding: 3rem 1rem;
            color: rgba(255,255,255,0.3);
        }
        .a-empty .a-empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

        @media(max-width:768px){
            .admin-sidebar { width: 56px; }
            .admin-sidebar .sb-brand span,
            .admin-sidebar .sb-nav a span:not(.sb-icon),
            .admin-sidebar .sb-footer span { display: none; }
            .admin-sidebar .sb-nav a { justify-content: center; padding: 0.65rem; }
            .admin-sidebar .sb-footer a { justify-content: center; }
        }
        {% block extra_styles %}{% endblock %}
    </style>
</head>
<body>

<div class="admin-sidebar">
    <div class="sb-brand">
        <span style="font-size:1.2rem">⚡</span>
        <span>CS2 <span>Admin</span></span>
    </div>
    <nav class="sb-nav">
        <a href="/admin" class="{% block nav_dashboard %}{% endblock %}">
            <span class="sb-icon">📊</span> <span>Дашборд</span>
        </a>
        <a href="/admin/users" class="{% block nav_users %}{% endblock %}">
            <span class="sb-icon">👥</span> <span>Пользователи</span>
        </a>
        <a href="/admin/cases" class="{% block nav_cases %}{% endblock %}">
            <span class="sb-icon">📦</span> <span>Кейсы</span>
        </a>
    </nav>
    <div class="sb-footer">
        <a href="/">&larr; <span>На сайт</span></a>
    </div>
</div>

<div class="admin-main">
    <div class="admin-topbar">
        <div class="at-title">
            {% block page_title %}Панель управления{% endblock %}
        </div>
        <div class="at-actions">
            {% block top_actions %}{% endblock %}
        </div>
    </div>
    <div class="admin-content">
        {% block content %}{% endblock %}
    </div>
</div>

{% block modals %}{% endblock %}
<script src="/static/js/notifications.js"></script>
{% block scripts %}{% endblock %}
</body>
</html>
