/* Mario Kart Tracker CSS Overrides - Fixes for main.css conflicts */

/* ===========================================
   Text Color and Font-Weight Overrides
   =========================================== */

/* Override main.css global strong/b element styles */
.mario-kart-tracker strong,
.mario-kart-tracker b,
.white-bold-text {
    color: white !important;
    font-weight: bold !important;
}

/* Tier range numbers styling */
.tier-range-numbers {
    color: white !important;
    font-weight: bold !important;
}

/* Legend titles styling */
.legend-title {
    color: white !important;
    font-weight: bold !important;
}

/* Tips text styling */
.tips-text {
    color: white !important;
    font-weight: bold !important;
}

/* ===========================================
   Button Overrides
   =========================================== */

/* Game version toggle buttons - inactive state */
.game-version-toggle button.version-btn {
    background: #4a5568 !important;
    border: 1px solid #6b7280 !important;
    color: white !important;
}

.game-version-toggle button.version-btn:not(.active) {
    background: #4a5568 !important;
    border: 1px solid #6b7280 !important;
}

.game-version-toggle button.version-btn span {
    color: white !important;
}

.game-version-toggle button.version-btn .version-text {
    color: white !important;
}

.game-version-toggle button.version-btn .version-icon {
    color: white !important;
}

/* Ensure active state styles are applied */
.game-version-toggle button.version-btn.active,
.game-version-toggle button#mk8d-btn.active,
.game-version-toggle button#mkworld-btn.active {
    background: #667eea !important;
    border-color: #667eea !important;
}

.game-version-toggle button.version-btn.active:hover,
.game-version-toggle button#mk8d-btn.active:hover,
.game-version-toggle button#mkworld-btn.active:hover {
    background: #5a67d8 !important;
    border-color: #5a67d8 !important;
}

.game-version-toggle button.version-btn.active span {
    color: white !important;
}

.game-version-toggle button.version-btn.active .version-text {
    color: white !important;
}

.game-version-toggle button.version-btn.active .version-icon {
    color: white !important;
}

/* Override main.css button styling for pagination */
.pagination-btn {
    color: white !important;
    background: #667eea !important;
    border: 1px solid #667eea !important;
}

.pagination-btn:hover:not(:disabled) {
    color: white !important;
    background: #5a67d8 !important;
    border-color: #5a67d8 !important;
}

.pagination-btn.active {
    color: white !important;
    background: #4c51bf !important;
    border-color: #4c51bf !important;
}

/* Theme pagination overrides */
body.theme .pagination-btn {
    color: white !important;
    background: #374151 !important;
    border-color: #4a5568 !important;
}

body.theme .pagination-btn:hover:not(:disabled) {
    color: white !important;
    background: #4b5563 !important;
}

