/* Sidebar Styles */

/* Prevent scrollbar flash and layout shifts */
html {
    overflow-x: hidden;
    /* Only show scrollbar when content overflows */
    overflow-y: auto;
    margin: 0;
    padding: 0;
}

body {
    overflow-x: hidden;
    /* Only show scrollbar when content overflows */
    overflow-y: auto;
    position: relative;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Disable page scrolling when sidebar is open */
body.sidebar-open {
    overflow: hidden;
}

.sidebar-container {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 50px;
    left: 0;
    width: 280px;
    height: calc(100vh - 50px);
    background: #f8f9fa;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1001;
    /* Isolate scrolling to sidebar only */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    /* Flexbox to ensure full height coverage */
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Pretty scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 4px;
    margin: 4px 0;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

/* Note: :hover pseudo-class is not supported on scrollbar pseudo-elements in some browsers */

/* Firefox scrollbar */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: #667eea var(--scrollbar-track);
}

/* Theme scrollbar */
body.theme .sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.theme .sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #818cf8 0%, #a78bfa 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Note: :hover pseudo-class is not supported on scrollbar pseudo-elements in some browsers */

body.theme .sidebar {
    scrollbar-color: #818cf8 rgba(255, 255, 255, 0.05);
    background: #1a202c;
}

.sidebar.open {
    transform: translateX(0);
}

/* Sidebar toggle is hidden via JavaScript when sidebar is open */

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: 0.75rem;
}

.sidebar-theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.05);
}

body.theme .sidebar-theme-toggle {
    border-color: rgba(107, 114, 128, 0.5);
}

body.theme .sidebar-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-header-clear {
    background: transparent;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.sidebar-header-clear:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    transform: scale(1.05);
}

.sidebar-header-clear:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

body.theme .sidebar-header-clear {
    border-color: rgba(107, 114, 128, 0.5);
}

