/* ==================== COURSEPREVIEWPRO.CSS ==================== */
/* Modularized styles for Course Preview Pro page */

/* ==================== D3 & GENERAL ==================== */
.hole-num {
    text-align: center;
    font-size: 14px;
    margin-bottom: 5px;
}

.hole-label {
    font-weight: 600;
    font-size: 14px;
    fill: var(--bs-emphasis-color);
}

.par-label {
    font-size: 12px;
    fill: var(--bs-emphasis-color);
    font-weight: 500;
    opacity: 0.9;
}

.d3-tooltip {
    z-index: 1000;
    pointer-events: none;
}

/* ==================== STATS COMPARISON TABLE ==================== */
.dashboard-stats {
    font-size: 0.875rem;
    border: 1px solid var(--bs-border-color) !important;
    border-radius: 8px;
    overflow: hidden;
}

.stat-headers {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
    background-color: rgba(var(--bs-body-color-rgb), 0.1);
    border-bottom: 1px solid var(--bs-border-color);
}

.stat-header {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--bs-emphasis-color);
    border-right: 1px solid var(--bs-border-color-subtle);
}

    .stat-header:first-child {
        text-align: left;
    }

    .stat-header:last-child {
        border-right: none;
    }

.stat-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
    border-bottom: 1px solid var(--bs-border-color-subtle);
    transition: background-color 0.15s ease-in-out;
}

    .stat-row:last-child {
        border-bottom: none;
    }

    .stat-row:hover {
        background-color: rgba(var(--bs-body-color-rgb), 0.08);
    }

.stat-label {
    color: var(--bs-emphasis-color);
    font-weight: 500;
}

.stat-value {
    padding: 0.625rem;
    border-right: 1px solid var(--bs-border-color-subtle);
    color: var(--bs-emphasis-color);
    font-weight: 300;
}

.stat-label,
.stat-value {
    padding: 0.625rem;
    border-right: 1px solid var(--bs-border-color-subtle);
}

    .stat-value:last-child {
        border-right: none;
    }

/* ==================== CARD LAYOUT ==================== */
.card {
    min-height: 100px;
    display: flex;
    flex-direction: column;
}

.card-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
}

/* ==================== STATS TILES ==================== */
.stats-tile {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    padding: 8px 12px;
}

.stats-header {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    text-align: left;
    margin-bottom: auto;
}

.stats-value {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.2;
    color: rgba(var(--bs-emphasis-color-rgb), 0.87);
}

.stats-trend {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
    margin-left: 0.5rem;
}

.stats-comparison {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.90rem;
}

.comparison-arrow {
    margin-right: 2px;
}

    .comparison-arrow.up {
        color: #dc3545;
    }

    .comparison-arrow.down {
        color: #198754;
    }

/* ==================== WINNERS ==================== */
.winners-ticker {
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.winner-item {
    font-size: 0.8125rem;
    white-space: nowrap;
    text-align: left;
}

.winner-year {
    color: var(--bs-secondary-color);
    margin-right: 4px;
}

.winners-list {
    gap: 8px;
    display: flex;
    align-items: center;
}

.winner-image-container {
    background-color: var(--bs-gray-200);
}

[data-bs-theme="dark"] .winner-image-container {
    background-color: var(--bs-gray-700);
}

.winner-image {
    border: 2px solid var(--bs-body-bg);
}

.winner-carousel {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

    .winner-carousel::-webkit-scrollbar {
        height: 8px;
    }

    .winner-carousel::-webkit-scrollbar-thumb {
        background-color: #ccc;
        border-radius: 4px;
    }

    .winner-carousel::-webkit-scrollbar-track {
        background-color: transparent;
    }

.winner-card-container {
    width: 200px;
}

@media (min-width: 768px) {
    .winner-card-container {
        width: 250px;
    }
}

/* ==================== STICKY HEADER ==================== */
#sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: white;
}

    #sticky-header.d-none {
        display: none !important;
    }

/* ==================== FLOATING NAV ==================== */
.floating-nav {
    transition: width 0.3s ease;
    width: 36px;
    overflow: hidden;
    white-space: nowrap;
    border: 1px solid #0d6efd;
}

[data-bs-theme="dark"] .floating-nav {
    transition: width 0.3s ease;
    width: 36px;
    overflow: hidden;
    white-space: nowrap;
    border: 1px solid #00af50;
}

.floating-nav:hover {
    width: 200px;
}

.floating-nav .nav-link {
    border-radius: 4px;
    margin: 1px 0;
    padding: 4px 8px;
}

    .floating-nav .nav-link:hover {
        background-color: var(--bs-tertiary-bg);
    }

.menu-icon {
    width: 24px;
    text-align: center;
    display: flex;
    justify-content: center;
    font-size: 1.4rem;
}

.floating-nav .menu-text {
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 0.9rem;
}

.floating-nav:hover .menu-text {
    opacity: 1;
}

