body { 
    /* Bootstrap handles the fonts, widths, and margins now. We just set a subtle background color. */
    background-color: #f4f7f6; 
}

#loading { display: none; color: #0056b3; font-weight: bold; margin-bottom: 15px; }

.unranked { color: #888; font-style: italic; }
.fit-text {
    white-space: nowrap;       
    overflow: hidden;          
    text-overflow: ellipsis; 
    font-size: 15px; 
}

td.player-name { max-width: 150px; }
td.player-location { max-width: 130px; }
td.player-rank { max-width: 130px; } /* New rule for Best Rank column */
td.player-section { max-width: 130px; }
td.player-district { max-width: 130px; }
td.player-utr { max-width: 70px; text-align: center; } 
td.player-wtn { max-width: 70px; text-align: center; }

/* GLOBAL BUTTON STYLES (Applies everywhere) */
.search-result-load-btn,
.usta-link,
.map-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;       
    width: auto !important; 
    padding: 0 16px;    
    font-size: 13px;
    font-family: inherit; 
    font-weight: bold;
    box-sizing: border-box;
    text-decoration: none;
    cursor: pointer;
}

/* Specific styling for the green Load button */
.search-result-load-btn {
    background-color: #28a745;
    color: white;
    border: 1px solid #28a745;
    border-radius: 4px;
}

/* Specific styling for the gray USTA link */
.usta-link {
    background-color: #e2e6ea;
    color: #0056b3;
    border: 1px solid #ced4da;
    border-radius: 20px;
    transition: all 0.2s ease-in-out;
}
.usta-link:hover {
    background-color: #0056b3;
    color: white;
    border-color: #0056b3;
}

/* Specific styling for the Map button */
.map-btn {
    background-color: #fff;
    color: #dc3545; 
    border: 1px solid #dc3545;
    border-radius: 20px;
    transition: all 0.2s ease-in-out;
}
.map-btn:hover {
    background-color: #dc3545;
    color: white;
}

/* FLEXBOX CONTAINER OVERRIDES (Zip Search Tab Only) */
.search-result-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.search-result-actions .search-result-load-btn,
.search-result-actions .usta-link,
.search-result-actions .map-btn {
    margin: 0 !important; /* Let the flexbox 'gap' handle spacing here */
}

#query-time { text-align: right; font-size: 14px; color: #666; font-style: italic; margin-top: 10px; display: none; }

/* --- Bridge for main.js Tab Switching Logic --- */

