body {
    font-family: Arial, sans-serif;
    background: #c2b980;
    margin: 0;
    padding: 2em;
    padding-top: 140px; /* Make room for larger logo */
    position: relative;
}

/* Logo section in upper left corner */
.logo-section {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
}

.logo-link {
    display: block;
    transition: transform 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo {
    height: 120px;
    width: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.logo:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Header text in center */
.header-text-section {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    text-align: center;
    max-width: 600px;
    padding: 0 20px;
}

.header-text {
    font-size: 22px;
    font-weight: bold;
    color: #2c3e50;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.85);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    line-height: 1.4;
}

.header-text big {
    font-size: 1.4em;
}

.header-text small {
    font-size: 0.75em;
}

@media (max-width: 768px) {
    .header-text-section {
        position: static;
        transform: none;
        margin: 140px auto 0;
        padding: 10px;
    }
    
    .header-text {
        font-size: 18px;
        white-space: normal;
    }
}

/* User section in upper right corner */
.user-section {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-greeting {
    color: #333;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.5em 1em;
    border-radius: 4px;
}

.auth-btn {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 0.7em 1.2em;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.auth-btn:hover {
    background: #34495e;
}

.login-btn {
    background: #27ae60;
}

.login-btn:hover {
    background: #2ecc71;
}

.logout-btn {
    background: #e74c3c;
}

.logout-btn:hover {
    background: #c0392b;
}

.signup-btn {
    background: #f39c12;
}

.signup-btn:hover {
    background: #e67e22;
}

.profile-btn {
    background: #9b59b6;
    color: white;
    text-decoration: none;
    display: inline-block;
}

.profile-btn:hover {
    background: #8e44ad;
}

.admin-btn {
    background: #e74c3c;
    color: white;
    text-decoration: none;
    display: inline-block;
}

.admin-btn:hover {
    background: #c0392b;
}

/* Admin Dropdown Menu */
.admin-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
    position: relative;
}

.admin-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    margin-top: 5px;
    z-index: 1001;
    overflow: hidden;
}

.admin-dropdown:hover .admin-dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid #eee;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f5f5f5;
    color: #e74c3c;
}

/* Class Group Switcher */
.group-switcher {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #4CAF50;
}

.group-switcher label {
    color: #333;
    font-weight: 600;
}

.group-select {
    transition: all 0.3s;
}

.group-select:hover {
    border-color: #45a049;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.group-select:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

/* Add Race Section */
.add-race-section {
    text-align: center;
    margin: 1em 0 2em 0;
    padding: 1em;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
}

.btn-add-race {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 1em 2em;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    transition: all 0.3s;
}

.btn-add-race:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.4);
}

button {
    background: none;
    border: none;
    box-shadow: none;
    color: inherit;
    padding: 0.5em 1em;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}

dialog {
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 2em;
    min-width: 300px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s, transform 0.3s;
}

dialog[open] {
    opacity: 1;
    transform: scale(1);
}

.dialog-close {
    float: right;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.3em 0.7em;
    cursor: pointer;
}

.dialog-title {
    font-weight: bold;
    margin-bottom: 1em;
    cursor: move;
    padding: 0.5em;
    background: #f0f0f0;
    margin: -2em -2em 1em -2em;
    border-radius: 8px 8px 0 0;
    user-select: none;
}

.dialog-title:hover {
    background: #e0e0e0;
}

/* Login form styles */
.form-group {
    margin-bottom: 1em;
}

.form-group label {
    display: block;
    margin-bottom: 0.3em;
    font-weight: bold;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.7em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 1.5em;
}

.btn-primary {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.7em 1.5em;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 0.7em 1.5em;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.message {
    margin-top: 1em;
    padding: 0.5em;
    border-radius: 4px;
}

.message .success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 0.5em;
    border-radius: 4px;
}

.message .error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 0.5em;
    border-radius: 4px;
}

/* Form footer and hints */
.form-footer {
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid #eee;
    text-align: center;
}

.form-footer p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

.form-footer a {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
}

.form-footer a:hover {
    text-decoration: underline;
}

.form-hint {
    display: block;
    color: #666;
    font-size: 0.8em;
    margin-top: 0.2em;
}

/* Profile page styles */
.profile-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 2em;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.profile-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 2em;
}