/* ==================== PLAYER LINK ==================== */
.player-link {
    position: relative;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

    .player-link::after {
        content: '';
        position: absolute;
        width: 0;
        height: 1px;
        bottom: 0;
        left: 50%;
        background-color: currentColor;
        transition: all 0.2s ease;
    }

    .player-link:hover::after {
        width: calc(100% - 8px);
        left: 4px;
    }

/* ==================== STATS GRID ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    min-height: 400px;
    grid-auto-rows: minmax(90px, 1fr);
}

.stat-card-grid {
    display: flex;
    flex-direction: column;
    min-height: 90px;
}

    .stat-card-grid .card {
        flex: 1;
        min-height: 0;
    }

    .stat-card-grid .card-body {
        padding: 8px !important;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100%;
        position: relative;
        min-height: 80px;
    }

    .stat-card-grid .stats-header {
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--bs-secondary-color);
        text-align: center;
        margin-bottom: auto;
        line-height: 1.1;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .stat-card-grid .stats-value {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        transform: translateY(-50%);
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 1.25rem;
        font-weight: 500;
        line-height: 1.1;
        color: rgba(var(--bs-emphasis-color-rgb), 0.87);
    }

    .stat-card-grid .stats-comparison {
        position: absolute;
        bottom: 4px;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 0.75rem;
    }

    .stat-card-grid .card:hover {
        transform: translateY(-2px);
        transition: transform 0.15s ease-in-out;
    }

    .stat-card-grid [data-bs-toggle="tooltip"] {
        font-size: 0.75rem;
    }

.stat-card {
    display: none;
}

/* ==================== CORRELATION CHART ==================== */
.correlation-container {
    background: transparent;
    border-radius: 8px;
    padding: 12px;
    position: relative;
}

.correlation-header h6 {
    color: var(--bs-emphasis-color);
    margin-bottom: 8px;
}

.correlation-dot-chart {
    font-family: system-ui, -apple-system, sans-serif;
}

    .correlation-dot-chart svg {
        overflow: visible;
    }

    .correlation-dot-chart text {
        user-select: none;
    }

.correlation-legend {
    display: flex;
    gap: 12px;
    font-size: 10px;
    font-weight: 600;
}

.correlation-legend-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.correlation-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    vertical-align: middle;
}

/* ==================== WEATHER BADGE ==================== */
.weather-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

    .weather-badge:hover {
        background-color: rgba(var(--bs-primary-rgb), 0.2);
        transform: translateY(-1px);
        color: var(--bs-primary);
    }

/* ==================== GAUGE CHART ==================== */
.chart-gauge-outer {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
}

.chart-gauge {
    position: relative;
    width: 300px;
    height: 290px;
}

.gauge-legend {
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
}

.gauge-legend-title {
    font-size: 12px;
    color: var(--bs-secondary-color);
}

.gauge-legend-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--bs-emphasis-color);
    transition: all 0.5s ease;
}

.gauge-legend-stats {
    font-size: 11px;
    color: var(--bs-secondary-color);
    margin-top: 4px;
}

.gauge-text {
    position: absolute;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--bs-body-color);
    pointer-events: none;
    z-index: 5;
}

    .gauge-text.gauged {
        font-weight: 800;
        text-decoration: underline;
    }

.gauge-text-accuracy {
    bottom: 10px;
    left: 10px;
}

.gauge-text-straight {
    top: 85px;
    left: 35px;
}

.gauge-text-neutral {
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
}

.gauge-text-long {
    top: 85px;
    right: 35px;
}

.gauge-text-bomber {
    bottom: 10px;
    right: 10px;
}

.arc {
    transition: opacity 0.3s ease, filter 0.3s ease;
    opacity: 0.85;
}

    .arc:hover {
        opacity: 1;
        filter: brightness(1.1);
        cursor: pointer;
    }

/* Light mode gauge colors */
[data-bs-theme="light"] .chart-color1 {
    fill: #f87171;
}

[data-bs-theme="light"] .chart-color2 {
    fill: #fb923c;
}

[data-bs-theme="light"] .chart-color3 {
    fill: #60a5fa;
}

[data-bs-theme="light"] .chart-color4 {
    fill: #34d399;
}

[data-bs-theme="light"] .chart-color5 {
    fill: #10b981;
}

/* Dark mode gauge colors */
[data-bs-theme="dark"] .chart-color1 {
    fill: #ff6b6b;
}

[data-bs-theme="dark"] .chart-color2 {
    fill: #ffa94d;
}

[data-bs-theme="dark"] .chart-color3 {
    fill: #74c0fc;
}

[data-bs-theme="dark"] .chart-color4 {
    fill: #51cf66;
}

[data-bs-theme="dark"] .chart-color5 {
    fill: #20c997;
}