/* 1. Main App Tabs (Solid Blue Pills) */
.nav-pills .nav-link { color: #555; background-color: #e9ecef; }
.nav-pills .nav-link:hover { color: #0056b3; background-color: #dde3e9; }
.nav-pills .nav-link.active-tab {
    background-color: #0056b3 !important;
    color: white !important;
}

/* 2. Modal Tabs (Transparent with Blue Underline) */
.nav-tabs .nav-link { color: #6c757d; border-bottom: 3px solid transparent; }
.nav-tabs .nav-link:hover { color: #0056b3; border-bottom: 3px solid #dde3e9; }
.nav-tabs .nav-link.active-tab {
    color: #0056b3 !important;
    background-color: transparent !important;
    border-bottom: 3px solid #0056b3 !important;
}

.tab-panel { display: none; }
.tab-panel.active-panel { display: block; }

#search-results { margin-top: 12px; }
.search-result-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.search-result-name { font-weight: bold; font-size: 14px; color: #222; -webkit-text-size-adjust: auto; text-size-adjust: auto; }
.search-result-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 12px; color: #555; margin-top: 3px; }
.search-result-reg { font-size: 12px; color: #888; margin-top: 4px; }
.search-result-reg .surface-tag { display: inline-block; white-space: nowrap; }

#search-summary { 
    font-size: 13px; 
    color: #555; 
    margin-bottom: 10px; 
    scroll-margin-top: 10px; 
}
.search-error { color: red; font-weight: bold; font-size: 14px; }

/* Division Badges */
.div-badges-container { display: inline-flex; gap: 4px; margin-left: 4px; }
.div-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.div-badge-12 { background-color: #28a745; } /* Green */
.div-badge-14 { background-color: #007bff; } /* Blue */
.div-badge-16 { background-color: #fd7e14; } /* Orange */
.div-badge-18 { background-color: #dc3545; } /* Red */

/* Modal & Info Button Styling */
.info-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    background-color: #007bff; color: white; font-size: 11px;
    font-family: serif; font-style: italic; font-weight: bold;
    cursor: pointer; margin-left: 8px; user-select: none; flex-shrink: 0;
}
.info-btn:hover { background-color: #0056b3; }

#modalResultsContainer {
    /* Removed max-height and overflow-y to allow natural page scrolling */
}

/* Add this new block: Force the Results column to always show the full score */
#modalResultsContainer td:last-child,
#modalResultsContainer td:last-child * {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

/* Bridge for main.js Modal Tab switching logic */
.modal-tab-panel { display: none; }
.modal-tab-panel.active-panel { display: block; }
.nav-link.active-tab { color: #0056b3 !important; border-bottom-color: #0056b3 !important; }

/* TRN Stars & Blue Chip Badges */
.trn-stars {
    color: #f39c12;
    font-size: 13px;
    letter-spacing: 1px;
    display: inline-block;
    line-height: 1;
}
.blue-chip-container {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}
.blue-chip {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #4a68ef, #1a36c4 70%, #0d1e75);
    border: 1px solid #0d1e75;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    display: inline-block;
}

.mic-btn.listening {
    background-color: #dc3545 !important; /* Turns red when listening */
    color: white !important;
    border-color: #dc3545 !important;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Month & Year Separator Header */
.month-header {
    font-size: 15px;
    font-weight: bold;
    color: #0056b3;
    background-color: #e2ecf7;
    border-left: 4px solid #0056b3;
    padding: 7px 12px;
    margin-top: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

/* Help Button Styling */
.help-btn {
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    width: auto !important; 
    margin-bottom: 0 !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.help-btn:hover { background-color: #138496; }

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.header-container h2 {
    margin: 0;
}

/* Calendar Toggle Button (+/-) */
.cal-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    width: 32px !important;
    padding: 0;
    font-size: 20px;
    font-weight: bold;
    border-radius: 4px;
    line-height: 1;
    margin: 0 !important; /* Let the parent flex gap handle spacing */
}

/* --- FullCalendar Custom Overrides (PC & Base) --- */
.fc-toolbar-title {
    font-size: 1.15rem !important; /* Slightly smaller on PC */
    font-weight: bold;
    color: #0056b3;
}

.fc-button-primary {
    background-color: #0056b3 !important;
    border-color: #0056b3 !important;
}
.fc-button-primary:hover {
    background-color: #003d80 !important;
}

.fc-event {
    cursor: pointer;
    border: none;
    margin-bottom: 2px !important; /* Give a tiny gap between stacked events */
}

/* Force tournament names to wrap onto multiple lines instead of cutting off */
.fc-daygrid-event {
    white-space: normal !important; 
}

/* Container adjustments */
.fc-event-main {
    padding: 2px 3px !important;
    text-align: center;
}

/* The actual text element - Force wrap and clamp */
.fc-event-title {
    white-space: normal !important; 
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important; 
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-size: 10.5px !important; 
    line-height: 1.1 !important;
    font-weight: normal !important;
}

/* Shrink calendar day numbers and reduce top padding */
.fc .fc-daygrid-day-number {
    font-size: 12px !important;
    padding: 2px 4px !important; /* Reduces the default top margin/padding */
    color: #555 !important; /* Optional: softens the color slightly */
}

/* --- Mobile-Specific Adjustments (iPhones/Phones) --- */
@media (max-width: 576px) {
    /* Player Modal header */
    #modalPlayerName {
        font-size: 1.25rem !important; /* Slightly shrinks the player name on phones */
        line-height: 1.2;
    }
    #modalLocation {
        display: inline-block; /* Changed from block so it stays on the same line */
        font-size: 0.95rem !important;
        margin-top: 0;
        margin-left: 4px; /* Gives a tiny bit of breathing room from the name */
    }
    
    /* FullCalendar */
    .fc-toolbar-title {
        font-size: 0.95rem !important; /* Shrinks September 2026 */
    }
    .fc .fc-button {
        padding: 4px 8px !important; /* Shrinks the <, >, Today buttons */
        font-size: 12px !important;
        height: auto !important; 
    }
    /* Mobile Container */
    .fc-event-main {
        padding: 1px 2px !important;
    }
    
    /* Mobile Text Element */
    .fc-event-title {
        font-size: 9.5px !important; 
        -webkit-line-clamp: 2 !important; /* You can change this to 3 if you want an extra line on phones */
    }
    .fc .fc-toolbar.fc-header-toolbar {
        margin-bottom: 10px !important; /* Reduces gap between toolbar elements */
    }
    /* Further shrink day numbers for mobile */
    .fc .fc-daygrid-day-number {
        font-size: 10px !important;
        padding: 1px 4px !important; 
    }
}