/* Export/Import/Backup button classes */
.export-btn {
    background: #48BB78 !important;
    color: white !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.import-btn {
    background: #38B2AC !important;
    color: white !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    margin-left: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.backup-btn {
    background: #4299E1 !important;
    color: white !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    margin-left: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ===========================================
   Modal Styling Classes
   =========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-dialog {
    background: var(--modal-bg, #2d3748);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}


.modal-title {
    color: var(--modal-title-color, #e2e8f0);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}





.modal-btn-primary {
    background: #8b5cf6;
    color: white !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    line-height: 1;
}

.modal-btn-secondary {
    background: var(--modal-secondary-bg, #4a5568);
    color: white !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    line-height: 1;
}


/* Specific styling for Edit Race modal buttons */
#save-edit {
    background: #10b981 !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    line-height: 1 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

#cancel-edit {
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    line-height: 1 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* ===========================================
   Form Styling Classes
   =========================================== */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--form-label-color, #e2e8f0);
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}



/* ===========================================
   Table Styling Classes
   =========================================== */

.sortable-header {
    cursor: pointer;
    user-select: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.sortable-header:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.sortable-header:focus {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.empty-state h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: #718096;
}

.empty-state-placeholder {
    color: #718096;
}

/* ===========================================
   Layout Classes
   =========================================== */

/* Sticky footer solution */
.mario-kart-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.mario-kart-content {
    flex: 1;
}

.mario-kart-footer {
    margin-top: auto;
}

/* Hidden elements - don't use !important to allow JavaScript overrides */
.hidden {
    display: none;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ===========================================
   Sidebar and Tooltip Positioning
   =========================================== */

/* Fix sidebar button tooltip positioning - move below buttons */
.sidebar-header-buttons .custom-tooltip {
    z-index: 10002 !important;
    position: absolute !important;
    top: 100% !important;
    bottom: auto !important;
    transform: translateY(8px) translateX(-50%) !important;
}

.sidebar-header-buttons .custom-tooltip.visible {
    transform: translateY(12px) translateX(-50%) !important;
}

.sidebar-header-buttons .custom-tooltip::before {
    top: -4px !important;
    bottom: auto !important;
    box-shadow: -2px -2px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Alternative approach for any remaining sidebar tooltips */
.sidebar-header .custom-tooltip {
    z-index: 10003 !important;
    position: absolute !important;
    top: 100% !important;
    bottom: auto !important;
    transform: translateY(8px) translateX(-50%) !important;
}

.sidebar-header .custom-tooltip.visible {
    transform: translateY(12px) translateX(-50%) !important;
}

.sidebar-header .custom-tooltip::before {
    top: -4px !important;
    bottom: auto !important;
    box-shadow: -2px -2px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Sidebar toggle perfect alignment */
.sidebar-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

.sidebar-toggle svg {
    stroke: white !important;
}

/* ===========================================
   Visualization Styling
   =========================================== */

.viz-tip-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.viz-color-indicator {
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 4px;
    display: inline-block;
    font-weight: 600 !important;
}

.viz-color-green {
    color: #10b981 !important;
    font-weight: 600 !important;
}

.viz-color-yellow {
    color: #f59e0b !important;
    font-weight: 600 !important;
}

.viz-color-red {
    color: #ef4444 !important;
    font-weight: 600 !important;
}

.viz-color-gray {
    color: #9ca3af !important;
    font-weight: 600 !important;
}

/* Frequency gradient indicators */
.frequency-low {
    background-color: rgba(6, 182, 212, 0.3) !important;
    color: black !important;
}

.frequency-medium {
    background-color: rgba(6, 182, 212, 0.65) !important;
    color: black !important;
}

.frequency-high {
    background-color: rgba(6, 182, 212, 1.0) !important;
    color: black !important;
}

/* Theme support */

    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ===========================================
   H2H Player Name Styling (Match Header Pills)
   =========================================== */

/* Make parent cell same color as pill */
.h2h-player-name {
    background: var(--h2h-accent) !important;
    padding: 0 !important;
}

/* Theme support for parent cell */
body.theme .h2h-player-name {
    background: #2d3748 !important;
}

.h2h-player-pill {
    background: var(--h2h-accent);
    color: white;
    padding: 0.75rem 0.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9375rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.h2h-player-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Theme support */
body.theme .h2h-player-pill {
    background: #2d3748;
    color: white;
}

/* ===========================================
   H2H Loss Card Text Color Fix
   =========================================== */

/* Ensure all text in loss cards (red background) is white */
.h2h-cell.h2h-loser-text .h2h-content,
.h2h-cell.h2h-loser-text .h2h-score,
.h2h-cell.h2h-loser-text .h2h-separator,
.h2h-cell.h2h-loser-text .h2h-streak,
.h2h-cell.h2h-loser-text .h2h-streak-main,
.h2h-cell.h2h-loser-text .h2h-streak-details,
.h2h-cell.h2h-loser-text .h2h-biggest-win {
    color: #fff !important;
}

/* Make dashes bold in all H2H cards */
.h2h-separator {
    font-weight: bold !important;
}

/* ===========================================
   Sidebar Button Hover Fix
   =========================================== */

/* Fix sidebar button hover shift by ensuring consistent transform origin and preventing text shift */
.sidebar-close-btn,
.sidebar-header-clear {
    transform-origin: center !important;
    font-weight: 400 !important; /* Consistent font weight */
}

.sidebar-close-btn:hover,
.sidebar-header-clear:hover:not(:disabled) {
    transform-origin: center !important;
    font-weight: 400 !important; /* Prevent font weight change that can cause shift */
}

/* ===========================================
   Responsive Design
   =========================================== */

/* Mobile sidebar toggle improvements */
@media (max-width: 768px) {
    .sidebar-toggle {
        width: 48px !important;
        height: 48px !important;
        top: 60px !important;
        font-size: 0.9rem !important;
        padding: 0 !important;
    }
    
    .sidebar-toggle svg {
        width: 20px !important;
        height: 20px !important;
    }
    
    .modal-dialog {
        padding: 1.5rem;
        width: 95%;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .export-btn,
    .import-btn,
    .backup-btn {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sidebar-toggle {
        width: 44px !important;
        height: 44px !important;
        top: 55px !important;
        font-size: 0.8rem !important;
    }
    
    .sidebar-toggle svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    .h2h-streak,
    .h2h-biggest-win,
    .h2h-player-name {
        font-size: 1rem !important;
        min-height: 45px !important;
        padding: 0.5rem !important;
    }
}

/* ===========================================
   Print Styles
   =========================================== */

@media print {
    .modal-overlay,
    .sidebar-toggle,
    .sidebar {
        display: none !important;
    }
    
    .mario-kart-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}
