body {
    font-family: Arial, sans-serif;
    background: #f2f2f2;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
}

input, select {
    display: block;
    width: 100%;
    padding: 8px;
    margin: 6px 0 12px;
    font-size: 14px;
}

button {
    padding: 8px 16px;
    margin: 4px 4px 4px 0;
    font-size: 14px;
    cursor: pointer;
}

button.danger {
    background: #c0392b;
    color: white;
}

button.secondary {
    background: #bdc3c7;
}

.hidden {
    display: none;
}

pre {
    background: #333;
    color: #0f0;
    padding: 15px;
    border-radius: 6px;
    min-height: 120px;
    font-size: 12px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layout {
    display: flex;
    gap: 20px;
    margin-top: 0px;
}

.left {
    flex: 2;
}

.right {
    flex: 1;
    border-left: 1px solid #ddd;
    padding-left: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

th, td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    text-align: left;
}

th {
    background: #f0f0f0;
}

.toast {
    position: fixed;
    top: 20px;
    right: -300px;
    background: #333;
    color: #fff;
    padding: 12px 18px;
    border-radius: 6px;
    opacity: 0;
    transition: all .3s ease;
    z-index: 9999;
}

.toast.show {
    right: 20px;
    opacity: 1;
}

.toast.success { background: #27ae60; }
.toast.error { background: #c0392b; }
.toast.info { background: #2980b9; }

input, select {
    border: 1px solid #ccc;
    border-radius: 4px;
}

input:focus, select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 4px rgba(52,152,219,0.5);
}

button {
    border: none;
    border-radius: 4px;
    background: #3498db;
    color: white;
}

button:hover {
    background: #2980b9;
}

button.danger {
    background: #e74c3c;
}

button.danger:hover {
    background: #c0392b;
}

table tr:hover {
    background: #f9f9f9;
}

#pagination button.active {
    background: #2ecc71;
}
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 6px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}
#userModal .modal-content {
    min-width: 350px;
    max-width: 450px;
}
#userModal label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
}
#userModal input, #userModal select {
    width: 100%;
    padding: 6px;
    margin-top: 4px;
}
.role-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

.role-admin {
    background-color: #d9534f;
}

.role-user {
    background-color: #0275d8;
}

.table-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
}

.table-btn.edit {
    color: #0275d8;
}

.table-btn.delete {
    color: #d9534f;
}

#usersTable tbody tr:hover {
    background-color: #f5f5f5;
}

#usersTable td, #usersTable th {
    padding: 4px 8px;
    line-height: 1.2;
    font-size: 14px;
    text-align: center;
}

#usersTable th {
    background-color: #f0f0f0;
    cursor: pointer;
}

#usersTable td.left {
    text-align: left;
}

#usersTable tbody tr {
    height: 28px;       /* фіксована мінімальна висота */
}

.sort-arrow {
    margin-left: 6px;
    font-size: 12px;
    opacity: 0.6;
}

#usersTopBar, #searchTopBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0px 0;
    padding: 6px 0;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

#usersTopBar > div {
    display: flex;
    align-items: center;
    gap: 6px;
}

#searchTopBar > div {
    display: flex;
    align-items: center;
    gap: 6px;
}

#usersCount {
    font-weight: bold;
}

/* Залишаємо заголовки таблиці видимими при прокрутці*/
#usersTable thead th {
    position: sticky;
    top: 0;
    background: #f0f0f0;
    z-index: 5;
    padding: 6px 10px;
    border-bottom: 2px solid #ccc;
}

#usersTableWrapper {
    max-height: 600px;
    overflow-y: auto;
}

#usersTable thead.sticky-shadow th {
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Підсвічування тексту пошуку */
.highlight {
    background-color: yellow;
    padding: 0 2px;
    border-radius: 2px;
}

.input-error {
    border: 1px solid #d9534f !important;
    background-color: #ffe6e6;
}

.error-text {
    color: #d9534f;
    font-size: 12px;
    margin-top: 4px;
}

.checking-text {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.input-success {
    border: 1px solid #28a745 !important;
    background-color: #e6ffe6;
}