body {
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.6;
}

body:not(.login-page) {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.logout-link {
    display: inline-block;
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.3s;
}

.logout-link:hover {
    background: #c82333;
}

.change-password-link {
    display: inline-block;
    padding: 8px 16px;
    background: #5cb85c;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.3s;
    margin-right: 15px;
}

.change-password-link:hover {
    background: #4cae4c;
}

.admin-link {
    display: inline-block;
    padding: 8px 16px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.3s;
    margin-right: 15px;
}

.admin-link:hover {
    background: #0056b3;
}

h1 {
    color: #333;
    margin: 0;
}

h2 {
    color: #555;
    margin-top: 30px;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.chart-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
}

.chart-controls input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.chart-controls input[type="range"] {
    width: 150px;
    cursor: pointer;
}

.filter-alpha-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-alpha-control label {
    font-weight: 500;
}

#tauValue {
    font-weight: bold;
    color: #007bff;
    min-width: 35px;
}

#chart {
    margin-top: 10px;
    min-height: 400px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#output {
    margin-top: 20px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 4px;
    min-height: 100px;
}

button {
    padding: 10px 20px;
    margin-right: 10px;
    font-size: 16px;
    cursor: pointer;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
}

button:hover {
    background: #0056b3;
}

.button-group {
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #007bff;
    color: white;
}

tr:hover {
    background-color: #f5f5f5;
}

.editable {
    cursor: pointer;
    position: relative;
}

.editable:hover::after {
    content: '✎';
    position: absolute;
    right: 5px;
    color: #007bff;
}

.editable[contenteditable='true'] {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    outline: none;
}

#updateBtn {
    display: none;
    background: #28a745;
}

#updateBtn:hover {
    background: #218838;
}

#cancelBtn {
    display: none;
    background: #6c757d;
}

#cancelBtn:hover {
    background: #5a6268;
}

#deleteBtn {
    display: none;
    background: #dc3545;
}

#deleteBtn:hover {
    background: #c82333;
}

.status-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#insertForm {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: #e7f3ff;
    border: 1px solid #007bff;
    border-radius: 4px;
}

#insertForm label {
    display: inline-block;
    width: 120px;
    margin-top: 10px;
}

#insertForm input {
    padding: 8px;
    font-size: 14px;
    width: 300px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.form-row {
    margin: 10px 0;
}

#addBtn {
    background: #17a2b8;
}

#addBtn:hover {
    background: #138496;
}

/* Login page styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #fafafa;
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    border: 1px solid #ddd;
    width: 100%;
    max-width: 380px;
}

.login-box h1 {
    margin-top: 0;
    margin-bottom: 2rem;
    color: #333;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: #555;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
}

.login-button {
    width: 100%;
    padding: 0.75rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: system-ui, -apple-system, sans-serif;
}

.login-button:hover {
    background: #0056b3;
}

.login-button:active {
    background: #004494;
}

.error-message {
    color: #dc3545;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.success-message {
    color: #28a745;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.back-link {
    display: inline-block;
    width: 100%;
    text-align: center;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s;
    font-family: system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
}

.back-link:hover {
    background: #5a6268;
    text-decoration: none;
}

/* Admin page styles */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.users-table-container {
    margin: 20px 0;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.users-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

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

.admin-form {
    max-width: 500px;
    margin: 20px 0;
    padding: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-form .form-row {
    margin-bottom: 15px;
}

.admin-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.admin-form input[type="text"],
.admin-form input[type="password"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.admin-form input[type="checkbox"] {
    margin-right: 8px;
}

.admin-form button[type="submit"] {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.admin-form button[type="submit"]:hover {
    background: #0056b3;
}

.btn-small {
    padding: 6px 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-small:hover {
    background: #0056b3;
}

.btn-small.btn-success {
    background: #28a745;
}

.btn-small.btn-success:hover {
    background: #218838;
}

.btn-small.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-small.btn-warning:hover {
    background: #e0a800;
}

.status-message.success {
    color: #28a745;
    margin-top: 10px;
}

.status-message.error {
    color: #dc3545;
    margin-top: 10px;
}
