/* =========================================
   HORSE RATINGS PAGE V2 STYLES
   ========================================= */

/* --- Layout Spacing --- */
.race-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.race-title {
    /* Inherits fonts from global styles */
    margin: 0;
    line-height: 1.2;
}

/* --- NEW: Modern View Toggle Controls (Segmented Pill) --- */
.view-toggle-wrapper {
    display: inline-flex;
    background-color: #f0f2f5;
    /* Light grey track */
    border-radius: 50px;
    padding: 4px;
    border: 1px solid #e1e4e8;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.view-toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 20px;
    border-radius: 40px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    /* Muted text */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    outline: none;
    white-space: nowrap;
}

.view-toggle-btn i {
    font-size: 0.9rem;
    color: #adb5bd;
    transition: color 0.3s ease;
}

/* Hover State */
.view-toggle-btn:hover {
    color: var(--color-primary);
    background-color: rgba(0, 0, 0, 0.02);
}

.view-toggle-btn:hover i {
    color: var(--color-primary);
}

/* Active State */
.view-toggle-btn.active {
    background-color: #ffffff;
    color: var(--color-primary);
    /* #1a472a */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.view-toggle-btn.active i {
    color: var(--color-secondary);
    /* Gold icon */
}

/* --- Main Card Container --- */
.ratings-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #eee;
    overflow: hidden;
    padding: 1.5rem;
}

/* --- Table Styles --- */
.ratings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ratings-table th {
    background-color: #f8f9fa;
    color: #666;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    padding: 1rem;
    border-bottom: 2px solid #eee;
    text-align: left;
}

.ratings-table td {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
    color: #444;
    vertical-align: middle;
}

.ratings-table tr:last-child td {
    border-bottom: none;
}

.ratings-table tr:hover td {
    background-color: #fcfcfc;
}

/* --- Column Specifics --- */
.col-no {
    width: 60px;
    text-align: center;
    color: #999;
    font-weight: 600;
}

.col-name {
    font-weight: 700;
    color: var(--color-primary);
}

.col-rating {
    width: 100px;
    text-align: center;
    font-weight: 800;
    color: var(--color-primary);
    background-color: rgba(26, 71, 42, 0.03);
    border-radius: 8px;
}

.col-gender {
    width: 100px;
}

.col-age {
    width: 80px;
}

.col-color {
    width: 100px;
}

.col-sire,
.col-dam {
    color: #666;
    font-size: 0.9em;
}

/* Top Horse Columns */
.col-wins {
    width: 80px;
    text-align: center;
    font-weight: 800;
    color: var(--color-green);
}

.col-stats {
    width: 80px;
    text-align: center;
    color: #555;
}

/* Links */
.ratings-table a {
    color: var(--color-text-dark);
    text-decoration: none;
    transition: color 0.2s;
}

.ratings-table a:hover {
    color: var(--color-secondary);
    text-decoration: underline;
}

/* --- Loading & Empty States --- */
.loading-state,
.section-empty {
    padding: 4rem 1rem;
    text-align: center;
    color: #999;
}

.spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
    color: var(--color-primary);
    margin-bottom: 1rem;
    display: inline-block;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

/* --- Load More Button --- */
.pagination-wrapper {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.btn-load-more {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    padding: 0.8rem 2.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-load-more:hover {
    background-color: var(--color-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(26, 71, 42, 0.25);
}

.btn-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .race-title-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }

    .view-toggle-wrapper {
        width: 100%;
        display: flex;
    }

    .view-toggle-btn {
        flex: 1;
        /* Make buttons equal width on mobile */
        justify-content: center;
        padding: 10px;
    }

    .ratings-card {
        padding: 0;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .table-responsive {
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        overflow-x: auto;
    }

    .ratings-table th,
    .ratings-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        white-space: nowrap;
        /* Prevent wrapping in tight columns */
    }


    /* Hide less critical columns on small screens to reduce scroll */
    .col-sire,
    .col-dam,
    .col-color {
        display: none;
    }
}

/* --- Year Select Box --- */
.year-filter-wrapper {
    position: relative;
}

.year-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #f0f2f5;
    border: 1px solid #e1e4e8;
    border-radius: 50px;
    padding: 8px 32px 8px 16px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

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

.year-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.1);
}

/* Custom Arrow for Select */
.year-filter-wrapper::after {
    content: '\f078';
    /* FontAwesome chevron-down */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: #999;
    pointer-events: none;
}

.header-tagline {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    /* Wider spacing for elegance */

    /* Brand Colors: Dark Green Background, White Text */
    color: #ffffff;
    background-color: var(--color-primary);

    /* Gold Border Accent (Optional, matches your branding) */
    border-bottom: 2px solid var(--color-secondary);

    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    /* Slight rounded corners, or use 50px for full pill */

    box-shadow: 0 4px 10px rgba(26, 71, 42, 0.2);
    /* Soft green shadow */
    display: inline-block;
    opacity: 0.9;
}

/* Mobile Adjustment */
@media (max-width: 768px) {
    .header-tagline {
        font-size: 0.7rem;
        padding: 0.4rem 1rem;
        margin-top: 5px;
    }
}