/*
 * FFoA Leaderboard & Points System
 * Styles for [ffoa_leaderboard] shortcode and admin pages
 *
 * Color palette: FFoA brand (teal/dark-navy/white)
 */

/* ---------------------------------------------------------------
   Container
---------------------------------------------------------------- */
.ffoa-leaderboard {
    max-width: 900px;
    margin: 0 auto;
    font-family: inherit;
}

/* ---------------------------------------------------------------
   Leaderboard Controls (dropdowns)
---------------------------------------------------------------- */
.ffoa-lb-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    align-items: flex-end;
}

.ffoa-lb-control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ffoa-lb-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ffoa-lb-select {
    padding: 8px 32px 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    /* custom caret arrow */
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    min-width: 180px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ffoa-lb-select:hover {
    border-color: #007b8a;
}

.ffoa-lb-select:focus {
    outline: none;
    border-color: #007b8a;
    box-shadow: 0 0 0 3px rgba(0,123,138,0.15);
}

/* ---------------------------------------------------------------
   Panel
---------------------------------------------------------------- */
.ffoa-lb-panel {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ---------------------------------------------------------------
   Headings
---------------------------------------------------------------- */
.ffoa-lb-heading {
    font-size: 20px;
    font-weight: 700;
    color: #1a3040;
    margin: 0 0 16px;
}

.ffoa-lb-sub-heading {
    font-size: 16px;
    font-weight: 600;
    color: #1a3040;
    margin: 24px 0 12px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

/* ---------------------------------------------------------------
   Scrollable Table Container
---------------------------------------------------------------- */
.ffoa-lb-table-scroll {
    max-height: 570px;
    overflow-y: auto;
}

/* ---------------------------------------------------------------
   Leaderboard Table
---------------------------------------------------------------- */
.ffoa-lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ffoa-lb-table th {
    background: #f0f6f7;
    color: #1a3040;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #cde8eb;
}

.ffoa-lb-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.ffoa-lb-table tr:hover td {
    background: #f7fbfc;
}

.ffoa-lb-table tr.ffoa-lb-top3 td {
    background: #fdfaf0;
}

.ffoa-lb-table tr.ffoa-lb-me td {
    background: #e8f6f8;
    font-weight: 600;
}

/* ---------------------------------------------------------------
   Avatar
---------------------------------------------------------------- */
.ffoa-lb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 8px;
}

.ffoa-lb-you {
    font-size: 12px;
    color: #007b8a;
    font-style: italic;
}

/* ---------------------------------------------------------------
   Medals
---------------------------------------------------------------- */
.ffoa-lb-medal {
    font-size: 18px;
}

.ffoa-lb-medal.gold { color: #d4a017; }
.ffoa-lb-medal.silver { color: #8a8a8a; }
.ffoa-lb-medal.bronze { color: #b87333; }

/* ---------------------------------------------------------------
   My Rank Note
---------------------------------------------------------------- */
.ffoa-lb-my-rank-note {
    margin-top: 12px;
    padding: 10px 16px;
    background: #e8f6f8;
    border-radius: 4px;
    font-size: 13px;
    color: #1a3040;
}

/* ---------------------------------------------------------------
   My Stats Grid
---------------------------------------------------------------- */
.ffoa-lb-my-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .ffoa-lb-my-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.ffoa-lb-stat-card {
    background: #f0f6f7;
    border: 1px solid #cde8eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.ffoa-lb-stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #007b8a;
    line-height: 1.2;
}

.ffoa-lb-stat-card .stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------
   Points Breakdown
---------------------------------------------------------------- */
.ffoa-lb-breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.ffoa-lb-breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fafafa;
    border-radius: 4px;
    border: 1px solid #eee;
    font-size: 14px;
}

.ffoa-lb-breakdown-row .bd-label {
    color: #333;
}

.ffoa-lb-breakdown-row .bd-pts {
    font-weight: 600;
    color: #007b8a;
}

/* ---------------------------------------------------------------
   Badges Grid
---------------------------------------------------------------- */
.ffoa-lb-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ffoa-lb-badge {
    width: 90px;
    text-align: center;
    padding: 10px 6px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #fff;
    transition: box-shadow 0.15s;
    cursor: default;
}

.ffoa-lb-badge:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.ffoa-lb-badge-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 6px;
}

.ffoa-lb-badge-label {
    font-size: 11px;
    font-weight: 600;
    color: #1a3040;
    line-height: 1.3;
}

.ffoa-lb-badge-date {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

/* ---------------------------------------------------------------
   Login CTA
---------------------------------------------------------------- */
.ffoa-lb-login-cta {
    text-align: center;
    padding: 40px 20px;
}

.ffoa-lb-login-cta h2 {
    font-size: 24px;
    color: #1a3040;
    margin-bottom: 12px;
}

.ffoa-lb-login-cta p {
    font-size: 15px;
    color: #555;
    max-width: 480px;
    margin: 0 auto 24px;
    line-height: 1.6;
}

.ffoa-lb-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin: 0 6px;
    border: 2px solid #007b8a;
    color: #007b8a;
    transition: all 0.15s;
}

.ffoa-lb-btn:hover {
    background: #e8f6f8;
}

.ffoa-lb-btn.ffoa-lb-btn-primary {
    background: #007b8a;
    color: #fff;
}

.ffoa-lb-btn.ffoa-lb-btn-primary:hover {
    background: #005f6e;
    border-color: #005f6e;
}

/* ---------------------------------------------------------------
   Empty state
---------------------------------------------------------------- */
.ffoa-lb-empty {
    padding: 30px;
    text-align: center;
    color: #888;
    font-size: 14px;
    font-style: italic;
}

/* ---------------------------------------------------------------
   Admin styles (shared class ffoa-lb-admin)
---------------------------------------------------------------- */
.ffoa-lb-admin h1 {
    margin-bottom: 16px;
}

.ffoa-lb-admin .widefat th {
    font-weight: 600;
}

/* ---------------------------------------------------------------
   How to Earn Points (collapsible panel)
---------------------------------------------------------------- */
.ffoa-lb-how-to {
    margin: 0 0 20px;
    border: 1px solid #dce6f0;
    border-radius: 8px;
    background: #f6f9fd;
}

.ffoa-lb-how-to-toggle {
    padding: 11px 16px;
    font-weight: 600;
    font-size: 0.92rem;
    color: #1a4a8a;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.ffoa-lb-how-to-toggle::-webkit-details-marker { display: none; }

.ffoa-lb-how-to-toggle::after {
    content: '▾';
    margin-left: auto;
    transition: transform 0.2s;
    font-style: normal;
}

.ffoa-lb-how-to[open] .ffoa-lb-how-to-toggle::after {
    transform: rotate(-180deg);
}

.ffoa-lb-how-to-body {
    padding: 4px 16px 16px;
    border-top: 1px solid #dce6f0;
}

.ffoa-lb-earn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.ffoa-lb-earn-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fff;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid #e4ecf5;
}

.ffoa-lb-earn-item .earn-icon {
    font-size: 1.35rem;
    flex-shrink: 0;
    line-height: 1.2;
}

.ffoa-lb-earn-item .earn-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ffoa-lb-earn-item .earn-text strong {
    font-size: 0.87rem;
    color: #1a2a4a;
}

.ffoa-lb-earn-item .earn-text span {
    font-size: 0.78rem;
    color: #5a6a7a;
    line-height: 1.4;
}

/* ---------------------------------------------------------------
   Hero/Welcome Section
---------------------------------------------------------------- */
.ffoa-lb-hero {
    background: linear-gradient(135deg, #007b8a 0%, #005a66 100%);
    border-radius: 12px;
    padding: 40px 32px;
    margin-bottom: 32px;
    color: #fff;
    text-align: center;
}

.ffoa-lb-hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.ffoa-lb-hero-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 16px;
    line-height: 1.2;
}

.ffoa-lb-hero-text {
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 24px;
    opacity: 0.95;
}

.ffoa-lb-hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.ffoa-lb-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.ffoa-lb-btn-primary {
    background: #fff;
    color: #007b8a;
}

.ffoa-lb-btn-primary:hover {
    background: #f0f6f7;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.ffoa-lb-btn-secondary {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}

.ffoa-lb-btn-secondary:hover {
    background: rgba(255,255,255,0.25);
}

@media (max-width: 600px) {
    .ffoa-lb-hero {
        padding: 28px 20px;
    }
    
    .ffoa-lb-hero-title {
        font-size: 24px;
    }
    
    .ffoa-lb-hero-text {
        font-size: 14px;
    }
}

/* ---------------------------------------------------------------
   Personal Stats Widget
---------------------------------------------------------------- */
.ffoa-lb-personal-stats {
    background: #f0f6f7;
    border: 2px solid #cde8eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.ffoa-lb-stats-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a3040;
    margin: 0 0 16px;
    text-align: center;
}

.ffoa-lb-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .ffoa-lb-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .ffoa-lb-stats-grid {
        grid-template-columns: 1fr;
    }
}

.ffoa-lb-stat-item {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    border: 1px solid #dce8ea;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ffoa-lb-stat-item .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #007b8a;
    line-height: 1.1;
}

.ffoa-lb-stat-item .stat-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------
   Enhanced Empty States
---------------------------------------------------------------- */
.ffoa-lb-empty {
    text-align: center;
    padding: 48px 24px;
    color: #666;
}

.ffoa-lb-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a3040;
    margin: 0 0 12px;
}

.ffoa-lb-empty-text {
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 24px;
    color: #555;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.ffoa-lb-empty .ffoa-lb-btn {
    margin-top: 8px;
}

/* Old empty state (backwards compatibility) */
p.ffoa-lb-empty {
    padding: 32px 16px;
}

/* ---------------------------------------------------------------
   My Stats Detailed View
---------------------------------------------------------------- */
.ffoa-lb-mystats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.ffoa-lb-mystats-card {
    background: #f9fbfc;
    border: 1px solid #e0e8ea;
    border-radius: 8px;
    padding: 20px;
}

.ffoa-lb-mystats-card .card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a3040;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e8ea;
}

.ffoa-lb-mystats-card .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.ffoa-lb-mystats-card .stat-row:last-child {
    border-bottom: none;
}

.ffoa-lb-mystats-card .stat-label {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.ffoa-lb-mystats-card .stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #007b8a;
}

.ffoa-lb-mystats-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* Badges in My Stats */
.ffoa-lb-badges-card {
    grid-column: 1 / -1;
}

.ffoa-lb-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.ffoa-lb-badge {
    background: #fff;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.2s;
}

.ffoa-lb-badge:hover {
    transform: translateY(-2px);
}

.ffoa-lb-badge .badge-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    align-self: center;
    border-radius: 4px;
}

.ffoa-lb-badge .badge-name {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

/* ---------------------------------------------------------------
   Progress Bar (for course progress)
---------------------------------------------------------------- */
.ffoa-lb-progress-bar {
    height: 8px;
    background: #e0e8ea;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.ffoa-lb-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007b8a 0%, #00a0b3 100%);
    transition: width 0.3s ease;
}

.ffoa-lb-progress-text {
    font-size: 12px;
    color: #666;
    font-weight: 600;
}

/* ---------------------------------------------------------------
   Login Prompt
---------------------------------------------------------------- */
.ffoa-lb-login-prompt {
    text-align: center;
    padding: 48px 24px;
}

.ffoa-lb-login-prompt a {
    color: #007b8a;
    text-decoration: underline;
    font-weight: 600;
}

.ffoa-lb-login-prompt a:hover {
    color: #005a66;
}
