/* ===================================================================
 * PGA Course Fit Rankings
 * Same Ship It Nation styling as the Projections plugins (Tahoma, white
 * surface, navy bold names, black numerics, blue topbar). Single flat
 * table: Name / Salary / Ranking — no site switcher, position chips, or
 * games row.
 * =================================================================== */

.shipit-pga-cf {
    /* Palette mirrored from the cheat sheet slate-plan CSS */
    --snp-primary:      #0033A0;    /* Ship It blue */
    --snp-primary-dark: #102b55;
    --snp-accent:       #F9B904;    /* Ship It gold (refresh flash) */
    --snp-dk:           #f7941d;    /* DraftKings orange (legacy) */
    --snp-fd:           #1493ff;    /* FanDuel blue (legacy) */
    --snp-line:         #d9e1ef;
    --snp-line-soft:    #eef2f8;
    --snp-soft:         #f6f8fc;
    --snp-text:         #121722;
    --snp-text-dark:    #0d1117;
    --snp-text-muted:   #8490a4;
    --snp-text-name:    #173d7d;
    --snp-bg-topbar:    #f5f6fa;
    --snp-bg-thead:     #fbfcff;
    --snp-bg-row-hover: #f8faff;
    --snp-border-soft:  #e0e3eb;

    color: var(--snp-text);
    font-family: Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0;
}
.shipit-pga-cf *,
.shipit-pga-cf table,
.shipit-pga-cf button,
.shipit-pga-cf input,
.shipit-pga-cf select {
    box-sizing: border-box;
    font-family: Tahoma, Geneva, Verdana, sans-serif;
}

/* ----- Loading / error ----- */
.snp-status {
    padding: 32px;
    text-align: center;
    color: var(--snp-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-style: italic;
}
.snp-status.error { color: #b91c1c; font-style: normal; }
.snp-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--snp-line);
    border-top-color: var(--snp-primary);
    border-radius: 50%;
    animation: snp-spin 0.8s linear infinite;
}
@keyframes snp-spin { to { transform: rotate(360deg); } }

/* ----- Top bar (Ship It blue) ----- */
.snp-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--snp-primary);
    border: 1px solid var(--snp-primary);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.snp-label {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: rgba(255, 255, 255, 0.78);
}
.snp-btns {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}
.snp-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 7px;
    background: #ffffff;
    color: #374151;
    font: 900 12px Tahoma, Geneva, Verdana, sans-serif;
    padding: 6px 14px;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s, transform 0.05s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}
.snp-btn:hover {
    background: #f0f4ff;
    color: var(--snp-primary);
}
.snp-btn:active { transform: translateY(1px); }
.snp-btn.active.dk,
.snp-btn.active.fd {
    background: #0d1117;
    border-color: #0d1117;
    color: #ffffff;
}
.snp-btn.active.dk:hover,
.snp-btn.active.fd:hover {
    background: #1d2435;
    border-color: #1d2435;
    color: #ffffff;
}