body.theme .sidebar-header-clear:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.sidebar-close-btn {
    background: transparent;
    border: 1px solid var(--border-color, #e2e8f0);
    font-size: 1.2rem;
    cursor: pointer;
    color: #dc2626;
    padding: 0;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    text-align: center;
    line-height: 1;
}

.sidebar-close-btn:hover {
    background-color: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
    transform: scale(1.05);
}

.sidebar-close-btn:focus {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

body.theme .sidebar-close-btn {
    border-color: rgba(107, 114, 128, 0.5);
    color: #dc2626 !important;
}

body.theme .sidebar-close-btn:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #b91c1c !important;
}

.sidebar-content {
    padding: 20px;
    /* No background - inherit from parent sidebar */
    flex: 1; /* Take remaining space */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 15px;
    letter-spacing: 0.5px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 50px;
    left: 20px;
    background: var(--primary-gradient);
    color: var(--text-white);
    border: none;
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-toggle:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.sidebar-toggle:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

.sidebar-toggle:focus {
    outline: none;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3), 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
    stroke: white;
}

.sidebar-toggle:hover svg {
    transform: rotate(-180deg);
}

/* Responsive design for sidebar toggle */
@media (max-width: 1024px) {
    .sidebar-toggle {
        width: 52px;
        height: 52px;
        padding: 0;
        top: 45px;
        left: 16px;
        border-radius: 14px;
        box-shadow: 0 6px 25px rgba(102, 126, 234, 0.35);
    }
    
    .sidebar-toggle svg {
        width: 22px;
        height: 22px;
    }
    
    .sidebar {
        top: 45px;
        height: calc(100vh - 45px);
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        width: 56px;
        height: 56px;
        padding: 0;
        top: 40px;
        left: 12px;
        border-radius: 16px;
        box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
    }
    
    .sidebar-toggle svg {
        width: 24px;
        height: 24px;
    }
    
    .sidebar-toggle:hover {
        transform: translateY(-2px) scale(1.03);
    }
    
    .sidebar {
        top: 40px;
        height: calc(100vh - 40px);
    }
}

@media (max-width: 480px) {
    .sidebar-toggle {
        width: 48px;
        height: 48px;
        padding: 0;
        top: 35px;
        left: 10px;
        border-radius: 14px;
    }
    
    .sidebar-toggle svg {
        width: 20px;
        height: 20px;
    }
    
    .sidebar {
        top: 35px;
        height: calc(100vh - 35px);
    }
}

/* Theme enhancements */
body.theme .sidebar-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

body.theme .sidebar-toggle:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

/* Responsive adjustments */
@media (min-width: 1024px) {
    /* On larger screens, sidebar overlays content without shifting */
    /* Keep overlay visible for click-to-close functionality */
}

@media (max-width: 1023px) {
    /* On smaller screens, sidebar overlays content */
    .sidebar {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    }
}

/* Theme adjustments */
body.theme .sidebar {
    background: #1a202c;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

body.theme .sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}

/* Sidebar content styles for moved elements */
.sidebar .date-filter-section {
    margin: 0;
    padding: 0;
}

.sidebar .date-filter-section h3 {
    display: none;
}

.sidebar .date-filter-controls {
    flex-direction: column;
    gap: 10px;
    display: flex;
}

.sidebar .filter-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    background: var(--button-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    text-align: center;
    line-height: 1.2;
}

.sidebar .filter-btn:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.sidebar .filter-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.sidebar .filter-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sidebar .action-buttons {
    flex-direction: column;
    gap: 10px;
    margin: 0;
    display: flex;
}

/* Add spacing between action button groups */
.sidebar-action-buttons-group + .action-buttons {
    margin-top: 10px;
}

.sidebar .action-buttons button {
    width: 100%;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 10px 16px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar .action-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Export button */
.sidebar .action-buttons button[onclick*="exportData"] {
    background: #48BB78;
    color: black !important;
    border-color: #38a169;
}

.sidebar .action-buttons button[onclick*="exportData"]:hover {
    background: #38a169;
    color: black !important;
}

/* Import button */
.sidebar .action-buttons button[onclick*="importData"] {
    background: #38B2AC;
    color: black !important;
    border-color: #319795;
}

.sidebar .action-buttons button[onclick*="importData"]:hover {
    background: #319795;
    color: black !important;
}

/* Backup button */
.sidebar .action-buttons button[onclick*="toggleBackupMenu"] {
    background: #4299E1;
    color: black !important;
    border-color: #3182ce;
}

.sidebar .action-buttons button[onclick*="toggleBackupMenu"]:hover {
    background: #3182ce;
    color: black !important;
}

/* Restore button */
.sidebar .action-buttons button[onclick*="restoreFromBackup"] {
    background: #f59e0b;
    color: black !important;
    border-color: #d97706;
}

.sidebar .action-buttons button[onclick*="restoreFromBackup"]:hover {
    background: #d97706;
    color: black !important;
}

.sidebar .custom-date-range {
    margin-top: 10px;
    padding: 15px;
    background: var(--hover-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.sidebar .custom-date-range input {
    width: 100%;
    margin-bottom: 4px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f5f6f7;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.sidebar .custom-date-range span {
    display: block;
    text-align: center;
    margin: 4px 0;
    color: white !important;
    font-size: 0.85rem;
}

.sidebar .custom-date-range button {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary-gradient);
    color: white !important;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.sidebar .custom-date-range button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Custom Date Error Message in Sidebar */
.sidebar #custom-date-error {
    margin-top: 8px;
    width: 100%;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animations */
@keyframes sidebarSlideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes sidebarSlideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

/* Accessibility */
.sidebar:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}


/* Sidebar Game Date Styles */
.sidebar-game-date {
    width: 100%;
}

/* GAME DATE Button - styled to match ACTIONS buttons */
.sidebar-date-btn-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 10px 16px;
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(147, 51, 234, 0.3);
    position: relative;
    overflow: hidden;
    min-height: 44px;
}

.sidebar-date-btn-container .date-text {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    line-height: 1;
    letter-spacing: 0.025em;
    position: relative;
    z-index: 1;
    flex: 1;
}

/* Date icon wrapper - simplified for ACTIONS button style */
.sidebar-date-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* Hidden date input - spans entire button */
.sidebar-date-input-hidden {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
    z-index: 2;
}

/* Hide the native calendar icon */
.sidebar-date-input-hidden::-webkit-calendar-picker-indicator {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

/* Calendar icon - styled like ACTIONS button icons */
.sidebar-date-icon-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    height: 100%;
    width: auto;
}

/* Button hover/active states - matching ACTIONS pattern */
.sidebar-date-btn-container:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(147, 51, 234, 0.4);
}

.sidebar-date-btn-container:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(147, 51, 234, 0.3);
}

.sidebar-date-icon-btn .date-icon {
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    z-index: 1;
    margin: 0;
    vertical-align: middle;
}

/* Firefox-specific cursor fix for calendar icon */
@-moz-document url-prefix() {
    .sidebar-date-icon-btn,
    .sidebar-date-icon-btn * {
        cursor: pointer !important;
    }
}

/* Today button */

.sidebar-date-today-btn {
    width: 100%;
    margin: 0.75rem 0 0 0;
    padding: 10px 16px;
    background: #10b981;
    color: black !important;
    border: 1px solid #059669;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    line-height: 1;
    letter-spacing: 0.025em;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.sidebar-date-today-btn:hover {
    background: #059669;
    color: black !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.sidebar-date-today-btn:active {
    transform: translateY(0);
}

/* Theme support for Set to Today button */
body.theme .sidebar-date-today-btn {
    background: #34d399;
    color: black !important;
    border-color: #10b981;
    box-shadow: 0 2px 4px rgba(52, 211, 153, 0.2);
}

body.theme .sidebar-date-today-btn:hover {
    background: #10b981;
    color: black !important;
    box-shadow: 0 4px 8px rgba(52, 211, 153, 0.3);
}

/* Theme support for GAME DATE button */
body.theme .sidebar-date-btn-container {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    box-shadow: 0 2px 4px rgba(167, 139, 250, 0.3);
}

body.theme .sidebar-date-btn-container:hover {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 4px 8px rgba(167, 139, 250, 0.4);
}

/* Theme support */
body.theme .sidebar-date-input-hidden {
    color-scheme: dark;
}

/* Ensure calendar picker works with theme */
body.theme .sidebar-date-input-hidden::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Sidebar Add Game Button Styles */
.sidebar-add-game-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 10px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: black !important;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
    position: relative;
    overflow: hidden;
    margin-bottom: 10px;
}

.sidebar-add-game-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.sidebar-add-game-btn:hover::before {
    width: 300px;
    height: 300px;
}

.sidebar-add-game-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.sidebar-add-game-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.sidebar-add-game-btn .add-icon {
    font-size: 1rem;
    position: relative;
    z-index: 1;
}

.sidebar-add-game-btn .add-text {
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

/* Disabled state */
.sidebar-add-game-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

.sidebar-add-game-btn:disabled:hover {
    transform: none;
    background: #9ca3af;
}

/* Theme support */
body.theme .sidebar-add-game-btn {
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

body.theme .sidebar-add-game-btn:hover {
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

/* Sidebar Player Settings Button */
.sidebar-player-settings-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3);
}

.sidebar-player-settings-btn:hover {
    background: linear-gradient(135deg, #db2777 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

.sidebar-player-settings-btn:active {
    transform: translateY(0);
}

.sidebar-player-settings-btn.active {
    background: linear-gradient(135deg, #be185d 0%, #6d28d9 100%);
}

.settings-icon {
    font-size: 1.2rem;
}

.settings-text {
    font-size: 0.9rem;
}

/* Theme support */
body.theme .sidebar-player-settings-btn {
    background: linear-gradient(135deg, #f472b6 0%, #a78bfa 100%);
    box-shadow: 0 2px 8px rgba(244, 114, 182, 0.3);
}

body.theme .sidebar-player-settings-btn:hover {
    background: linear-gradient(135deg, #ec4899 0%, #9333ea 100%);
    box-shadow: 0 4px 12px rgba(244, 114, 182, 0.4);
}

body.theme .sidebar-player-settings-btn.active {
    background: linear-gradient(135deg, #db2777 0%, #7c3aed 100%);
}

/* Player Settings Container Animation */
.sidebar-player-settings {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-top: 1rem;
}

.sidebar-player-settings.open {
    opacity: 1;
    transform: translateY(0);
}

/* Sidebar Action Buttons Group */
.sidebar-action-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.sidebar-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 10px 16px;
    background: transparent;
    color: var(--text-primary, #2d3748);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.sidebar-action-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Undo button styling */
.sidebar-action-btn.undo-btn {
    background: #3b82f6;
    color: black !important;
    border-color: #2563eb;
}

.sidebar-action-btn.undo-btn:hover:not(:disabled) {
    background: #2563eb;
    color: black !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Redo button styling */
.sidebar-action-btn.redo-btn {
    background: #10b981;
    color: black !important;
    border-color: #059669;
}

.sidebar-action-btn.redo-btn:hover:not(:disabled) {
    background: #059669;
    color: black !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Restore button styling */
.sidebar-action-btn.restore-btn {
    background: #f59e0b;
    color: black !important;
    border-color: #d97706;
}

.sidebar-action-btn.restore-btn:hover {
    background: #d97706;
    color: black !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-action-btn .action-icon {
    font-size: 1rem;
    width: 1.5rem;
    min-width: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-align: center;
}

.sidebar-action-btn .action-text {
    font-size: 0.9rem;
}

/* Theme support for action buttons */
body.theme .sidebar-action-btn {
    background: transparent;
    color: #e2e8f0;
    border-color: rgba(107, 114, 128, 0.5);
}

body.theme .sidebar-action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(107, 114, 128, 0.8);
}

body.theme .sidebar-action-btn.undo-btn {
    background: #60a5fa;
    color: black !important;
    border-color: #3b82f6;
}

body.theme .sidebar-action-btn.undo-btn:hover:not(:disabled) {
    background: #3b82f6;
    color: black !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.theme .sidebar-action-btn.redo-btn {
    background: #34d399;
    color: black !important;
    border-color: #10b981;
}

body.theme .sidebar-action-btn.redo-btn:hover:not(:disabled) {
    background: #10b981;
    color: black !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.theme .sidebar-action-btn.restore-btn {
    background: #fbbf24;
    color: black !important;
    border-color: #f59e0b;
}

body.theme .sidebar-action-btn.restore-btn:hover {
    background: #f59e0b;
    color: black !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Special class to hide Set to Today button when date is today */
.sidebar-date-today-btn.hidden {
    display: none !important;
}

/* Custom Date Range Styling - Copied from Mario Kart */
.sidebar .custom-date-range {
    margin-top: 10px;
    padding: 15px;
    background: var(--hover-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar .custom-date-range input {
    width: 100%;
    margin-bottom: 4px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f5f6f7;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.sidebar .custom-date-range span {
    display: block;
    text-align: center;
    margin: 4px 0;
    color: var(--text-primary) !important;
    font-size: 0.85rem;
}

.sidebar .custom-date-range button {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary-gradient);
    color: white !important;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.sidebar .custom-date-range button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Theme for custom date range */
body.theme .sidebar .custom-date-range {
    background: rgba(45, 55, 72, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

body.theme .sidebar .custom-date-range input {
    background: #374151;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f7fafc;
}

body.theme .sidebar .custom-date-range span {
    color: #e2e8f0 !important;
}

/* Theme support for export/import/backup buttons */
body.theme .sidebar .action-buttons button[onclick*="exportData"] {
    background: #68D391;
    color: black !important;
    border-color: #48BB78;
}

body.theme .sidebar .action-buttons button[onclick*="exportData"]:hover {
    background: #48BB78;
    color: black !important;
}

body.theme .sidebar .action-buttons button[onclick*="importData"] {
    background: #4FD1C5;
    color: black !important;
    border-color: #38B2AC;
}

body.theme .sidebar .action-buttons button[onclick*="importData"]:hover {
    background: #38B2AC;
    color: black !important;
}

body.theme .sidebar .action-buttons button[onclick*="toggleBackupMenu"] {
    background: #63B3ED;
    color: black !important;
    border-color: #4299E1;
}

body.theme .sidebar .action-buttons button[onclick*="toggleBackupMenu"]:hover {
    background: #4299E1;
    color: black !important;
}

body.theme .sidebar .action-buttons button[onclick*="restoreFromBackup"] {
    background: #fbbf24;
    color: black !important;
    border-color: #f59e0b;
}

body.theme .sidebar .action-buttons button[onclick*="restoreFromBackup"]:hover {
    background: #f59e0b;
    color: black !important;
}

/* Universal sidebar button styling - ensure all Control Panel buttons have white text and are centered */
.sidebar-add-game-btn,
.sidebar-player-settings-btn,
.sidebar-action-btn,
.sidebar .action-buttons button,
.sidebar .filter-btn,
.sidebar .filter-btn.active,
.sidebar-submit-race {
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1.2 !important;
}

/* Ensure hover and active states maintain white text and centering */
.sidebar-add-game-btn:hover,
.sidebar-player-settings-btn:hover,
.sidebar-action-btn:hover:not(:disabled),
.sidebar .action-buttons button:hover,
.sidebar .filter-btn:hover,
.sidebar .filter-btn.active:hover,
.sidebar-submit-race:hover {
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

/* Removed conflicting white text overrides for undo/redo/restore buttons 
   to allow black text as requested by user */

/* Specific styling for Date Filter buttons to ensure proper contrast with white text */
.sidebar .filter-btn:not(.active) {
    background: #6b7280 !important;
    color: white !important;
    border-color: #4b5563 !important;
}

.sidebar .filter-btn:not(.active):hover {
    background: #4b5563 !important;
    color: white !important;
    border-color: #374151 !important;
}

/* Date Filter buttons styling for white text */
.date-filter-btn {
    color: white !important;
    background: #6b7280 !important;
    border: 1px solid #4b5563 !important;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    width: 100%;
    margin: 0;
}

.date-filter-btn:hover {
    background: #4b5563 !important;
    color: white !important;
    border-color: #374151 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.date-filter-btn.active {
    background: var(--primary-gradient) !important;
    color: white !important;
    border-color: transparent !important;
}

/* Theme specific overrides for filter buttons */
body.theme .sidebar .filter-btn:not(.active) {
    background: #4b5563 !important;
    color: white !important;
    border-color: #374151 !important;
}

body.theme .sidebar .filter-btn:not(.active):hover {
    background: #374151 !important;
    color: white !important;
    border-color: #1f2937 !important;
}

/* Theme support for date-filter-btn */
body.theme .date-filter-btn {
    background: #4b5563 !important;
    color: white !important;
    border-color: #374151 !important;
}

body.theme .date-filter-btn:hover {
    background: #374151 !important;
    color: white !important;
    border-color: #1f2937 !important;
}

body.theme .date-filter-btn.active {
    background: var(--primary-gradient) !important;
    color: white !important;
    border-color: transparent !important;
}
