/* ===== ОБЩИЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", Arial, sans-serif;
}

:root {
    --blue: #0b2b5e;
    --green: #168344;
    --red: #d93434;
    --bg: #f1f5fa;
    --light: #edf3fa;
    --text: #14253d;
}

body {
    background: var(--bg);
    padding: 20px;
    color: var(--text);
}

.container {
    max-width: 1400px;
    margin: auto;
    background: white;
    padding: 35px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .08);
}

/* ===== HEADER ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 12px;
    flex-wrap: wrap;
}

.header h1 {
    font-size: 30px;
    color: var(--blue);
    display: flex;
    align-items: center;
    gap: 12px;
}

.header h1 i {
    color: #ffd700;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.back-btn {
    background: var(--light);
    color: var(--blue);
    border: none;
    padding: 10px 22px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    background: #dce6f2;
    transform: translateY(-2px);
}

/* ===== СТАТИСТИКА ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: #f7faff;
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    transition: 0.3s;
    border: 1px solid #e5edf6;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, .06);
}

.stat-card .icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.stat-card .icon.blue { color: var(--blue); }
.stat-card .icon.gold { color: #ffd700; }
.stat-card .icon.green { color: var(--green); }

.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: var(--blue);
}

.stat-card .label {
    color: #63778d;
    font-size: 13px;
    margin-top: 4px;
}

/* ===== ПАНЕЛИ ===== */
.panel {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid #e5edf6;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.panel h2 {
    font-size: 18px;
    color: var(--blue);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel h2 i {
    color: var(--blue);
}

/* ===== ПОИСК ===== */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid #e5edf6;
    border-radius: 30px;
    padding: 6px 16px 6px 20px;
    transition: 0.3s;
    min-width: 200px;
}

.search-box:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(11, 43, 94, 0.08);
}

.search-box i {
    color: #8a9bb0;
    font-size: 14px;
}

.search-box input {
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    outline: none;
    width: 100%;
    font-family: inherit;
    color: var(--text);
}

.search-box input::placeholder {
    color: #a8b8cc;
}

/* ===== ТАБЛИЦА ===== */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
    border-bottom: 2px solid #e5edf6;
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
}

table tr:hover td {
    background: #fafbfc;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #8a9bb0;
}

.no-results i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* ===== БЕЙДЖИ ===== */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge.super {
    background: #ffd700;
    color: var(--blue);
}

.badge.admin {
    background: var(--blue);
    color: white;
}

.badge.user {
    background: #e8ecf0;
    color: #555;
}

/* ===== КНОПКИ ===== */
.btn {
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
}

.btn-success {
    background: var(--green);
    color: white;
}

.btn-success:hover {
    background: #1a9e4f;
    transform: translateY(-1px);
}

.btn-warning {
    background: #f5a623;
    color: white;
}

.btn-warning:hover {
    background: #e0961f;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-danger:hover {
    background: #c62828;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 10px;
}

.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== ИСТОРИЯ ===== */
.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
    gap: 10px;
    flex-wrap: wrap;
}

.history-item .user {
    font-weight: 600;
    color: var(--blue);
}

.history-item .desc {
    color: var(--text);
    flex: 1;
}

.history-item .time {
    color: #8a9bb0;
    font-size: 12px;
    white-space: nowrap;
}

.history-type {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.history-type.login { background: #e8f5e9; color: #2e7d32; }
.history-type.logout { background: #fce4ec; color: #c62828; }
.history-type.create_ad { background: #e3f2fd; color: #0d47a1; }
.history-type.edit_ad { background: #fff3e0; color: #e65100; }
.history-type.delete_ad { background: #fbe9e7; color: #bf360c; }
.history-type.change_role { background: #f3e5f5; color: #4a148c; }
.history-type.delete_user { background: #ffebee; color: #b71c1c; }

.empty-state {
    text-align: center;
    padding: 40px;
    color: #8a9bb0;
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.loading-state {
    text-align: center;
    padding: 30px;
    color: #8a9bb0;
}

.loading-state i {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
    АДАПТАЦИЯ
    ============================================================ */

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 18px;
        border-radius: 18px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header h1 {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card .number {
        font-size: 24px;
    }

    .panel {
        padding: 16px;
        border-radius: 16px;
    }

    .panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-box {
        min-width: unset;
        width: 100%;
    }

    table th,
    table td {
        padding: 8px 10px;
        font-size: 13px;
    }

    .history-item {
        font-size: 13px;
        padding: 8px 12px;
    }

    .actions-cell {
        gap: 4px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 12px;
        border-radius: 14px;
    }

    .header h1 {
        font-size: 18px;
    }

    .back-btn {
        padding: 6px 14px;
        font-size: 12px;
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 14px;
        border-radius: 14px;
    }

    .stat-card .number {
        font-size: 20px;
    }

    .stat-card .label {
        font-size: 11px;
    }

    .stat-card .icon {
        font-size: 20px;
    }

    .panel {
        padding: 12px;
        border-radius: 14px;
    }

    .panel h2 {
        font-size: 15px;
    }

    table th,
    table td {
        padding: 6px 8px;
        font-size: 12px;
    }

    .btn {
        font-size: 10px;
        padding: 3px 8px;
    }

    .btn-sm {
        padding: 2px 6px;
        font-size: 9px;
    }

    .badge {
        font-size: 10px;
        padding: 2px 8px;
    }

    .history-item {
        font-size: 12px;
        padding: 6px 10px;
    }

    .history-type {
        font-size: 9px;
        padding: 1px 8px;
    }

    .history-item .time {
        font-size: 10px;
    }

    .actions-cell {
        gap: 3px;
    }
}
.history-type.edit_settings {
    background: #e8f0fa;
    color: #0b2b5e;
}
