/* static/style.css */
body {
    font-family: 'Roboto', Arial, sans-serif;
    background-color: #f5f6f5;
    color: #333;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-color: #1e2127;
    color: #d1d4db;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-mode .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background-color: #2a2f3a;
    color: #fff;
    padding: 20px 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

body.dark-mode .sidebar {
    background-color: #252931;
}

.sidebar h2 {
    margin: 0 0 20px;
    font-size: 1.5em;
    color: #fff;
    padding: 0 20px 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar a {
    color: #d1d4db;
    text-decoration: none;
    display: block;
    padding: 10px 20px;
    border-radius: 4px;
    margin-bottom: 5px;
}

body.dark-mode .sidebar a {
    color: #a9b1bd;
}

.sidebar a:hover {
    color: #fff;
    background-color: #3c4655;
}

.sidebar a.active {
    background-color: #007bff;
    color: #fff;
}

/* Dark mode toggle */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d1d4db;
}

body.dark-mode .dark-mode-toggle {
    color: #a9b1bd;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3c4655;
    transition: 0.3s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #007bff;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Main content */
.main-content {
    margin-left: 250px;
    padding: 20px;
    min-height: 100vh;
}

/* Cards */
.card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

body.dark-mode .card {
    background-color: #2a2f3a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Forms */
form.standalone {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    margin: 20px auto;
}

body.dark-mode form.standalone {
    background-color: #2a2f3a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Modernized Welcome Email Form */
form.welcome-email-form {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 20px auto;
    transition: all 0.3s ease;
}

body.dark-mode form.welcome-email-form {
    background: linear-gradient(135deg, #2a2f3a 0%, #343a46 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

form.welcome-email-form .form-group {
    margin-bottom: 20px;
}

form.welcome-email-form label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

body.dark-mode form.welcome-email-form label {
    color: #d1d4db;
}

form.welcome-email-form .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d4db;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.dark-mode form.welcome-email-form .form-control {
    border-color: #4a5568;
    background-color: #3c4655;
    color: #d1d4db;
}

form.welcome-email-form .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

body.dark-mode form.welcome-email-form .form-control:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 5px rgba(26, 115, 232, 0.3);
}

form.welcome-email-form .form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    display: block;
}

body.dark-mode form.welcome-email-form .form-text {
    color: #a9b1bd;
}

form.welcome-email-form .btn-primary {
    background-color: #007bff;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 6px;
}

body.dark-mode form.welcome-email-form .btn-primary {
    background-color: #1a73e8;
}

form.welcome-email-form .btn-primary:hover {
    background-color: #0056b3;
}

body.dark-mode form.welcome-email-form .btn-primary:hover {
    background-color: #0d5bba;
}

/* Modernized Forgot Password Email Form */
form.forgot-email-form {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 20px auto;
    transition: all 0.3s ease;
}

body.dark-mode form.forgot-email-form {
    background: linear-gradient(135deg, #2a2f3a 0%, #343a46 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

form.forgot-email-form .form-group {
    margin-bottom: 20px;
}

form.forgot-email-form label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

body.dark-mode form.forgot-email-form label {
    color: #d1d4db;
}

form.forgot-email-form .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d4db;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.dark-mode form.forgot-email-form .form-control {
    border-color: #4a5568;
    background-color: #3c4655;
    color: #d1d4db;
}

form.forgot-email-form .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

body.dark-mode form.forgot-email-form .form-control:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 5px rgba(26, 115, 232, 0.3);
}

form.forgot-email-form .form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    display: block;
}

body.dark-mode form.forgot-email-form .form-text {
    color: #a9b1bd;
}

form.forgot-email-form .btn-primary {
    background-color: #007bff;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 6px;
}

body.dark-mode form.forgot-email-form .btn-primary {
    background-color: #1a73e8;
}

form.forgot-email-form .btn-primary:hover {
    background-color: #0056b3;
}

body.dark-mode form.forgot-email-form .btn-primary:hover {
    background-color: #0d5bba;
}

/* Ensure h3 headings match the form styling */
form.welcome-email-form h3,
form.forgot-email-form h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

body.dark-mode form.welcome-email-form h3,
body.dark-mode form.forgot-email-form h3 {
    color: #d1d4db;
}

/* General Form Inputs */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select {
    width: 100%;
    padding: 8px;
    margin: 5px 0;
    border: 1px solid #d1d4db;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
    background-color: #fff;
    color: #333;
}

body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="email"],
body.dark-mode input[type="number"],
body.dark-mode select {
    border-color: #4a5568;
    background-color: #3c4655;
    color: #d1d4db;
}

input[type="submit"] {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #fff;
    background-color: #007bff;
}

input[type="submit"]:hover {
    background-color: #0056b3;
}

/* Inline form layout for user form */
.inline-form {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

.btn.disabled {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.inline-form .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
    position: relative;
}

.inline-form .form-group:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: rgba(209, 212, 219, 0.3);
}

body.dark-mode .inline-form .form-group:not(:last-child)::after {
    background-color: rgba(74, 85, 104, 0.3);
}

.small-input {
    width: 100% !important;
    padding: 8.6px !important;
    font-size: 13px !important;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.small-btn {
    padding: 6px 12px !important;
    font-size: 13px !important;
    width: 100%;
}

.btn-small {
            padding: 2px 5px;
            font-size: 12px;
        }

.inline-form .checkbox-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.inline-form .form-check-label {
    margin-bottom: 0;
}

.inline-form label {
    margin-bottom: 5px;
    display: block;
}

.error {
    color: #721c24;
    font-size: 12px;
    display: block;
    margin-top: 2px;
}

body.dark-mode .error {
    color: #fed7d7;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

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

body.dark-mode th,
body.dark-mode td {
    border-bottom-color: #4a5568;
}

th {
    background-color: #f1f3f5;
    font-weight: 700;
}

body.dark-mode th {
    background-color: #3c4655;
}

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

body.dark-mode tr:hover {
    background-color: #343a46;
}

/* Edit form specific styles */
.edit-form {
    display: none;
}

.edit-user-card {
    background-color: #f9fafb;
    padding: 15px;
    border-radius: 4px;
}

body.dark-mode .edit-user-card {
    background-color: #343a46;
}

/* Base button styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #fff;
    text-align: center;
    display: inline-block;
    transition: background-color 0.2s;
    font-family: inherit; /* Ensure consistent font */
    line-height: normal; /* Fix line-height issues */
}

/* Primary button */
.btn-primary {
    background-color: #007bff;
}

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

/* Make sure input submits look like buttons */
input[type="submit"].btn {
    -webkit-appearance: none; /* Remove iOS styling */
    -moz-appearance: none;
    appearance: none;
}

body.dark-mode .btn-primary {
    background-color: #1a73e8;
    color: white;
}

body.dark-mode .btn-primary:hover {
    background-color: #0d5bba;
    color: white;
}

/* Specificity to override any other rules */
button.btn-primary,
input[type="submit"].btn-primary {
    background-color: #007bff;
}

button.btn-primary:hover,
input[type="submit"].btn-primary:hover {
    background-color: #0056b3;
}

.btn-view, .btn-edit {
    background-color: #007bff;
    color: #fff !important;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

.btn-view:hover, .btn-edit:hover {
    background-color: #0056b3;
    color: #fff !important;
    text-decoration: none !important;
}

body.dark-mode .btn-view, body.dark-mode .btn-edit {
    background-color: #1a73e8;
    color: #fff !important;
    text-decoration: none;
}

body.dark-mode .btn-view:hover, body.dark-mode .btn-edit:hover {
    background-color: #0d5bba;
    color: #fff !important;
    text-decoration: none !important;
}

.btn-danger {
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 13px !important;
}

.actions {
    display: flex;
    gap: 5px;
}

.delete-form {
    display: inline;
}

td.download-column, td.status-column {
    text-align: center;
}

.placeholder-icon {
    opacity: 0.5;
}

/* Links */
a {
    color: #007bff;
    text-decoration: none;
}

body.dark-mode a {
    color: #60a5fa;
}

a:hover {
    text-decoration: underline;
}

/* Flash messages */
.flash {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    text-align: center;
}

.flash.success {
    background-color: #d4edda;
    color: #155724;
}

body.dark-mode .flash.success {
    background-color: #2f855a;
    color: #c6f6d5;
}

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

body.dark-mode .flash.error {
    background-color: #9b2c2c;
    color: #fed7d7;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .main-content {
        margin-left: 0;
    }
    table {
        display: block;
        overflow-x: auto;
    }
    .inline-form {
        flex-direction: column;
        align-items: flex-start;
    }
    .small-input {
        width: 100% !important;
    }
    .small-btn {
        width: auto;
    }
    .inline-form .form-group:not(:last-child)::after {
        display: none;
    }
}

/* Top Bar Styles */
.top-bar {
    background-color: #f8f9fa; /* Light background */
    border-bottom: 1px solid #dee2e6;
    padding: 10px 20px;
    position: fixed;
    top: 0;
    left: 250px; /* Match the sidebar width */
    right: 0;
    z-index: 1000; /* Ensure it stays above other content */
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    height: 40px; /* Ensure consistent height for vertical centering */
}

.race-name, .settings-name {
    font-size: 1.5em; /* Slightly larger for prominence */
    font-weight: bold;
    color: #333;
}

.top-bar-links {
    display: flex;
    align-items: center; /* Vertically center the links */
    gap: 30px; /* Increase gap between links for better spacing */
}

.top-bar-link {
    color: #007bff;
    text-decoration: none;
    font-size: 1em;
    padding: 5px 10px; /* Add padding for better click area */
    border-radius: 4px; /* Slight rounding for hover effect */
    transition: background-color 0.2s, color 0.2s; /* Smooth transition for hover */
}

.top-bar-link:hover {
    background-color: #e9ecef; /* Light gray background on hover */
    color: #0056b3;
}

.top-bar-link.active {
    background-color: #007bff; /* Match sidebar active style */
    color: #fff; /* White text */
}

/* Dark mode adjustments */
body.dark-mode .top-bar {
    background-color: #343a40;
    border-bottom: 1px solid #495057;
}

body.dark-mode .race-name, body.dark-mode .settings-name {
    color: #f8f9fa;
}

body.dark-mode .top-bar-link {
    color: #66b0ff;
}

body.dark-mode .top-bar-link:hover {
    background-color: #495057; /* Darker gray background on hover */
    color: #99c9ff;
}

body.dark-mode .top-bar-link.active {
    background-color: #1a73e8; /* Slightly darker blue for dark mode */
    color: #fff;
}

/* Adjust main content to avoid overlap with the top bar */
.main-content {
    margin-top: 60px; /* Ensure space for the top bar */
}

.report-links {
    list-style: none;
    padding: 0;
}

.report-links li {
    margin: 10px 0;
}

.report-links a {
    color: #007bff;
    text-decoration: none;
    font-size: 1.1em;
}

.report-links a:hover {
    text-decoration: underline;
    color: #0056b3;
}

body.dark-mode .report-links a {
    color: #66b0ff;
}

body.dark-mode .report-links a:hover {
    color: #99c9ff;
}

.btn-danger {
    background-color: #e92b3e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 5px 10px;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

body.dark-mode .btn-danger {
    background-color: #ef4444;
    color: white;
}

body.dark-mode .btn-danger:hover {
    background-color: #dc2626;
}

/* Style for the delete button in the top bar */
.top-bar-links .delete-button {
    background-color: #e74c3c; /* Red background */
    color: white; /* White text */
    border: none; /* Remove default border */
    padding: 8px 16px; /* Match padding of other links */
    text-decoration: none; /* Remove underline */
    border-radius: 4px; /* Rounded corners */
    cursor: pointer; /* Pointer cursor on hover */
    transition: background-color 0.3s ease; /* Smooth transition for hover effect */
}

.top-bar-links .delete-button:hover {
    background-color: #c0392b; /* Darker red on hover */
}

body.dark-mode .top-bar-links .delete-button {
    background-color: #e74c3c; /* Red background */
    color: white; /* White text */
    border: none; /* Remove default border */
    padding: 8px 16px; /* Match padding of other links */
    text-decoration: none; /* Remove underline */
    border-radius: 4px; /* Rounded corners */
    cursor: pointer; /* Pointer cursor on hover */
    transition: background-color 0.3s ease; /* Smooth transition for hover effect */
}

body.dark-mode .top-bar-links .delete-button:hover {
    background-color: #c0392b; /* Darker red on hover */
    color: white;
}

/* Default btn-link styles (light mode, based on Bootstrap) */
.btn.btn-link {
    color: #0d6efd; /* Bootstrap primary color */
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    cursor: pointer;
  }
  
  /* Dark mode styles */
  @media (prefers-color-scheme: dark) {
    .btn.btn-link {
      color: #4dabf7; /* Lighter blue for dark mode, ensuring contrast */
      text-decoration: none;
    }
  
    .btn.btn-link:hover,
    .btn.btn-link:focus {
      color: #80bdff; /* Slightly brighter on hover/focus for feedback */
      text-decoration: underline; /* Subtle underline for interactivity */
    }
  
    .btn.btn-link:disabled,
    .btn.btn-link.disabled {
      color: #6c757d; /* Muted gray for disabled state */
      opacity: 0.65;
      cursor: not-allowed;
    }
  }
  
  /* Optional: If your app has a specific dark mode class (e.g., .dark-mode) */
  .dark-mode .btn.btn-link {
    color: #4dabf7;
    text-decoration: none;
  }
  
  .dark-mode .btn.btn-link:hover,
  .dark-mode .btn.btn-link:focus {
    color: #80bdff;
    text-decoration: underline;
  }
  
  .dark-mode .btn.btn-link:disabled,
  .dark-mode .btn.btn-link.disabled {
    color: #6c757d;
    opacity: 0.65;
  }

  .input-group .form-control.d-none {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}