/* scorecard.css - ATS Themed (uses shared tokens) */
@import url('tokens.css');

/* --- Common Layout --- */
.container,
.containerResults {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* --- Navigation & Header --- */
.navigation-bar {
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    background-color: white;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
}

.back-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.results-header-block {
    text-align: center;
    margin-bottom: 2rem;
}

.results-header-block h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-display);
}

/* --- Scorecard Specifics --- */
.scorecard-container {
    background-color: var(--bg-card);
    padding: 0;
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    margin-top: 1rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

.scorecard-header {
    text-align: center;
    background: var(--primary-gradient);
    padding: 3rem 2rem;
    color: white;
    position: relative;
    border-bottom: 4px solid var(--accent-color);
}

/* Subtle pattern overlay */
.scorecard-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 20%);
    pointer-events: none;
}

.scorecard-header h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: white;
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.scorecard-header p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0.25rem 0;
    font-family: var(--font-body);
    font-weight: 500;
}

.scorecard-header strong {
    color: white;
    font-weight: 700;
    color: var(--accent-color);
    /* Pop of red */
}

.scorecard-distance-block {
    margin: 2rem;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.scorecard-distance-block h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--primary-dark);
    background-color: #f8fafc;
    /* Very subtle gray */
    padding: 1rem 1.5rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-subtle);
    border-left: 6px solid var(--accent-color);
}

/* --- Results List UI --- */
.results-nav {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.results-nav a {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    background-color: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-family: var(--font-heading);
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.results-nav a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.results-nav a.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-md);
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    /* Slight rounded corners */
    font-size: 1.1rem;
    transition: all 0.2s;
    background: white;
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(26, 71, 42, 0.1);
    /* Green glow */
}

/* --- Card & Division Styles --- */
.results-division-block {
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.results-division-block:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-hover);
}

.division-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-gradient);
    color: white;
    padding: 1.2rem 1.8rem;
    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.division-header h2 {
    font-size: 1.3rem;
    font-family: var(--font-display);
    font-weight: 700;
    color: white;
    letter-spacing: 0.05em;
    margin: 0;
}

.details-toggle-btn {
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    font-family: var(--font-heading);
    text-transform: uppercase;
}

.details-toggle-btn:hover {
    background-color: white;
    color: var(--primary-dark);
}

.division-header::after {
    content: '-';
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: bold;
    margin-left: 1rem;
    line-height: 1;
    opacity: 0.8;
}

.results-division-block.closed .division-header::after {
    content: '+';
}

/* --- Shared Table Styles --- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 1500px;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: white;
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: var(--text-muted) transparent;
}

.results-division-block.closed .table-wrapper {
    max-height: 0;
}

.scorecard-table,
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
    background-color: #fff;
    min-width: 600px;
}

.scorecard-table th,
.scorecard-table td,
.results-table th,
.results-table td {
    padding: 14px 16px;
    text-align: center;
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
}

.scorecard-table thead th,
.results-table thead th {
    background-color: #f8fafc;
    /* Neutral Light Gray */
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-subtle);
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-table thead th {
    text-align: left;
}

.results-table tbody tr:hover,
.scorecard-table tbody tr:hover {
    background-color: #f9fafb;
    /* Very subtle hover */
}

/* --- Scorecard Cell Styles --- */
.scorecard-table .score-cell {
    font-weight: 600;
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

.scorecard-table .score-x,
.scorecard-table .score-ix {
    font-weight: 800;
    color: var(--accent-color);
    font-family: var(--font-heading);
    font-size: 1.25rem;
}

.scorecard-table .score-m {
    color: var(--text-muted);
    font-style: italic;
    background-color: #f9fafb;
}

.scorecard-table .end-total,
.scorecard-table .running-total {
    background-color: #f1f5f9;
    /* Slight gray for totals */
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 1.1rem;
}

.scorecard-table .distance-total-label {
    text-align: right;
    font-weight: 800;
    border: none !important;
    padding-right: 2rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.scorecard-table .distance-total-value {
    background-color: var(--primary-color);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font-display);
}

/* --- Event Results Cell Styles --- */
.col-rank {
    text-align: center;
    width: 60px;
    font-weight: 800;
    color: var(--primary-color);
    font-family: var(--font-display);
    font-size: 1.2rem;
}

.col-athlete {
    width: auto;
    text-align: left;
}

.col-club {
    width: 25%;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.col-total {
    text-align: right;
    width: 100px;
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--primary-dark);
    font-weight: 800;
}

.col-10x {
    text-align: center;
    width: 80px;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 600;
}

.athlete-primary a {
    color: var(--text-main);
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s;
    font-size: 1.15rem;
}

.athlete-primary a:hover {
    color: var(--accent-color);
}

.club-code {
    font-weight: 700;
    color: var(--primary-color);
    background-color: rgba(26, 71, 42, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    font-size: 0.8rem;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {

    .container,
    .containerResults {
        padding: 0.75rem 0.5rem;
    }

    .navigation-bar {
        margin-bottom: 0.75rem;
    }

    .scorecard-header {
        padding: 1.25rem 0.75rem;
    }

    .scorecard-header h1 {
        font-size: 1.3rem;
    }

    .scorecard-header p {
        font-size: 0.9rem;
    }

    .results-header-block h1 {
        font-size: 1.5rem;
    }

    /* Scorecard Table Compact */
    .scorecard-distance-block {
        margin: 1rem 0;
        border-radius: 8px;
    }

    .scorecard-table th,
    .scorecard-table td {
        padding: 8px 4px;
        font-size: 0.85rem;
        /* Smaller font */
        border-width: 1px;
    }

    .scorecard-table .score-cell,
    .scorecard-table .score-x,
    .scorecard-table .score-ix {
        font-size: 1rem;
    }

    /* Make total columns stand out less width-wise but distinct */
    .scorecard-table .end-total,
    .scorecard-table .running-total {
        font-size: 0.9rem;
        padding: 8px 4px;
    }

    /* Results Table Compact */
    .results-table {
        min-width: 100%;
        /* Force fit */
        display: table;
    }

    /* Hide Club Name on mobile to save space */
    .col-club,
    .results-table th:nth-child(3),
    .results-table td:nth-child(3) {
        display: none;
    }

    /* Adjust Rank Column */
    .col-rank {
        width: 30px;
        font-size: 1rem;
        padding: 8px 2px;
    }

    /* Adjust Athlete Name */
    .col-athlete {
        max-width: 140px;
        /* Force wrap/overflow handling if needed */
        overflow: hidden;
    }

    .athlete-primary a {
        font-size: 1rem;
        display: block;
        line-height: 1.2;
    }

    /* Adjust Total Score & 10s */
    .col-total {
        width: 60px;
        font-size: 1.1rem;
        padding-right: 4px;
    }

    .col-10x {
        width: 40px;
        font-size: 0.8rem;
        padding: 8px 2px;
    }
}