:root {
    --color-bg: #0b0f17;
    --color-bg-sidebar: #0f1524;
    --color-card: rgba(20, 27, 45, 0.65);
    --color-card-border: rgba(56, 189, 248, 0.08);
    --color-primary: #10b981;
    --color-primary-hover: #34d399;
    --color-primary-glow: rgba(16, 185, 129, 0.25);
    --color-gold: #fbbf24;
    --color-gold-glow: rgba(251, 191, 36, 0.2);
    --color-text: #f3f4f6;
    --color-text-muted: #9ca3af;
    --color-text-bright: #ffffff;
    --font-sans: 'Plus Jakarta Sans', 'Outfit', -apple-system, sans-serif;
    --border-radius: 16px;
    --transition-speed: 0.2s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.05) 0px, transparent 50%);
    color: var(--color-text);
    font-family: var(--font-sans);
    min-height: 100vh;
    padding: 30px;
    display: flex;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* HEADER STYLE */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--color-card-border);
    padding: 20px 28px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.golf-flag {
    font-size: 36px;
    filter: drop-shadow(0 0 10px var(--color-primary-glow));
}

.logo-area h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--color-text-bright) 40%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-area .subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.course-badge {
    text-align: right;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.course-badge:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}


.badge-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-primary);
    letter-spacing: 1px;
}

.badge-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-bright);
}

.badge-details {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* MAIN LAYOUT */
.main-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}

/* SIDEBAR CONTROL PANEL */
.sidebar-panel {
    background: var(--color-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--color-card-border);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text-bright);
    letter-spacing: -0.2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 13.5px;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-speed);
}

.form-input:focus {
    border-color: var(--color-primary);
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slider-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-primary);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: 700;
    font-size: 11px;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    box-shadow: 0 0 8px var(--color-primary-glow);
    transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    background: var(--color-primary-hover);
}

.slider-hints {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
}

/* BUTTONS */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #059669 100%);
    border: none;
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    padding: 14px 20px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
    transition: all var(--transition-speed);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

/* CONTENT CONTAINER */
.content-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* METRIC CARDS */
.metric-deck {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.metric-card {
    background: var(--color-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--color-card-border);
    border-radius: var(--border-radius);
    padding: 20px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.metric-card.gold-border {
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.card-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--color-gold-glow) 0%, transparent 70%);
    top: -50px;
    right: -50px;
    pointer-events: none;
}

.card-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.card-icon {
    font-size: 32px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-bright);
}

.card-subtext {
    font-size: 12px;
    color: var(--color-primary);
    font-weight: 600;
}

.gold-border .card-subtext {
    color: var(--color-gold);
}

/* RESULTS GRID */
.results-container {
    background: var(--color-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--color-card-border);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* TABS */
.tab-header {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-family: var(--font-sans);
    font-size: 13.5px;
    font-weight: 600;
    padding: 16px 24px;
    cursor: pointer;
    transition: all var(--transition-speed);
    position: relative;
}

.tab-btn:hover {
    color: var(--color-text-bright);
}

.tab-btn.active {
    color: var(--color-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary-glow);
}

.tab-content {
    display: none;
    padding: 24px;
}

.tab-content.active {
    display: block;
}

/* DATA TABLES */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13.5px;
    color: var(--color-text);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table .rank-col {
    font-weight: 700;
    color: var(--color-text-muted);
}

.data-table tbody tr:nth-child(1) .rank-col {
    color: var(--color-gold);
}

.data-table tbody tr:nth-child(2) .rank-col {
    color: #e2e8f0;
}

.data-table tbody tr:nth-child(3) .rank-col {
    color: #cd7f32;
}

.name-col {
    font-weight: 600;
    color: var(--color-text-bright);
}

.right-align {
    text-align: right;
}

.prob-val {
    font-family: monospace;
    font-weight: 700;
    color: var(--color-primary);
}

.gold-val {
    color: var(--color-gold);
}

/* SPINNER & LOADING STATES */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 1s ease-in-out infinite;
}

.hidden {
    display: none !important;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utility layout adjustments */
#distPremiumGroup.disabled,
#grassPremiumGroup.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* MODAL OVERLAY & CONTAINER */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 23, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    max-height: 90vh;
    background: var(--color-bg-sidebar);
    border: 1px solid var(--color-card-border);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: translateY(-20px);
    transition: transform var(--transition-speed) ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 15px;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-bright);
}

.close-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-speed);
}

.close-btn:hover {
    color: var(--color-text-bright);
}

.modal-body {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-right: 5px;
}

.player-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-bright);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-bright);
    border-left: 4px solid var(--color-primary);
    padding-left: 10px;
    margin-bottom: 4px;
}

/* MAKE ROWS IN TABLES CLICKABLE */
.data-table tbody tr {
    cursor: pointer;
    transition: background var(--transition-speed) ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

.data-table tbody tr.placeholder-row,
.data-table tbody tr.loading-row {
    cursor: default;
}

.data-table tbody tr.placeholder-row:hover,
.data-table tbody tr.loading-row:hover {
    background: transparent !important;
}

/* TWO-COLUMN LAYOUT ON DESKTOP WIDTHS */
@media (min-width: 992px) {
    .modal-body {
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: 30px;
        overflow: hidden;
        height: 100%;
    }
    
    .player-meta-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
        align-self: start;
        overflow-y: auto;
        height: 100%;
        padding-right: 5px;
        background: transparent;
        border: none;
        padding: 0;
    }
    
    .player-meta-grid .meta-item {
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 12px;
        padding: 16px 20px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .modal-main-content {
        display: flex;
        flex-direction: column;
        gap: 15px;
        height: 100%;
        overflow: hidden;
    }
    
    .modal-main-content .table-wrapper {
        max-height: none !important; /* override inline style */
        flex-grow: 1;
        overflow-y: auto;
        border: 1px solid var(--color-card-border);
        border-radius: 8px;
    }
    
    .modal-main-content .section-title {
        margin-top: 0;
        margin-bottom: 0;
    }
}

.library-course-row {
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
}

.library-course-row:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

.library-course-row.active {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
}

.library-course-row.active:hover {
    background: rgba(16, 185, 129, 0.18) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}

/* COURSE ARCHIVE / LIBRARY MODAL LAYOUT */
.library-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    margin-top: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.library-left-pane {
    width: 100%;
    height: 220px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.library-right-pane {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(255, 255, 255, 0.01);
    height: 100%;
}

@media (min-width: 768px) {
    .library-modal-body {
        flex-direction: row;
    }
    
    .library-left-pane {
        width: 320px;
        height: 100%;
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    .library-right-pane {
        padding: 25px;
    }
}