.snp-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.snp-updated {
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    padding: 3px 7px;
    border-radius: 4px;
    transition: background 0.4s ease, color 0.4s ease;
}
.snp-updated.just-refreshed {
    background: var(--snp-accent);
    color: #1a1300;
    animation: snp-ts-flash 1.8s ease-out;
}
@keyframes snp-ts-flash {
    0%   { background: #ffffff;       color: #0d1117; }
    25%  { background: var(--snp-accent); color: #1a1300; }
    100% { background: rgba(255,255,255,0); color: rgba(255,255,255,0.78); }
}
.snp-refresh { background: #ffffff; }
.snp-refresh.is-busy .snp-icon svg {
    animation: snp-spin 0.8s linear infinite;
}

.snp-export-group {
    display: inline-flex;
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid #d1d5db;
    background: #ffffff;
}
.snp-export-group .snp-btn {
    border-radius: 0;
    border: 0;
    border-right: 1px solid #d1d5db;
    background: transparent;
}
.snp-export-group .snp-btn:last-child { border-right: 0; }
.snp-export-group .snp-btn:hover {
    background: #f0f4ff;
    color: var(--snp-primary);
}

.snp-icon { display: inline-flex; align-items: center; }
.snp-icon svg { display: block; }

/* ----- Section title + hover-info tooltip (left of the blue bar) ----- */
.snp-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;            /* tight — the "i" sits right next to the title */
    position: relative;
}
.snp-title {
    color: #ffffff;
    font: 900 18px/1.2 Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.2px;
}
.snp-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #ffffff;      /* solid white */
    opacity: 1;
    cursor: help;
    transition: opacity 0.12s;
}
.snp-info svg { width: 15px; height: 15px; display: block; }
.snp-info:hover,
.snp-info:focus { opacity: 1; color: #ffffff; outline: 0; }   /* stays white */
/* Dark tooltip — matches the MLB Roth tooltip (#111827 bg, white text). */
.snp-tooltip {
    position: absolute;
    top: calc(100% + 11px);
    left: 0;
    z-index: 99999;
    width: min(360px, 90vw);
    background: #111827;
    color: #ffffff;
    border: 0;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    padding: 12px 14px;
    font: 400 12px/1.55 Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.1px;
    text-transform: none;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    pointer-events: none;
}
/* Little caret pointing up at the icon. */
.snp-tooltip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 14px;
    border: 7px solid transparent;
    border-bottom-color: #111827;
}
/* Force white text on the paragraphs — the host theme's ".sin-slate-plan-pga *
   {color:#000}" hits these <p> directly and beats the container's inherited white,
   so we set color on the <p> with higher specificity. */
.shipit-pga-cf .snp-tooltip,
.shipit-pga-cf .snp-tooltip p,
.shipit-pga-cf .snp-tooltip * { color: #ffffff; }
.snp-tooltip p { margin: 0 0 10px; }
.snp-tooltip p:last-child { margin-bottom: 0; }
.snp-title-wrap:hover .snp-tooltip,
.snp-info:focus .snp-tooltip,
.snp-title-wrap.tip-open .snp-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* ----- Expandable Find Golfer search (MLB-style) ----- */
.snp-topbar-search {
    display: inline-flex;
    align-items: center;
}
/* Icon-only button — fixed square so the magnifier is dead-centered. */
.snp-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 34px;
    height: 32px;
    padding: 0;
    line-height: 1;
}
.snp-search-toggle .snp-icon { line-height: 0; }
/* Magnifier color — the path uses currentColor, but the host theme's
   ".sin-slate-plan-pga *{color:#000}" forces it black, so set fill directly
   and let it follow the button state (dark idle, blue hover, white when open). */
.shipit-pga-cf .snp-search-toggle svg path { fill: #374151; }
.shipit-pga-cf .snp-search-toggle:hover svg path { fill: var(--snp-primary); }
.shipit-pga-cf .snp-search-toggle.is-active svg path { fill: #ffffff; }
.snp-search-toggle.is-active {
    background: #0d1117;
    color: #ffffff;
    border-color: #0d1117;
}
.snp-search-toggle.is-active:hover {
    background: #1d2435;
    color: #ffffff;
}
/* Collapsed: the input is zero-width and invisible until the wrap is open. */
.snp-topbar-search .snp-search {
    width: 0;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    border-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.2s ease, opacity 0.15s ease, padding 0.2s ease, margin 0.2s ease;
}
.snp-topbar-search.is-open .snp-search {
    width: 220px;
    margin-left: 8px;
    padding: 6px 12px;
    border-width: 1px;
    opacity: 1;
}

/* ----- Paginated footer — matches the MLB Hitter Rankings pager exactly ----- */
.shipit-pga-cf .sin-rank-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #0b0f18;
    color: #FFFFFF;
    padding: 10px 14px;
    font-size: 13px;
    flex-wrap: wrap;
}
.shipit-pga-cf .sin-rank-pager-info { font-weight: 500; letter-spacing: .2px; color: #FFFFFF; }
.shipit-pga-cf .sin-rank-pager-controls { display: flex; align-items: center; gap: 8px; }
.shipit-pga-cf .sin-rank-pager-label {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #9aa7c0;
    font-weight: 700;
}
.shipit-pga-cf .sin-rank-pager-size {
    background: #FFFFFF;
    color: #0b0f18;
    border: 1px solid #FFFFFF;
    border-radius: 4px;
    font-weight: 700;
    padding: 3px 6px;
    font-size: 12px;
    cursor: pointer;
}
.shipit-pga-cf .sin-rank-pager-btn {
    appearance: none;
    background: transparent;
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 4px;
    font: 700 12px Tahoma, Geneva, Verdana, sans-serif;
    padding: 4px 10px;
    cursor: pointer;
    min-width: 30px;
    line-height: 1.1;
}
.shipit-pga-cf .sin-rank-pager-btn:hover:not(.disabled):not(.active) {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .35);
}
.shipit-pga-cf .sin-rank-pager-btn.active {
    background: #FFFFFF;
    color: #0b0f18;
    border-color: #FFFFFF;
    cursor: default;
}
.shipit-pga-cf .sin-rank-pager-btn.disabled,
.shipit-pga-cf .sin-rank-pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.shipit-pga-cf .sin-rank-pager-ellipsis { color: #9aa7c0; padding: 0 2px; }
/* Round the footer's bottom corners to the table-wrap. */
.shipit-pga-cf .snp-table-wrap .sin-rank-pager {
    border-bottom-left-radius: 9px;
    border-bottom-right-radius: 9px;
}
@media (max-width: 640px) {
    .shipit-pga-cf .sin-rank-pager { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 12px; font-size: 12px; }
    .shipit-pga-cf .sin-rank-pager-info { width: 100%; text-align: left; }
    .shipit-pga-cf .sin-rank-pager-controls { width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
    .shipit-pga-cf .sin-rank-pager-btn { min-width: 36px; min-height: 34px; padding: 6px 10px; font-size: 13px; }
    .shipit-pga-cf .sin-rank-pager-size { min-height: 34px; font-size: 13px; padding: 4px 8px; }
}

/* ----- Search input base styling -----
   NOTE: the obsolete always-visible filter-bar rules were removed here. They set
   ".snp-topbar-search .snp-search{width:220px}" which (appearing after the collapse
   rule) kept the collapsed input 220px wide + invisible, leaving a phantom gap that
   pushed the magnifier toward the middle. The expandable-search rules above own the
   width now. */
.snp-search {
    background: #ffffff;
    color: var(--snp-text-dark);
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 6px 12px;
    font: 700 13px Tahoma, Geneva, Verdana, sans-serif;
    width: 240px;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.snp-search:focus {
    outline: 0;
    border-color: var(--snp-primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 160, 0.12);
}
.snp-search::placeholder { color: var(--snp-text-muted); font-weight: 400; }

/* ----- Table ----- */
.snp-table-wrap {
    overflow-x: auto;
    border: 1px solid #eef0f4;
    border-radius: 9px;
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(6, 17, 31, 0.03);
}
.snp-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 15px;
    /* Guard against site reset.css adding a default margin to <table>. */
    margin: 0 !important;
    margin-block-end: 0 !important;
}
.snp-table thead tr { background: #0d1117; }
.snp-th {
    font-size: 11px;
    text-align: left;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 900;
    padding: 9px 10px 8px;
    background: #0d1117;
    border-bottom: 0;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s, color 0.12s;
}
.snp-th:hover { background: #1d2435; }
.snp-th.active {
    background: var(--snp-primary);
    color: #ffffff;
}
.snp-th.align-right  { text-align: right; }
.snp-th.align-center { text-align: center; }

.snp-row td {
    padding: 6px 10px;
    border-bottom: 1px solid #f4f6fa;
    vertical-align: middle;
    white-space: nowrap;
    color: var(--snp-text-dark);
    font-weight: 400;
}
.snp-row:last-child td { border-bottom: 0; }
.snp-row:hover td { background: var(--snp-bg-row-hover); }

.snp-c-name {
    font-weight: 900;
    color: var(--snp-text-name);
    white-space: normal;
    min-width: 200px;
    font-size: 1.02em;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.25;
}
.snp-c-num {
    color: var(--snp-text-dark);
    font-variant-numeric: tabular-nums;
    font-weight: 400;
}
.align-left   { text-align: left;   }
.align-right  { text-align: right;  }
.align-center { text-align: center; }

.snp-empty {
    text-align: center;
    color: var(--snp-text-muted);
    padding: 28px;
    font-style: italic;
}

/* ----- Pagination (black footer) ----- */
.snp-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    background: #0d1117;
    border-top: 0;
    color: #ffffff;
}
.snp-page-info {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 700;
}
.snp-page-right {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.snp-page-size-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.snp-page-size {
    background-color: #1d2435;
    color: #ffffff;
    border: 1px solid #2a3450;
    border-radius: 6px;
    padding: 4px 22px 4px 8px;
    font: 900 12px Tahoma, Geneva, Verdana, sans-serif;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 6px center;
    text-transform: none;
    letter-spacing: 0;
}
.snp-page-size option {
    background: #ffffff;
    color: var(--snp-text-dark);
}
.snp-page-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.snp-page-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid #2a3450;
    border-radius: 6px;
    background: #1d2435;
    color: #ffffff;
    font: 900 12px Tahoma, Geneva, Verdana, sans-serif;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.snp-page-btn:hover:not(.disabled):not(.active) {
    background: #2a3450;
    border-color: #3a4570;
    color: #ffffff;
}
.snp-page-btn.active {
    background: var(--snp-primary);
    border-color: var(--snp-primary);
    color: #ffffff;
    cursor: default;
}
.snp-page-btn.disabled,
.snp-page-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    background: #1d2435 !important;
    border-color: #2a3450 !important;
    color: #ffffff !important;
    transition: none;
}
.snp-page-btn.disabled:hover,
.snp-page-btn[disabled]:hover,
.snp-page-btn.disabled:focus,
.snp-page-btn[disabled]:focus {
    background: #1d2435 !important;
    border-color: #2a3450 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}
.snp-page-ellipsis {
    padding: 0 4px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 900;
}

/* ----- Toasts ----- */
.sin-proj-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    font-family: Tahoma, Geneva, Verdana, sans-serif;
}
.sin-proj-toast {
    background: #ffffff;
    color: var(--snp-text-dark, #121722);
    border: 1px solid var(--snp-line, #d9e1ef);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 10px 32px rgba(6, 17, 31, 0.18);
    min-width: 260px;
    max-width: 360px;
    transform: translateX(20px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    pointer-events: auto;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}
.sin-proj-toast.show { transform: translateX(0); opacity: 1; }
.sin-proj-toast.hide { transform: translateX(20px); opacity: 0; }
.sin-proj-toast-warn    { border-left: 4px solid #f7941d; }
.sin-proj-toast-error   { border-left: 4px solid #ef4444; color: #991b1b; }
.sin-proj-toast-success { border-left: 4px solid #047857; }

/* ----- Responsive ----- */

/* Tablet — compress padding, allow topbar to wrap. */
@media (max-width: 820px) {
    .shipit-pga-cf { font-size: 13px; }
    .snp-topbar { padding: 8px 10px; gap: 8px; row-gap: 8px; }
    .snp-actions { gap: 8px; }
    .snp-export-group .snp-btn { padding: 6px 10px; }
    .snp-search { width: 200px; }
    .snp-c-name { min-width: 170px; }
    .snp-th, .snp-row td { padding-left: 8px; padding-right: 8px; }
}

/* Phone — stack everything cleanly. */
@media (max-width: 640px) {
    .shipit-pga-cf { font-size: 13px; padding: 0 6px; }
    .snp-topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
    }
    .snp-actions {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
        gap: 6px;
        flex-wrap: wrap;
    }
    .snp-title-wrap { width: 100%; }
    .snp-title { font-size: 16px; }
    .snp-updated {
        order: -1;
        width: 100%;
        text-align: center;
        font-size: 11px;
        padding: 4px 6px;
    }
    .snp-label { display: none; }
    .snp-btns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
    .snp-btns .snp-btn { justify-content: center; padding: 8px 10px; }
    .snp-refresh, .snp-export-group { flex: 1 1 auto; }
    .snp-refresh { justify-content: center; }
    .snp-export-group { display: inline-flex; }
    .snp-export-group .snp-btn { flex: 1 1 33%; justify-content: center; }

    /* Search collapses behind the magnifier just like desktop; only the open
       state takes full width so the input doesn't shove the exports off-row. */
    .snp-search-wrap { margin-left: 0; }
    .snp-topbar-search.is-open { flex: 1 1 100%; width: 100%; }
    .snp-topbar-search.is-open .snp-search { width: 100%; }
    .snp-tooltip { width: min(560px, 92vw); }

    /* Sticky name column while scrolling horizontally. */
    .snp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .snp-th:first-child,
    .snp-row .snp-c-name {
        position: sticky;
        left: 0;
        z-index: 2;
        background: #ffffff;
        border-right: 2px solid #d1d5db;
    }
    .snp-th:first-child {
        background: #0d1117;
        border-right: 2px solid #2a3450;
    }
    .snp-th.active:first-child {
        background: var(--snp-primary);
        border-right: 2px solid var(--snp-primary-dark);
    }
    .snp-row:hover .snp-c-name { background: var(--snp-bg-row-hover); }
    .snp-c-name {
        min-width: 170px;
        max-width: 220px;
        font-size: 0.95em;
        line-height: 1.25;
        padding-right: 10px;
        overflow-wrap: break-word;
    }

    .snp-th, .snp-row td {
        padding: 7px 8px;
        border-right: 1px solid #eef0f4;
    }
    .snp-th { border-right: 1px solid #1d2435; }
    .snp-th:last-child, .snp-row td:last-child { border-right: 0; }

    /* Pagination: compress info + nav to single line */
    .snp-pagination { padding: 8px 10px; gap: 8px; }
    .snp-page-info { width: 100%; text-align: center; font-size: 11px; }
    .snp-page-right { width: 100%; justify-content: space-between; gap: 8px; }
    .snp-page-nav .snp-page-btn:not(.active):not([data-edge]) { display: none; }
    .snp-page-nav .snp-page-ellipsis { display: none; }
}

/* Tiny phones */
@media (max-width: 380px) {
    .snp-export-group .snp-btn { padding: 6px 8px; font-size: 11px; }
    .snp-c-name {
        min-width: 140px;
        max-width: 170px;
        font-size: 0.9em;
    }
    .snp-th, .snp-row td { padding: 7px 6px; }
}
