/* --- HEADER & POSITIONING --- */
.about-header {
    position: relative; /* Anchor for absolute toggle */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 2rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.header-text-group {
    flex: 1;
    padding-right: 20px;
}

/* --- DIVISION TOGGLE BASE --- */
#records .division-toggle-container {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column; /* Stacks the row and search bar */
    align-items: flex-end;  /* Aligns everything to the right */
    gap: 1rem;
}

/* --- TOP ROW LAYOUT --- */
.filter-controls-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Public positioning: Top Right */
#records .division-toggle-container {
    position: absolute;
    top: 0;
    right: 0;
}

/* Admin positioning: Inline with form */
.admin-toggle.division-toggle-container {
    position: relative;
    justify-content: flex-start;
    margin-top: 0.5rem;
}

/* Style the dropdown to match your theme */
#course-filter {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    backdrop-filter: blur(5px);
}

#course-filter option {
    background: var(--sidebar-bg);
    color: var(--text-color);
}

.division-toggle {
    display: flex;
    background: var(--card-bg);
    padding: 3px;
    border-radius: 12px;
    position: relative;
    border: 1px solid var(--glass-border);
    width: fit-content;
    backdrop-filter: blur(5px);
}

/* Darker background for Admin cards to improve contrast */
.admin-card .division-toggle {
    background: rgba(0, 0, 0, 0.2);
}

.division-toggle input {
    display: none;
}

.division-toggle label {
    padding: 8px 16px;
    cursor: pointer;
    z-index: 2;
    font-weight: 700;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    color: var(--text-color);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.division-toggle input:checked + label {
    color: #fff; /* White text on blue pill always */
    opacity: 1;
}

/* The Sliding Pill */
.division-toggle .toggle-slider {
    position: absolute;
    height: calc(100% - 6px);
    width: calc(50% - 3px);
    background: var(--accent-color);
    border-radius: 10px;
    top: 3px;
    left: 3px;
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Animation triggers for both Public and Admin IDs */
#div-w:checked ~ .toggle-slider,
#admin-div-w:checked ~ .toggle-slider {
    transform: translateX(100%);
}

/* --- RECORDS LAYOUT --- */
.park-record-section {
    margin-bottom: 5rem;
    animation: fadeIn 0.5s ease forwards;
}

.park-title {
    font-size: 2.2rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
    font-weight: 800;
    text-transform: uppercase;
}

.layouts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.layout-group {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.layout-group:hover {
    background: rgba(var(--accent-color), 0.05);
    border-color: var(--accent-color);
    transform: translateY(-4px);
}

.layout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--glass-border);
}

.layout-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    font-weight: 700;
}

.par-badge {
    font-size: 0.7rem;
    background: var(--nav-hover);
    color: var(--text-color);
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 800;
}

.record-row {
    display: flex;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.record-row:last-child { border-bottom: none; }

.rank {
    font-family: 'monospace';
    width: 30px;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.3;
}

.player-info {
    flex-grow: 1;
}

.player-name {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
}

.record-date {
    display: block;
    font-size: 0.7rem;
    color: var(--text-color);
    opacity: 0.4;
    margin-top: 2px;
}

.score-display {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.total-strokes {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-color);
}

.to-par {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.6;
    margin-top: 4px;
    color: var(--text-color);
}

/* Gold Finish Highlights */
.gold-record {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, transparent 100%);
    margin: 0 -0.5rem;
    padding: 0.8rem 0.5rem;
    border-radius: 8px;
    border-left: 3px solid #FFD700;
}

.gold-record .rank {
    color: #FFD700;
    opacity: 1;
}

.gold-record .total-strokes, 
.gold-record .to-par {
    color: var(--accent-color);
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- RESPONSIVE: STACK ON MOBILE --- */
@media (max-width: 768px) {
    .about-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .header-text-group {
        padding-right: 0;
        margin-bottom: 1.5rem;
    }

    #records .division-toggle-container {
        position: relative;
        right: auto;
        top: auto;
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
    }

    #course-filter {
        width: 100%;
        max-width: 300px;
    }

    .park-title {
        font-size: 1.8rem;
    }
}

/* --- SEARCH BAR STYLING --- */
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 300px;
    /* Ensure the wrapper doesn't have extra height */
    display: flex; 
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    
    /* --- VERTICAL CENTER FIX --- */
    top: 50%;
    transform: translateY(-50%);
    
    /* Look & Feel */
    font-size: 1.1rem; /* Adjust if the icon feels too big/small */
    opacity: 0.5;
    pointer-events: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

#record-search {
    width: 100%; /* Fills the 300px wrapper */
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 8px 12px 8px 35px;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

#record-search:focus {
    border-color: var(--accent-color);
    background: rgba(var(--accent-color), 0.05);
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    #records .division-toggle-container {
        position: relative;
        width: 100%;
        align-items: center; /* Center on mobile for better thumb reach */
    }
    
    .filter-controls-row {
        width: 100%;
        justify-content: center;
    }
    
    .search-wrapper {
        max-width: 100%;
    }
}