/* =============================================================
   Кресло Спецов CRMP — Панель Спец. Администрации
   Тёмно-фиолетовый кибер-стиль (CRMP Noir & Neon)
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-primary:    #060713;
    --bg-secondary:  #0c0e22;
    --bg-card:       rgba(18, 22, 48, 0.82);
    --bg-hover:      rgba(28, 34, 72, 0.92);
    --border:        rgba(139, 92, 246, 0.22);
    --border-light:  rgba(139, 92, 246, 0.12);

    --text-primary:  #f3f4f6;
    --text-muted:    #a1a1aa;
    --text-dim:      #71717a;

    --accent-red:    #f43f5e;
    --accent-red-2:  #e11d48;
    --accent-crimson:#fb7185;
    --accent-gold:   #f59e0b;
    --accent-blue:   #6366f1;
    --accent-green:  #10b981;
    --accent-purple: #8b5cf6;
    --accent-cyan:   #06b6d4;

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;

    --shadow-sm:  0 2px 8px rgba(0,0,0,0.45);
    --shadow-md:  0 8px 24px rgba(0,0,0,0.65);
    --shadow-lg:  0 16px 40px rgba(0,0,0,0.80);
    --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.25);

    --font-main:  'Plus Jakarta Sans', sans-serif;
    --font-title: 'Outfit', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.16) 0%, transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(6, 182, 212, 0.10) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(10, 12, 30, 0.85) 0%, var(--bg-primary) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent-crimson); text-decoration: none; transition: color .2s; }
a:hover { color: #ff6b81; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3c475d; }

.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; height: 100vh;
    z-index: 100;
    transition: transform .3s ease;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #7c3aed 0%, #f43f5e 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    box-shadow: 0 0 18px rgba(139, 92, 246, 0.5);
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-family: var(--font-title);
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: 0.5px;
}

.sidebar-logo-sub {
    font-size: 11px;
    color: var(--accent-crimson);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sidebar-nav { padding: 14px 0; flex: 1; }

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    padding: 14px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: all .2s;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(231, 76, 60, 0.18), transparent);
    border-left-color: var(--accent-red);
    font-weight: 600;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.nav-item.active svg { opacity: 1; stroke: var(--accent-crimson); }

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0,0,0,0.15);
}

.sidebar-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-red-2), #e74c3c);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-weight: 600; font-size: 13.5px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--accent-crimson); font-weight: 600; }

.sidebar-logout {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim); border-radius: var(--radius-sm);
    transition: all .2s; flex-shrink: 0;
}
.sidebar-logout:hover { color: var(--accent-red); background: rgba(231,76,60,0.15); }

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1; min-height: 100vh;
    display: flex; flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 28px; gap: 16px;
    position: sticky; top: 0; z-index: 50;
}

.topbar-title {
    font-family: var(--font-title);
    font-size: 22px; font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    flex: 1;
}

.topbar-subtitle { font-size: 13px; color: var(--text-muted); }

.topbar-burger {
    display: none; background: none; border: none;
    color: var(--text-muted); cursor: pointer; padding: 6px;
}

.page-body { padding: 28px; flex: 1; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    justify-content: space-between; gap: 14px;
}

.card-title {
    font-family: var(--font-title);
    font-size: 17px; font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.card-body { padding: 24px; }

/* ── Stats Grid ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dash-stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .2s, border-color .2s;
}

.dash-stat-box:hover {
    transform: translateY(-2px);
    border-color: var(--accent-red);
}

.dash-stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}

.dash-stat-icon.red    { background: rgba(231,76,60,0.15); color: var(--accent-red); }
.dash-stat-icon.crimson{ background: rgba(255,71,87,0.15); color: var(--accent-crimson); }
.dash-stat-icon.gold   { background: rgba(230,126,34,0.15); color: var(--accent-gold); }
.dash-stat-icon.blue   { background: rgba(52,152,219,0.15); color: var(--accent-blue); }
.dash-stat-icon.green  { background: rgba(46,204,113,0.15); color: var(--accent-green); }
.dash-stat-icon.purple { background: rgba(155,89,182,0.15); color: var(--accent-purple); }

.dash-stat-info { flex: 1; min-width: 0; }
.dash-stat-label { font-size: 11.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; }
.dash-stat-val { font-family: var(--font-title); font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1.1; margin-top: 2px; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; font-size: 11.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .6px;
    color: var(--text-muted); margin-bottom: 7px;
}

.form-control, .form-select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-family: var(--font-main);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b99ad' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
    appearance: none;
}

.form-select[multiple] {
    background-image: none;
    padding-right: 12px;
    height: 150px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 7px; padding: 9px 18px;
    border: none; border-radius: var(--radius-md);
    font-size: 13.5px; font-weight: 600; font-family: var(--font-main);
    cursor: pointer; transition: all .2s; text-decoration: none;
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2)); color: #fff; box-shadow: 0 4px 12px rgba(231,76,60,0.3); }
.btn-primary:hover { background: linear-gradient(135deg, #ff6b81, var(--accent-red)); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: #43506d; }

.btn-danger { background: rgba(231,76,60,0.15); color: var(--accent-red); border: 1px solid rgba(231,76,60,0.3); }
.btn-danger:hover { background: rgba(231,76,60,0.3); }

.btn-success { background: rgba(46,204,113,0.15); color: var(--accent-green); border: 1px solid rgba(46,204,113,0.3); }
.btn-success:hover { background: rgba(46,204,113,0.25); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Badges ── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 100px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}

.badge-red     { background: rgba(231,76,60,0.18); color: #ff7675; }
.badge-crimson { background: rgba(255,71,87,0.18); color: var(--accent-crimson); }
.badge-gold    { background: rgba(230,126,34,0.18); color: #fdcb6e; }
.badge-blue    { background: rgba(52,152,219,0.18); color: #74b9ff; }
.badge-green   { background: rgba(46,204,113,0.18); color: #55efc4; }
.badge-purple  { background: rgba(155,89,182,0.18); color: #a29bfe; }
.badge-gray    { background: rgba(139,153,173,0.15); color: var(--text-muted); }

/* ── Tables ── */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
}