.needle {
    fill: var(--bs-emphasis-color);
    transition: all 1s ease-out;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.needle-center {
    fill: var(--bs-body-bg);
    stroke: var(--bs-emphasis-color);
    stroke-width: 2;
}

/* ==================== HOLE-BY-HOLE TABLE ==================== */
.hole-stats-table-wrapper {
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    overflow: hidden;
}

.hole-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: fixed;
}

    .hole-stats-table th,
    .hole-stats-table td {
        width: 80px;
        min-width: 80px;
        padding: 0.75rem 0.25rem;
        text-align: center;
        border: 1px solid var(--bs-border-color);
        font-weight: 600;
    }

        .hole-stats-table th:first-child,
        .hole-stats-table td:first-child {
            width: 180px;
            min-width: 180px;
            text-align: left;
            padding-left: 1rem;
            font-weight: 700;
            background-color: var(--bs-secondary-bg);
            position: sticky;
            left: 0;
            z-index: 10;
        }

    .hole-stats-table th {
        background-color: var(--bs-secondary-bg);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.75rem;
        position: sticky;
        top: 0;
        z-index: 20;
    }

        .hole-stats-table th:first-child {
            z-index: 30;
        }

    .hole-stats-table tbody tr:nth-child(odd) {
        background-color: var(--bs-body-bg);
    }

    .hole-stats-table tbody tr:nth-child(even) {
        background-color: var(--bs-tertiary-bg);
    }

    .hole-stats-table tbody tr:hover {
        background-color: rgba(var(--bs-primary-rgb), 0.1);
    }

/* Hole stat color coding */
.hole-stat-great {
    background-color: #2ea745;
    color: white;
    font-weight: bold;
}

.hole-stat-good {
    background-color: #98d8a0;
    color: black;
}

.hole-stat-poor {
    background-color: #ffc0c0;
    color: black;
}

.hole-stat-bad {
    background-color: #dc3545;
    color: white;
    font-weight: bold;
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */

/* Large screens */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .stat-card-grid .stats-header {
        font-size: 0.7rem;
    }

    .stat-card-grid .stats-value {
        font-size: 1.1rem;
    }
}

/* Tablet */
@media (max-width: 768px) {
    #courseStats {
        display: flex !important;
        flex-direction: column;
    }

        #courseStats .col-lg-6:first-child {
            order: 2;
            margin-top: 20px;
        }

        #courseStats .col-lg-6:last-child {
            order: 1;
        }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        min-height: 500px;
    }

    .correlation-container {
        height: 450px !important;
    }

    .correlation-legend {
        gap: 8px;
        font-size: 9px;
        flex-wrap: wrap;
    }

    .correlation-header .chart-direction-label {
        display: none;
    }

    #courseStats .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .hole-stats-table {
        font-size: 0.75rem;
    }

        .hole-stats-table th,
        .hole-stats-table td {
            padding: 0.5rem 0.125rem;
            min-width: 60px;
            width: 60px;
        }

            .hole-stats-table th:first-child,
            .hole-stats-table td:first-child {
                width: 140px;
                min-width: 140px;
                padding-left: 0.5rem;
                font-size: 0.7rem;
            }
}

/* Mobile */
@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 6px;
        min-height: 600px;
    }

    .stat-card-grid .card-body {
        padding: 6px !important;
        min-height: 75px;
    }

    .stat-card-grid .stats-header {
        font-size: 0.65rem;
    }

    .stat-card-grid .stats-value {
        font-size: 1rem;
    }

    .stat-card-grid .stats-comparison {
        font-size: 0.65rem;
    }

    .correlation-container {
        height: 420px !important;
    }

    .correlation-legend {
        gap: 6px;
        font-size: 8px;
    }

    .hole-stats-table th,
    .hole-stats-table td {
        min-width: 50px;
        width: 50px;
        padding: 0.4rem 0.1rem;
    }

        .hole-stats-table th:first-child,
        .hole-stats-table td:first-child {
            width: 120px;
            min-width: 120px;
            font-size: 0.65rem;
        }
}

/* Small mobile */
@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }

    .stat-card-grid .stats-header {
        font-size: 0.6rem;
    }

    .stat-card-grid .stats-value {
        font-size: 0.9rem;
    }
}

/* ==================== D3 HOLE CHART (was dynamically injected) ==================== */
.hole-outer {
    position: relative;
    display: inline-block;
    width: calc(100% / 18);
    height: 180px;
    border-right: 1px solid var(--bs-border-color);
}

    .hole-outer:first-child {
        border-left: 1px solid var(--bs-border-color);
    }

.hole-stats {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    font-size: 10px;
    color: var(--bs-body-color);
    opacity: 0.7;
    padding-bottom: 4px;
}

.zero-line {
    position: absolute;
    width: 100%;
    height: 1px;
    background-color: var(--bs-border-color);
    z-index: 1;
}

.reference-line {
    position: absolute;
    width: 100%;
    height: 1px;
    border-top: 1px dashed var(--bs-border-color);
}

.score-bar {
    position: absolute;
    width: 60%;
    left: 20%;
    background-color: #2E8B57;
    transition: height 0.3s ease;
}

    .score-bar.over-par {
        background-color: #808080;
    }

.score-label {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: var(--bs-body-color);
}
