body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

h2 {
    color: #333;
    margin-top: 0;
}

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

.back-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
}

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

/* User navigation */
.user-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.user-info {
    display: flex;
    align-items: center;
}

.username {
    font-weight: 600;
    margin-right: 10px;
}

.role-badge {
    background-color: #eee;
    color: #333;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
}

.role-admin {
    background-color: #2c3e50;
    color: white;
}

.role-scanner {
    background-color: #27ae60;
    color: white;
}

.role-viewer {
    background-color: #3498db;
    color: white;
}

.logout-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.logout-btn:hover {
    background-color: #c0392b;
}

/* Home page styles */
.nav-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.nav-item {
    flex: 1;
    min-width: 250px;
}

.button {
    display: block;
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    box-sizing: border-box;
}

.button:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.button.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.button.active {
    background-color: #2c3e50;
    color: white;
}

.button h2 {
    margin-top: 0;
    color: #2c3e50;
}

.button p {
    color: #7f8c8d;
    margin-bottom: 0;
}

/* Scanner styles */
#scanner-container {
    position: relative;
    max-width: 300px;
    width: 100%;
    margin: 20px auto;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#canvas {
    display: none;
}

/* Scanning area overlay */
.scan-area-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.scan-area-overlay::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border: 2px solid #00ff00;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scan-area-overlay::after {
    content: 'Position QR code here';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

#result-container {
    margin-top: 20px;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#result {
    padding: 10px;
    background-color: #eee;
    border-radius: 4px;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.alert {
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-weight: 500;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

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

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* History container styles */
.history-container {
    margin-top: 20px;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.scan-history {
    max-height: 300px;
    overflow-y: auto;
}

.scan-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.scan-item:last-child {
    border-bottom: none;
}

.scan-details {
    flex: 1;
}

.scan-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.scan-time, .season-info {
    font-size: 12px;
    color: #666;
}

.empty-history {
    color: #999;
    text-align: center;
    font-style: italic;
}

/* Form styles */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 15px;
}

.form-container, .login-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.login-container {
    max-width: 400px;
    margin: 0 auto;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

textarea {
    resize: vertical;
    font-family: inherit;
}

.submit-btn {
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 12px 20px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.submit-btn:hover {
    background-color: #1a252f;
}

.submit-btn:active {
    background-color: #1a252f;
    transform: scale(0.98);
}

/* Login help styles */
.login-help {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.login-help h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.login-help ul {
    padding-left: 20px;
    margin: 0;
}

.login-help li {
    margin-bottom: 5px;
}

/* Success page styles */
.registration-success {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
}

.success-icon {
    color: #2ecc71;
    font-size: 48px;
    margin-bottom: 20px;
}

.qr-code-container {
    margin: 30px 0;
}

.qr-code {
    max-width: 250px;
    height: auto;
    padding: 10px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.registration-details {
    text-align: left;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.registration-details h3 {
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.registration-details p {
    margin: 8px 0;
}

.student-id {
    font-family: monospace;
    background-color: #eee;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 5px;
}

/* Season styles */
.season-banner {
    background-color: #d1ecf1;
    color: #0c5460;
    border-radius: 6px;
    padding: 10px 15px;
    margin-bottom: 20px;
    text-align: center;
}

.season-banner.error {
    background-color: #f8d7da;
    color: #721c24;
}

.scanner-container.disabled {
    position: relative;
    opacity: 0.6;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    font-weight: bold;
    font-size: 18px;
    border-radius: 8px;
    z-index: 10;
}

/* Season management styles */
.seasons-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.season {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    padding: 15px;
    position: relative;
}

.season.current {
    border: 2px solid #27ae60;
}

.season h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.active-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #27ae60;
    color: white;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
}

.info-badge {
    background-color: #3498db;
    color: white;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
}

form[disabled] {
    pointer-events: none;
    opacity: 0.6;
}

form[disabled] input,
form[disabled] select,
form[disabled] textarea,
form[disabled] button {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

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

.stats-table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.error-message {
    color: #721c24;
    background-color: #f8d7da;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Public registration link styles */
.public-link-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e1e4e8;
}

.public-link-section label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
}

.link-copy-container {
    display: flex;
    gap: 8px;
}

.public-link-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 14px;
    background-color: #f6f8fa;
    cursor: text;
}

.copy-btn {
    padding: 8px 16px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.copy-btn:hover {
    background-color: #1d4ed8;
}

/* Track selector styles */
.track-selector {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.track-selector h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.track-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.track-btn {
    padding: 10px 20px;
    background-color: white;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    position: relative;
}

.track-btn:hover {
    border-color: #2563eb;
    background-color: #f0f9ff;
}

.track-btn.active {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
}

.track-btn.default {
    border-color: #10b981;
}

.track-distance {
    display: block;
    font-size: 14px;
    color: #6b7280;
    margin-top: 2px;
}

.track-btn.active .track-distance {
    color: #e0e7ff;
}

.default-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #10b981;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.selected-track {
    font-size: 18px;
    font-weight: 500;
}

#selected-track-name {
    color: #2563eb;
    font-weight: bold;
}