.table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table thead th {
    padding: 12px 16px; text-align: left;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .7px; color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary); white-space: nowrap;
}

.table tbody tr { border-bottom: 1px solid var(--border-light); transition: background .15s; }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child { border-bottom: none; }
.table td { padding: 12px 16px; vertical-align: middle; }

/* ── Forum ── */
.forum-cat-item {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 20px; border-bottom: 1px solid var(--border-light);
    transition: background .2s;
}
.forum-cat-item:hover { background: var(--bg-hover); }
.forum-cat-item:last-child { border-bottom: none; }

.forum-cat-icon { font-size: 28px; width: 44px; text-align: center; flex-shrink: 0; }
.forum-cat-info { flex: 1; min-width: 0; }
.forum-cat-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.forum-cat-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.forum-cat-stats { text-align: right; font-size: 12px; color: var(--text-muted); flex-shrink: 0; min-width: 120px; }
.forum-cat-stats span { color: var(--text-primary); font-weight: 600; }

.forum-topic-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 20px; border-bottom: 1px solid var(--border-light);
    transition: background .15s;
}
.forum-topic-item:hover { background: var(--bg-hover); }
.forum-topic-item:last-child { border-bottom: none; }

.forum-topic-title { font-size: 14.5px; font-weight: 600; color: var(--text-primary); }
.forum-topic-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.forum-post-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow: hidden;
}

.forum-post-header {
    padding: 12px 18px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}

.forum-post-body { padding: 18px; line-height: 1.7; white-space: pre-wrap; font-size: 14px; }

/* ── Pagination ── */
.pagination {
    display: flex; align-items: center; gap: 4px;
    padding: 16px 20px; border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.pagination-info { font-size: 12px; color: var(--text-muted); margin-right: auto; }
.page-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    font-size: 13px; color: var(--text-muted); text-decoration: none;
    border: 1px solid transparent; transition: all .2s;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }
.page-btn.active { background: var(--accent-red); color: #fff; border-color: var(--accent-red); }
.page-btn.disabled { opacity: .3; pointer-events: none; }

/* ── Alerts ── */
.alert {
    padding: 14px 18px; border-radius: var(--radius-md);
    font-size: 13.5px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}
.alert-success { background: rgba(46,204,113,0.12); border: 1px solid rgba(46,204,113,0.3); color: var(--accent-green); }
.alert-error { background: rgba(231,76,60,0.12); border: 1px solid rgba(231,76,60,0.3); color: #ff7675; }

/* ── Login page ── */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at center, #1b0f14 0%, var(--bg-primary) 70%);
    padding: 20px;
}

.login-card {
    width: 100%; max-width: 400px;
    background: var(--bg-card);
    border: 1px solid rgba(231,76,60,0.25);
    border-radius: var(--radius-lg);
    padding: 42px 36px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), 0 0 20px rgba(231,76,60,0.15);
}

.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--accent-red), #8e44ad);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-title); font-weight: 700; font-size: 26px; color: #fff;
    margin: 0 auto 16px;
    box-shadow: 0 0 25px rgba(231,76,60,0.4);
}
.login-logo-title { font-family: var(--font-title); font-size: 26px; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.login-logo-sub { font-size: 13px; color: var(--accent-crimson); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

/* ── Empty states ── */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 44px; margin-bottom: 12px; opacity: .5; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }

/* ── Mobile ── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 99; }
.sidebar-overlay.active { display: block; }

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); width: 270px; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; width: 100% !important; max-width: 100vw !important; }
    .topbar-burger { display: inline-flex !important; align-items: center; justify-content: center; }
    .page-body { padding: 16px !important; max-width: 100vw; overflow-x: hidden; }
}

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr !important; }
    .topbar { padding: 0 14px !important; gap: 8px !important; }
    .topbar-title { font-size: 16px !important; }
    .card-header { padding: 14px 16px !important; flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; }
    .card-body { padding: 14px !important; }
}

@media (max-width: 480px) {
    .table { min-width: 520px; }
    .btn { padding: 8px 14px; font-size: 12.5px; }
}
