/* ========== RESET & БАЗА ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #f5f7fa;
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 260px;
    background: #1e293b;
    color: white;
    min-height: 100vh;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar h2 {
    padding: 0 20px 20px;
    font-size: 18px;
    border-bottom: 1px solid #334155;
    margin-bottom: 20px;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li a {
    display: block;
    padding: 12px 20px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar ul li a:hover {
    background: #334155;
    color: white;
}

/* ========== MAIN CONTENT ========== */
.main {
    flex: 1;
    padding: 30px;
    max-width: calc(100% - 260px);
}

h1 {
    font-size: 24px;
    margin-bottom: 25px;
    color: #1e293b;
}

h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #1e293b;
}

/* ========== STATS GRID ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #2b96d6;
}

.stat-label {
    color: #64748b;
    margin-top: 8px;
}

/* ========== TABLES ========== */
.users-table, .stats-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-collapse: collapse;
    display: block;
    white-space: nowrap;
}

.users-table th, .users-table td,
.stats-table th, .stats-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.users-table th, .stats-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #1e293b;
}

.users-table tr:hover, .stats-table tr:hover {
    background: #f8fafc;
}

/* ========== FILTERS & FORMS ========== */
.filters, .search-form {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filters input, .filters select, .search-form input {
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.filters button, .search-form button {
    padding: 10px 20px;
    background: #2b96d6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.filters a, .search-form a {
    padding: 10px 20px;
    background: #64748b;
    color: white;
    border-radius: 8px;
    text-decoration: none;
}

/* ========== PAGINATION ========== */
.pagination {
    margin-top: 20px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination a {
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: #2b96d6;
}

.pagination a.active {
    background: #2b96d6;
    color: white;
    border-color: #2b96d6;
}

/* ========== SETTINGS SECTION ========== */
.settings-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-section label {
    display: block;
    margin: 15px 0 5px;
    font-weight: 500;
}

.settings-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
}

.settings-section input[type="file"] {
    margin: 10px 0;
}

.settings-section button {
    margin-top: 15px;
    padding: 10px 20px;
    background: #2b96d6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.message {
    background: #dcfce7;
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.note {
    margin-top: 10px;
    font-size: 12px;
    color: #64748b;
}

/* ========== STATS SECTION ========== */
.stats-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stats-section canvas {
    max-height: 300px;
    width: 100%;
}

/* ========== BACK LINK ========== */
.back-link-container {
    margin-top: 30px;
    text-align: center;
}

.back-link {
    display: inline-block;
    padding: 10px 20px;
    background: #64748b;
    color: white;
    border-radius: 8px;
    text-decoration: none;
}

.back-link:hover {
    background: #475569;
}

/* ========== LOGIN PAGE ========== */
.login-box {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 340px;
    text-align: center;
    margin: auto;
}

.login-box h1 {
    margin-bottom: 25px;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: #2b96d6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.login-box .error {
    color: #dc2626;
    margin-top: 15px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        min-height: auto;
        height: auto;
        position: relative;
    }
    .main {
        max-width: 100%;
        padding: 15px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .filters, .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    .users-table, .stats-table {
        font-size: 12px;
    }
    .users-table th, .users-table td,
    .stats-table th, .stats-table td {
        padding: 8px 10px;
    }
}