.tab-button {
    background: none;
    border: none;
    padding: 1em 2em;
    cursor: pointer;
    font-size: 1em;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-button:hover {
    color: #3498db;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.profile-form {
    max-width: 600px;
}

.form-row {
    display: flex;
    gap: 1em;
}

.form-row .form-group {
    flex: 1;
}

.security-info {
    background: #f8f9fa;
    padding: 1.5em;
    border-radius: 4px;
    margin-top: 2em;
}

.security-info h3 {
    margin-top: 0;
    color: #333;
}

.verified {
    color: #27ae60;
    font-weight: bold;
}

.unverified {
    color: #e74c3c;
    font-weight: bold;
}

.btn-link {
    background: none;
    border: none;
    color: #3498db;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9em;
    padding: 0;
    margin-left: 0.5em;
}

.btn-link:hover {
    color: #2980b9;
}

/* Settings tab styles */
.form-description {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 1.5em;
    line-height: 1.4;
}

.class-preferences {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.5em;
    margin: 1.5em 0;
    padding: 1em;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.class-option {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5em;
    border-radius: 4px;
    transition: background 0.2s;
    width: 100%;
}

.checkbox-label:hover {
    background: rgba(52, 152, 219, 0.1);
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    margin-right: 0.7em;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.class-option input[type="checkbox"] {
    display: none;
}

.class-option input[type="checkbox"]:checked + .checkbox-custom {
    background: #3498db;
    border-color: #3498db;
}

.class-option input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 2px;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.class-name {
    font-weight: 500;
    color: #333;
    line-height: 1.3;
}

/* Category-based class preferences */
.class-preferences-by-category {
    margin: 1.5em 0;
}

.category-section {
    margin-bottom: 1.5em;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-header {
    color: white;
    padding: 1em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
    position: relative;
}

.category-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
}

.category-header > * {
    position: relative;
    z-index: 1;
}

.category-icon {
    font-size: 1.2em;
    margin-right: 0.5em;
}

.category-name {
    flex: 1;
}

.category-actions {
    display: flex;
    gap: 0.5em;
}

.btn-small {
    padding: 0.3em 0.8em;
    font-size: 0.8em;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.category-classes {
    padding: 1em;
    background: #f8f9fa;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.5em;
}

.settings-info {
    background: #e8f5e8;
    padding: 1.5em;
    border-radius: 4px;
    margin-top: 2em;
    border-left: 4px solid #27ae60;
}

.settings-info h3 {
    margin-top: 0;
    color: #2c3e50;
}

.settings-info ul {
    margin: 1em 0;
    padding-left: 1.5em;
}

.settings-info li {
    margin-bottom: 0.5em;
    line-height: 1.4;
}

/* Add Race Form Styles */
.form-group select {
    width: 100%;
    padding: 0.7em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    background: white;
}

.form-group textarea {
    width: 100%;
    padding: 0.7em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.form-info {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 1em;
    margin: 1em 0;
}

.form-info p {
    margin: 0;
    color: #0c5460;
}

/* Make add race dialog wider */
#addRaceDialog {
    min-width: 600px;
    max-width: 90vw;
}

@media (max-width: 768px) {
    #addRaceDialog {
        min-width: 90vw;
    }
    
    .form-row {
        flex-direction: column;
    }
}

/* Enhanced Race Dialog Styles */
.race-button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 0.7em 1.2em;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    text-decoration: none;
    display: inline-block;
    position: relative;
}

.race-button:hover {
    background: linear-gradient(135deg, #2980b9, #1f4e79);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

/* Enhanced tooltip styling for race buttons using data-tooltip */
.race-button[data-tooltip] {
    position: relative;
}

.race-button[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.8em 1em;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: normal;
    white-space: pre-line;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    text-align: left;
    line-height: 1.4;
    animation: tooltipFadeIn 0.2s ease-out;
    pointer-events: none; /* Prevent tooltip from interfering with mouse events */
}

.race-button[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 1001;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.race-dialog {
    min-width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.race-dialog-content {
    line-height: 1.3;
}

.race-status {
    display: inline-block;
    padding: 0.4em 0.8em;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 1.5em;
    letter-spacing: 0.5px;
}

.race-status.approved {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.race-status.pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.race-info-section {
    margin-bottom: 1.5em;
}

.race-info-section h3 {
    margin: 0 0 0.7em 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.3em;
    font-size: 1.2em;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.4em;
    margin-bottom: 0.5em;
}

.info-item {
    padding: 0.3em 0;
    line-height: 1.2;
}

.info-item strong {
    color: #2c3e50;
    margin-right: 0.5em;
}

.info-item.description {
    grid-column: 1 / -1;
    background: #f8f9fa;
    padding: 1em;
    border-radius: 6px;
    border-left: 4px solid #3498db;
    margin-top: 1em;
}

.race-links-section {
    margin-bottom: 1.5em;
}

.race-links-section h3 {
    margin: 0 0 0.7em 0;
    color: #2c3e50;
    border-bottom: 2px solid #27ae60;
    padding-bottom: 0.3em;
    font-size: 1.2em;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.8em;
}

.race-link {
    display: block;
    padding: 0.8em 1em;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.race-link:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
    color: white;
}

.race-admin-section {
    margin-bottom: 1.5em;
    padding: 1.2em;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.race-admin-section h3 {
    margin: 0 0 0.7em 0;
    color: #e74c3c;
    border-bottom: 2px solid #e74c3c;
    padding-bottom: 0.3em;
    font-size: 1.2em;
}

.admin-actions {
    display: flex;
    gap: 0.8em;
    flex-wrap: wrap;
    margin-top: 1em;
}

.btn-admin {
    padding: 0.6em 1.2em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-admin.edit {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.btn-admin.edit:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    transform: translateY(-1px);
}

.btn-admin.approve {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.btn-admin.approve:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-1px);
}

.btn-admin.delete {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-admin.delete:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
}

/* User actions (propose change button) */
.user-actions {
    margin-top: 1.5em;
    padding-top: 1.5em;
    border-top: 1px solid #eee;
}

.btn-propose {
    padding: 0.7em 1.5em;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    font-size: 1em;
}

.btn-propose:hover {
    background: linear-gradient(135deg, #2980b9, #1f6391);
    transform: translateY(-1px);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1em;
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 1px solid #eee;
}

/* Responsive design for race dialogs */
@media (max-width: 768px) {
    body {
        padding: 1em;
        padding-top: 110px;
    }
    
    .logo {
        height: 90px;
    }
    
    .race-dialog {
        min-width: 90vw;
        max-height: 90vh;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .links-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-actions {
        flex-direction: column;
    }
    
    .admin-actions .btn-admin {
        text-align: center;
    }
}