/**
 * Shamlock College Rankings Styles
 *
 * Paginated table styles for college sports (NCAAM, NCAAW, NCAAF)
 * Designed to handle 300+ teams efficiently
 *
 * Uses CSS variables from shamlock-sport-landing.css:
 * --sham-green: #16a34a, --sham-gold: #d6b25e, etc.
 */

/* Container - Match site's light theme (same as EPR container) */
.college-rankings-container {
    background: var(--sham-bg, #f3f4f6);
    border-radius: var(--radius, 12px);
    padding: 24px;
    margin: 24px 0;
    box-shadow: var(--shadow, 0 2px 4px rgba(0, 0, 0, 0.1));
    border-top: 4px solid var(--sham-green, #16a34a);
}

/* Header */
.college-rankings-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.rankings-title {
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.rankings-count {
    font-size: 0.85rem;
    font-weight: 400;
    color: #6b7280;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
}

/* Filters */
.rankings-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
}

.rankings-search {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #1f2937;
    padding: 10px 36px 10px 14px;
    font-size: 0.9rem;
    width: 200px;
    transition: all 0.2s ease;
}

.rankings-search:focus {
    outline: none;
    border-color: var(--sham-green, #16a34a);
    background: #ffffff;
    box-shadow: var(--focus-ring, 0 0 0 3px rgba(22, 163, 74, 0.2));
}

.rankings-search::placeholder {
    color: #6b7280; /* Darker for WCAG AA contrast */
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.5;
}

.rankings-conference-filter {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #1f2937;
    padding: 10px 14px;
    font-size: 0.9rem;
    min-width: 160px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rankings-conference-filter:focus {
    outline: none;
    border-color: var(--sham-green, #16a34a);
    box-shadow: var(--focus-ring, 0 0 0 3px rgba(22, 163, 74, 0.2));
}

.rankings-conference-filter option {
    background: #ffffff;
    color: #1f2937;
}

/* Table Wrapper */
.rankings-table-wrapper {
    overflow-x: auto;
    margin: 0 -8px;
    padding: 0 8px;
}

/* Table */
.college-rankings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.college-rankings-table thead {
    background: var(--sham-green, #16a34a);
}

.college-rankings-table th {
    color: #ffffff; /* White text */
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px;
    text-align: left;
    border-bottom: none;
    white-space: nowrap;
}

.college-rankings-table th.col-rank,
.college-rankings-table th.col-sbr,
.college-rankings-table th.col-ap,
.college-rankings-table th.col-delta {
    text-align: center;
}

.college-rankings-table th.col-logo {
    width: 40px;
}

/* Table Rows */
.rankings-row {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.15s ease;
    background: #ffffff;
}

.rankings-row:hover {
    background: #f9fafb;
}

/* Top 25 rows - no special background, just inherit default */
.rankings-row.top-25 {
    background: #ffffff;
}

.rankings-row.top-25:hover {
    background: #f9fafb;
}

.college-rankings-table td {
    padding: 12px 8px;
    color: #374151;
    vertical-align: middle;
}

/* Column Styles */
.col-rank {
    text-align: center;
    font-weight: 600;
    color: #6b7280;
    width: 50px;
}

.rankings-row:nth-child(-n+10) .col-rank {
    color: var(--sham-green, #16a34a);
}

.col-logo {
    width: 40px;
    padding: 8px !important;
}

.team-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: transparent;
}

.col-team {
    min-width: 180px;
}

.team-name {
    display: block;
    font-weight: 500;
    color: #1f2937;
}

.team-record {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

.col-conference {
    color: #4b5563;
    font-size: 0.85rem;
    min-width: 120px;
}

.col-sbr,
.col-ap,
.col-delta {
    text-align: center;
    width: 70px;
}

/* SBR Values */
.sbr-value {
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.sbr-positive {
    color: var(--sham-green, #16a34a);
}

.sbr-negative {
    color: #dc2626;
}

.sbr-neutral {
    color: #6b7280;
}

/* AP Rank */
.ap-rank {
    font-weight: 500;
}

.ap-ranked {
    color: var(--sham-green, #16a34a);
    font-weight: 600;
}

.ap-unranked {
    color: #9ca3af;
}

/* Delta */
.delta-value {
    font-weight: 500;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

.delta-up {
    color: var(--sham-green, #16a34a);
}

.delta-down {
    color: #dc2626;
}

.delta-neutral {
    color: #9ca3af;
}

/* View All / Collapse Buttons */
.rankings-view-all,
.rankings-collapse {
    text-align: center;
    margin-top: 20px;
}

.view-all-btn,
.collapse-btn {
    background: var(--sham-green, #16a34a);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-all-btn:hover,
.collapse-btn:hover {
    background: var(--sham-green-hover, #15803d);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover, 0 4px 12px rgba(22, 163, 74, 0.3));
}

.collapse-btn {
    background: #e5e7eb;
    color: #374151;
}

.collapse-btn:hover {
    background: #d1d5db;
    box-shadow: none;
}

/* Pagination */
.rankings-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination-btn {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    padding: 8px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--sham-green, #16a34a);
    border-color: var(--sham-green, #16a34a);
    color: #fff;
}

.pagination-pages {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pagination-ellipsis {
    color: #6b7280;
    padding: 0 6px;
}

.pagination-prev,
.pagination-next {
    font-weight: 500;
}

/* Loading State - Skeleton */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.college-rankings-container .skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.college-rankings-container .skeleton-row {
    height: 48px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.college-rankings-container .skeleton-rows {
    padding: 8px 0;
}

/* Error State */
.rankings-error {
    text-align: center;
    padding: 40px 20px;
}

.rankings-error p {
    color: #ef4444;
    margin-bottom: 16px;
}

.retry-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.retry-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Empty State */
.rankings-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

/* Mobile Responsive - Horizontal Scroll with All Columns */
@media (max-width: 768px) {
    .college-rankings-container {
        padding: 16px;
        margin: 16px 0;
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .college-rankings-header {
        flex-direction: column;
        align-items: stretch;
    }

    .rankings-title {
        font-size: 1.1rem;
        flex-wrap: wrap;
    }

    .rankings-filters {
        flex-direction: column;
    }

    .rankings-search {
        width: 100%;
    }

    .rankings-conference-filter {
        width: 100%;
    }

    .college-rankings-table {
        font-size: 0.85rem;
        min-width: 700px;
        table-layout: auto;
    }

    .college-rankings-table th,
    .college-rankings-table td {
        padding: 10px 6px;
        white-space: nowrap;
    }

    /* Show ALL columns with horizontal scroll */
    .col-conference {
        display: table-cell !important;
    }

    .col-delta {
        display: table-cell !important;
    }

    .col-ap {
        display: table-cell !important;
    }

    /* Stack record on mobile: "14-2" on top, "(3-0)" on bottom */
    .col-record {
        font-size: 0.8rem;
    }

    .col-record .record-overall {
        display: block;
    }

    .col-record .record-conf {
        display: block;
        color: #6b7280;
        font-size: 0.75rem;
    }

    /* Hide mascot on mobile, show only school name */
    .team-mascot {
        display: none;
    }

    .team-logo {
        width: 28px;
        height: 28px;
    }

    .pagination-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .view-all-btn,
    .collapse-btn {
        width: 100%;
        padding: 14px 20px;
    }
}

@media (max-width: 480px) {
    /* Keep ALL columns visible - horizontal scroll handles overflow */
    .col-ap {
        display: table-cell !important;
    }

    .col-conference {
        display: table-cell !important;
    }

    .col-delta {
        display: table-cell !important;
    }

    .college-rankings-table th.col-team,
    .college-rankings-table td.col-team {
        min-width: 120px;
    }
}

/* ========================================
   GATING: Premium Member Styles
   Per gating spec v2: Sample tiles shown to non-members
   ======================================== */

/* Sample row indicator for non-members */
.sample-row {
    position: relative;
}

.sample-row::after {
    content: 'Sample';
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--sham-gold, #d6b25e);
    color: #000;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

/* SBR Gating CTA - matches paid-picks.css styling */
.college-rankings-container .sbr-gating-cta {
    text-align: center;
    padding: 24px;
    background: #ffffff;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #d1d5db;
}

.college-rankings-container .sbr-gating-cta p {
    color: #1f2937;
    margin: 0 0 16px 0;
    font-size: 1rem;
}

.college-rankings-container .shamlock-upgrade-btn {
    display: inline-block;
    background: var(--sham-gold, #d6b25e);
    color: #000;
    font-weight: 600;
    padding: 12px 30px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
}

.college-rankings-container .shamlock-upgrade-btn:hover {
    background: var(--sham-gold-muted, #bfa76a);
    transform: translateY(-2px);
}
