/**
 * dfd-unite.css
 *
 * Styles for the three DFD Unite widgets.
 *
 * Uses kd- namespace throughout — avoids conflicts with old mittun-* styles
 * from ClassyPress / the previous Mittun agency theme work.
 *
 * Color variables (--color-yellow, --color-blue, --color-dark) are defined
 * in the salient-child style.css :root block. Hex fallbacks are included
 * in case of any cascade edge cases.
 */


/* =============================================================================
   FONT IMPORT — Helvetica Neue (self-hosted, scoped to plugin)
   ============================================================================= */

@font-face {
    font-family: 'DFD-HelveticaNeue';
    src: url('../fonts/HelveticaNeue.ttc') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'DFD-HelveticaNeue';
    src: url('../fonts/HelveticaNeueLTStd-BdCn.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


/* =============================================================================
   BASE — inherit theme fonts automatically
   ============================================================================= */

.dfd-widget,
.dfd-widget * {
    font-family: var(--font-body, inherit);
}

.dfd-widget .dfd-board-title,
.dfd-widget .dfd-entry-name,
.dfd-widget .dfd-podium-amount,
.dfd-widget .dfd-entry-amount,
.dfd-widget .dfd-stat-value,
.dfd-widget .dfd-stat-label {
    font-family: var(--font-heading, inherit);
}

/* Podium name and progress bar labels use self-hosted Helvetica Neue */
.dfd-widget .dfd-podium-name,
.dfd-progress-bar .kd-thermometer-titles,
.dfd-progress-bar .kd-thermometer-titles * {
    font-family: 'DFD-HelveticaNeue', Helvetica, Arial, sans-serif !important;
}


/* =============================================================================
   BAR ANIMATION
   Width animates from 0 to --bar-width when .dfd-animate class is added.
   JS adds that class via IntersectionObserver so it fires when visible,
   not on DOMContentLoaded — required for WP Bakery entrance animations.
   ============================================================================= */

@keyframes dfd-grow {
    from { width: 0; }
    to   { width: var(--bar-width, 0%); }
}


/* =============================================================================
   LOADING / ERROR / EMPTY STATES
   ============================================================================= */

.dfd-widget .dfd-loading {
    color: var(--text-muted, #666);
    font-size: 14px;
    padding: 12px 0;
}

.dfd-widget .dfd-error,
.dfd-widget .dfd-empty {
    color: var(--text-muted, #666);
    font-size: 16px;
    padding: 12px 0;
    margin: 0;
}


/* =============================================================================
   PROGRESS BAR — layout
   ============================================================================= */

/* Flex column so bar is on top, labels below */
.dfd-progress-bar .kd-thermometer-container {
    display: flex;
    flex-direction: column;
}

/* Bar track */
.dfd-progress-bar .kd-thermometer {
    order: 1;
    margin: 0;
    padding: 0;
    min-height: 36px;
    border-radius: 100px;
    height: 68px;
    border: 4px solid var(--color-dark, #1a1a1a);
    background-color: #e0e0e0;
    overflow: hidden;
}

@media screen and (max-width: 768px) {
    .dfd-progress-bar .kd-thermometer {
        height: 40px;
    }
}

/* Filled portion — starts at 0; .dfd-animate triggers the grow keyframe */
.dfd-progress-bar .kd-thermometer-progress {
    border-radius: 100px;
    height: 100%;
    position: relative;
    width: 0%;
}

.dfd-progress-bar .kd-thermometer-progress.dfd-animate {
    animation: dfd-grow 1.2s ease-out forwards;
}


/* Labels row — below the bar */
.dfd-progress-bar .kd-thermometer-titles {
    order: 2;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    margin-top: 8px;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-dark, #1a1a1a);
}

.dfd-progress-bar .kd-thermometer-value,
.dfd-progress-bar .kd-thermometer-goal,
.dfd-progress-bar .kd-thermometer-value span,
.dfd-progress-bar .kd-thermometer-goal span {
    color: var(--color-dark, #1a1a1a);
    position: static;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

/* Dollars bar labels */
#dfd-progress-bar-dollars .kd-thermometer-value span::before {
    content: "Raised: ";
    
}

#dfd-progress-bar-dollars .kd-thermometer-goal span::before {
    content: "Goal: ";
}

/* Ducks bar labels */
#dfd-progress-bar-ducks .kd-thermometer-value span::before {
    content: "Remaining: ";
}

#dfd-progress-bar-ducks .kd-thermometer-goal span::before {
    content: "Goal: ";
}

/* Marker icon — shared size, image set per-type below */
.dfd-progress-bar .kd-thermometer-progress-marker {
    background-size: contain;
    background-repeat: no-repeat;
    background-color: transparent;
    height: 60px;
    width: 60px;
    float: right;
}

@media screen and (max-width: 768px) {
    .dfd-progress-bar .kd-thermometer-progress-marker {
        height: 50px;
        width: 50px;
    }
}

/* Mobile: stack labels vertically */
@media screen and (max-width: 767px) {
    .dfd-progress-bar .kd-thermometer-titles {
        flex-direction: column;
        font-size: 16px;
    }

    .dfd-progress-bar .kd-thermometer-value span,
    .dfd-progress-bar .kd-thermometer-goal span {
        font-size: 16px;
    }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
    .dfd-progress-bar .kd-thermometer-titles {
        font-size: 20px;
    }
}


/* =============================================================================
   PROGRESS BAR — dollar type (yellow fill, dollar icon marker)
   ============================================================================= */

#dfd-progress-bar-dollars .kd-thermometer-progress {
    background-color: var(--color-yellow, #FFDE17);
}

#dfd-progress-bar-dollars .kd-thermometer-progress-marker {
    background-image: url('../img/dollar-icon.png');
    background-size: 80%;
    background-position: center;
}


/* =============================================================================
   PROGRESS BAR — duck type (blue fill, duck logo marker)
   ============================================================================= */

#dfd-progress-bar-ducks .kd-thermometer-progress {
    background-color: var(--color-blue, #26ACE2);
}

#dfd-progress-bar-ducks .kd-thermometer-progress-marker {
    background-image: url('../img/duck-logo.png');
}


/* =============================================================================
   LEADERBOARD
   ============================================================================= */

.dfd-widget.leaderboard-wrapper {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
}

.dfd-widget .dfd-entries {
    display: flex;
    flex-direction: column;
}

/* Entry row */
.dfd-widget .dfd-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.dfd-widget .dfd-entry:hover {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
}

.dfd-widget .dfd-entry:last-child {
    border-bottom: none;
}

/* Rank number — hidden on standard leaderboard, visible in podium list */
.dfd-widget[data-widget="leaderboard"] .dfd-rank {
    display: none;
}

.dfd-widget[data-widget="leaderboard-podium"] .dfd-rank {
    font-size: 12px;
    font-weight: 700;
    color: #bbb;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Avatar circle */
.dfd-widget .dfd-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--color-yellow, #FFDE17);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dfd-widget .dfd-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dfd-widget .dfd-avatar .dfd-avatar-logo {
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-size: 70%;
    background-position: center;
}

/* Name + amount + bar */
.dfd-widget .dfd-entry-info {
    flex: 1;
    min-width: 0;
}

.dfd-widget .dfd-entry-name {
    font-size: 18px;
    font-weight: 600;
    font-family: 'DFD-HelveticaNeue', Helvetica, Arial, sans-serif !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-dark, #1a1a1a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.dfd-widget .dfd-entry-amount {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    margin-bottom: 6px;
}

.dfd-widget .dfd-entry-pct {
    font-weight: 600;
    color: #888;
    font-size: 12px;
    margin-left: 4px;
}

/* Progress bar track */
.dfd-widget .dfd-bar-track {
    height: 8px;
    background: #e0e0e0;
    border-radius: 100px;
    overflow: hidden;
}

/* Progress bar fill — starts at 0; .dfd-animate triggers grow */
.dfd-widget .dfd-bar-fill {
    height: 100%;
    background-color: var(--color-yellow, #FFDE17);
    border-radius: 100px;
    width: 0%;
}

.dfd-widget .dfd-bar-fill.dfd-animate {
    animation: dfd-grow 0.8s ease-out forwards;
}


/* =============================================================================
   STATS WIDGET
   ============================================================================= */

.dfd-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media screen and (max-width: 767px) {
    .dfd-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dfd-stat-card {
    background-color: var(--bg-white, #fff);
    border: 4px solid var(--color-dark, #1a1a1a);
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
}

.dfd-stat-value {
    font-family: var(--font-heading);
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1;
    color: var(--color-blue, #26ACE2);
    -webkit-text-stroke-width: 4px;
    -webkit-text-stroke-color: var(--color-dark, #1a1a1a);
    paint-order: stroke fill;
    margin-bottom: 8px;
}

.dfd-stat-label {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-dark, #1a1a1a);
}


/* =============================================================================
   LEADERBOARD PODIUM
   ============================================================================= */

/* Section heading */
.dfd-widget .dfd-podium-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dfd-widget .dfd-board-title {
    font-size: 30px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-dark, #1a1a1a);
}

.dfd-widget .dfd-board-subtitle {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Top 3 grid */
.dfd-widget .dfd-podium-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

@media screen and (max-width: 600px) {
    .dfd-widget .dfd-podium-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Podium card */
.dfd-widget .dfd-podium-card {
    border-radius: 14px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    position: relative;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
}

.dfd-widget .dfd-podium-card:hover {
    opacity: 0.85;
}

.dfd-widget .dfd-podium-card.rank-1 { background: #fffae6; }
.dfd-widget .dfd-podium-card.rank-2 { background: #f5f5f5; }
.dfd-widget .dfd-podium-card.rank-3 { background: #fdf3ec; }

/* Medal badge — hidden, rank conveyed by card position and background */
.dfd-widget .dfd-podium-medal {
    display: none;
}

/* Podium avatar */
.dfd-widget .dfd-podium-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background-color: var(--color-yellow, #FFDE17);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 8px;
    flex-shrink: 0;
}

.dfd-widget .dfd-podium-avatar.rank-1 { width: 84px; height: 84px; }

.dfd-widget .dfd-podium-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dfd-widget .dfd-podium-avatar .dfd-avatar-logo {
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-size: 70%;
    background-position: center;
}

/* Podium text */
.dfd-widget .dfd-podium-name {
    
   
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-dark, #1a1a1a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.dfd-widget .dfd-podium-amount {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-blue, #26ACE2);
    line-height: 1;
}

.dfd-widget .dfd-podium-card.rank-1 .dfd-podium-amount {
    font-size: 24px;
}

.dfd-widget .dfd-podium-pct {
    font-size: 12px;
    font-weight: 600;
    color: #999;
}

/* Podium bar */
.dfd-widget .dfd-podium-bar-track {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 100px;
    overflow: hidden;
}

.dfd-widget .dfd-podium-bar-fill {
    height: 100%;
    background-color: var(--color-yellow, #FFDE17);
    border-radius: 100px;
    width: 0%;
}

.dfd-widget .dfd-podium-bar-fill.dfd-animate {
    animation: dfd-grow 0.8s ease-out forwards;
}

/* Toggle divider */
.dfd-widget .dfd-list-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 0;
    cursor: pointer;
    user-select: none;
}

.dfd-widget .dfd-list-toggle-line {
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.dfd-widget .dfd-list-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #1a1a1a;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}

.dfd-widget .dfd-list-toggle:hover .dfd-list-toggle-btn {
    border-color: var(--color-blue, #26ACE2);
    color: var(--color-blue, #26ACE2);
}

.dfd-widget .dfd-list-toggle-chevron {
    display: inline-block;
    font-style: normal;
    line-height: 1;
    transition: none;
}

/* Collapsible list */
.dfd-widget .dfd-list-collapsible {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
}

.dfd-widget .dfd-list-collapsible.open {
    max-height: 2000px;
    opacity: 1;
}

/* Hidden entries (show more) */
.dfd-widget .dfd-entry-hidden { display: none; }

/* Bottom actions row */
.dfd-widget .dfd-list-actions {
    display: flex;
    align-items: center;
    padding-top: 12px;
    gap: 8px;
}

.dfd-widget .dfd-spacer { flex: 1; }

.dfd-widget .dfd-show-more-btn,
.dfd-widget .dfd-hide-btn {
    padding: 7px 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 100px;
    background: transparent;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-dark, #1a1a1a);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.dfd-widget .dfd-show-more-btn:hover,
.dfd-widget .dfd-hide-btn:hover {
    border-color: var(--color-blue, #26ACE2);
    color: var(--color-blue, #26ACE2);
}

.dfd-widget .dfd-show-more-btn.dfd-hidden { display: none; }
