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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 2rem 0;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 400px;
    max-width: 90vw;
}

h1 {
    margin-bottom: 1.5rem;
}

h2 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    background: #007bff;
    color: white;
}

button:hover {
    background: #0056b3;
}

button.secondary {
    background: #6c757d;
}

button.secondary:hover {
    background: #545b62;
}

button.danger {
    background: #dc3545;
}

button.danger:hover {
    background: #c82333;
}

.error {
    color: #dc3545;
    margin-top: 0.5rem;
}

.success {
    color: #28a745;
    margin-top: 0.5rem;
}

.link {
    margin-top: 1rem;
    text-align: center;
}

.link a {
    color: #007bff;
    text-decoration: none;
}

.link a:hover {
    text-decoration: underline;
}

hr {
    margin: 1.5rem 0;
    border: none;
    border-top: 1px solid #eee;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

#user-info p {
    margin-bottom: 0.5rem;
}

h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* ===== Admin User Management Section ===== */

/* Wide card for admin view */
.card.wide {
    width: 700px;
}

/* Admin section */
#admin-section {
    margin-top: 0;
}

#admin-section h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* User table */
.user-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.user-table th {
    background: #f8f9fa;
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    vertical-align: middle;
}

.user-table tr:hover td {
    background: #f8f9fa;
}

/* Online status indicators */
.status-online {
    color: #28a745;
    font-weight: 600;
}

.status-online::before {
    content: "\25CF";
    margin-right: 0.35rem;
}

.status-offline {
    color: #6c757d;
}

.status-offline::before {
    content: "\25CF";
    margin-right: 0.35rem;
}

/* Small action buttons in table */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    color: white;
}

.btn-edit {
    background: #6c757d;
}

.btn-edit:hover {
    background: #545b62;
}

.btn-delete {
    background: #dc3545;
}

.btn-delete:hover {
    background: #c82333;
}

.table-actions {
    display: flex;
    gap: 0.35rem;
}

/* Admin create-user form */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 350px;
}

.admin-form select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
}

select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
}

/* Modal overlay for editing */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90vw;
    padding: 2rem;
}

.modal h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Responsive: small screens */
@media (max-width: 740px) {
    .card.wide {
        max-width: 90vw;
        width: 90vw;
    }

    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .user-table {
        min-width: 500px;
    }
}
