/* Admin Pages Styles */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 40px 20px;
}

.admin-header {
    margin-bottom: 40px;
}

.admin-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.admin-header p {
    color: var(--text-secondary);
    font-size: 1.1em;
}

.add-user-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.add-user-button svg {
    width: 20px;
    height: 20px;
}

.add-user-button:hover {
    background: var(--accent-secondary);
}

.add-user-button:active {
    transform: translateY(1px);
}

.success-message {
    background: var(--comparison-above-bg);
    color: var(--comparison-above-text);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95em;
    border: 1px solid var(--comparison-above-text);
}

.error-message {
    background: var(--error-bg);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.warning-message {
    background: #fff3cd;
    color: #856404;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95em;
    border: 1px solid #ffc107;
}

.info-message {
    background: #d1ecf1;
    color: #0c5460;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95em;
    border: 1px solid #17a2b8;
}

/* Users Table */
.users-table-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 15px var(--card-shadow);
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: var(--hover-bg);
}

.users-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.users-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.users-table tbody tr:hover {
    background: var(--hover-bg);
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
}

.user-name a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.user-name a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.email-container {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.email {
    color: var(--text-secondary);
    font-size: 0.9em;
    transition: filter 0.3s ease;
}

.email-hidden {
    filter: blur(6px);
    user-select: none;
    pointer-events: none;
}

.email.email-visible {
    filter: blur(0);
    user-select: text;
}

.reveal-button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0;
    visibility: hidden;
}

.users-table tbody tr:hover .reveal-button {
    opacity: 1;
    visibility: visible;
}

.reveal-button svg {
    width: 14px;
    height: 14px;
}

.reveal-button:hover {
    background: var(--accent-secondary);
}

.reveal-button:active {
    transform: translateY(1px);
}

.no-auth {
    color: var(--text-tertiary);
    font-style: italic;
    font-size: 0.9em;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    text-transform: capitalize;
}

.role-badge.admin {
    background: #dc3545;
    color: white;
}

.role-badge.maintainer {
    background: #ffc107;
    color: #333;
}

.role-badge.painter {
    background: var(--accent-primary);
    color: white;
}

.role-badge.none {
    background: var(--input-bg);
    color: var(--text-tertiary);
}

.role-select {
    padding: 6px 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.9em;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.role-select:hover {
    border-color: var(--accent-primary);
}

.role-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.inline-form {
    margin: 0;
    display: inline;
}

.toggle-button {
    background: none;
    border: 2px solid var(--border-color);
    color: var(--text-tertiary);
    font-size: 1.5em;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-button:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.toggle-button.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.featured-status {
    font-size: 1.5em;
    color: var(--text-tertiary);
}

.action-button {
    padding: 8px 16px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.action-button:hover {
    background: var(--accent-secondary);
}

/* Modal - Native <dialog> element with fallback for legacy <div> */
dialog.modal {
    /* Reset dialog defaults */
    border: none;
    padding: 0;
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    background: transparent;
    /* Positioning handled by browser for dialog */
}

dialog.modal::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

/* Legacy div.modal fallback */
div.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-form {
    padding: 30px;
}

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

.modal-form .form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95em;
}

.modal-form .form-group input:not([type="checkbox"]):not([type="radio"]),
.modal-form .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.modal-form .form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

@media (prefers-color-scheme: dark) {
    .modal-form .form-group select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23b0b0b0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    }
}

.modal-form .form-group input:focus,
.modal-form .form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.modal-form .form-group input[readonly] {
    background: var(--hover-bg);
    cursor: not-allowed;
}

.form-hint {
    display: block;
    font-size: 0.85em;
    color: var(--text-tertiary);
    margin-top: 5px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

.cancel-button {
    padding: 12px 24px;
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-button:hover {
    background: var(--hover-bg);
    border-color: var(--text-primary);
}

.submit-button {
    padding: 12px 24px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.submit-button:hover {
    background: var(--accent-secondary);
}

/* Dark Mode Support for Flash Messages */
@media (prefers-color-scheme: dark) {
    .warning-message {
        background: #664d03;
        color: #ffecb5;
        border-color: #ffc107;
    }

    .info-message {
        background: #055160;
        color: #b6effb;
        border-color: #17a2b8;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-container {
        padding: 20px;
    }

    .admin-header h1 {
        font-size: 2em;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .add-user-button {
        width: 100%;
        justify-content: center;
    }

    .users-table-container {
        padding: 15px;
    }

    .users-table {
        font-size: 0.9em;
    }

    .users-table th,
    .users-table td {
        padding: 10px 8px;
    }

    .user-avatar-small {
        width: 30px;
        height: 30px;
    }

    .modal-content {
        width: 95%;
    }

    .modal-header,
    .modal-form {
        padding: 20px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .cancel-button,
    .submit-button {
        width: 100%;
    }
}

/* Logo Management Styles - Shared styles moved to decals.css */

.filter-form .form-group {
    margin: 0;
}

.filter-form select {
    min-width: 250px;
}

.logo-preview {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    display: inline-block;
}

.logo-preview img {
    max-width: 200px;
    max-height: 100px;
    display: block;
}

.logo-preview-placement {
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px;
    text-align: center;
    max-width: 300px;
}

.logo-preview-placement img {
    max-width: 100%;
    max-height: 100px;
    display: block;
    margin: 0 auto;
}

.logo-preview-small {
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 3px;
    display: inline-block;
}

.logo-preview-small img {
    max-width: 50px;
    max-height: 30px;
    display: block;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* Wide modal for logo upload */
.modal-form-wide .form-columns-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.modal-form-wide .form-column {
    min-width: 0; /* Prevent overflow */
}

/* Make the modal wider when using wide form */
.modal-form-wide {
    max-width: none;
}

#addLogoModal .modal-content {
    max-width: 1000px;
    width: 95vw;
}

/* Racing Series & Seasons */
.seasons-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.seasons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.season-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.season-card h4 {
    margin: 0 0 10px 0;
    font-size: 1.5em;
    color: var(--accent-primary);
}

.admin-header > div {
    display: flex;
    gap: 10px;
}

/* Responsive adjustments for logo modal */
@media (max-width: 900px) {
    .modal-form-wide .form-columns-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    #addLogoModal .modal-content {
        width: 90vw;
    }
}

/* ========================================
   FILTER BAR STYLES
   ======================================== */

/* Standard Filter Bar */

/* ========================================
   TEAM SPONSOR SEARCH MODAL
   ======================================== */

/* Wider modal for logo search */
.modal-wide {
    max-width: 900px;
}

/* Logo search grid */
.logo-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
    margin-top: 15px;
}

/* Logo cards in search results */
.logo-search-grid .logo-card {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.logo-search-grid .logo-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Selected logo card (keyboard navigation) */
.logo-search-grid .logo-card.selected {
    outline: 3px solid var(--accent-primary, #007bff);
    background-color: rgba(0, 123, 255, 0.05);
    border-color: var(--accent-primary, #007bff);
}

/* Ensure logo images in search grid are sized properly */
.logo-search-grid .logo-image {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-search-grid .logo-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Logo info text in search results */
.logo-search-grid .logo-info p {
    margin: 5px 0;
    font-size: 0.9em;
}

.logo-search-grid .logo-info strong {
    font-weight: 600;
    color: var(--text-primary);
}

.logo-search-grid .logo-variant {
    color: var(--text-secondary);
    font-size: 0.85em;
}













