/* ══════════════════════════════════════════════════════
   CRM Bot Mini App — Competition (مسابقه) Styles
   ══════════════════════════════════════════════════════ */

/* ── Progress bar color tiers (shared) ─────────────────── */
.progress-red    .contest-progress-fill,
.contest-progress-fill.progress-red    { background: linear-gradient(90deg,var(--danger),#ff8a8a); }
.progress-orange .contest-progress-fill,
.contest-progress-fill.progress-orange { background: linear-gradient(90deg,var(--warning),#ffcf7a); }
.progress-teal   .contest-progress-fill,
.contest-progress-fill.progress-teal   { background: linear-gradient(90deg,#17b7c7,#5be3e8); }
.progress-green  .contest-progress-fill,
.contest-progress-fill.progress-green  { background: linear-gradient(90deg,var(--success),#7dffc2); }
.progress-glow   .contest-progress-fill,
.contest-progress-fill.progress-glow   {
    background: linear-gradient(90deg,var(--success),#7dffc2);
    box-shadow: 0 0 16px 3px rgba(79,209,160,0.65);
}

.ring-red    { stroke: var(--danger) !important; }
.ring-orange { stroke: var(--warning) !important; }
.ring-teal   { stroke: #17b7c7 !important; }
.ring-green  { stroke: var(--success) !important; }
.ring-glow   { stroke: var(--success) !important; filter: drop-shadow(0 0 8px rgba(79,209,160,0.8)); }

/* ── Header: rotating title / slogan ───────────────────── */
.contest-header {
    position: relative;
    background: linear-gradient(135deg, #2a1f5c, #4a2f7c 60%, #7c3fa0);
    border-radius: var(--radius-lg);
    padding: 28px var(--gap-md) 24px;
    text-align: center;
    overflow: hidden;
    margin-bottom: var(--gap-md);
}

.contest-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.12), transparent 60%);
}

.contest-help-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    backdrop-filter: blur(4px);
}
.contest-help-btn:active { transform: scale(0.9); }

.contest-title-stage {
    position: relative;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.contest-title-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    animation: contestFade 6s infinite;
    font-weight: 800;
    color: #fff;
}

.contest-title-slide.slogan {
    animation-delay: 3s;
    font-weight: 500;
    font-size: 14px;
    color: rgba(255,255,255,0.85);
}

.contest-title-slide .contest-title-text { font-size: 19px; letter-spacing: -0.3px; }

@keyframes contestFade {
    0%, 46%   { opacity: 0; transform: translateY(6px); }
    8%, 42%   { opacity: 1; transform: translateY(0); }
    50%, 100% { opacity: 0; transform: translateY(-6px); }
}

/* ── Team cards ─────────────────────────────────────────── */
.contest-team-card {
    position: relative;
    background: var(--surface-2);
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 22px var(--gap-md) var(--gap-md);
    margin-top: 22px;
    margin-bottom: var(--gap-md);
}

.contest-team-badge {
    position: absolute;
    top: -16px;
    right: 16px;
    padding: 5px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.contest-team-stats-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

.contest-team-amount {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.contest-team-percent {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.contest-progress-track {
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--surface-3);
    overflow: hidden;
    margin-bottom: var(--gap-md);
    position: relative;
}

.contest-progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background-image: repeating-linear-gradient(
        135deg,
        rgba(255,255,255,0.28) 0 10px,
        rgba(255,255,255,0) 10px 20px
    );
    background-size: 200% 100%;
    animation: contestStripe 1.4s linear infinite;
    transition: width 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 100%;
}

@keyframes contestStripe {
    from { background-position: 0 0; }
    to   { background-position: -40px 0; }
}

.contest-member-list { display: flex; flex-direction: column; gap: 6px; }

.contest-member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    padding: 6px 10px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.contest-member-row .member-name { color: var(--text-primary); font-weight: 600; }
.contest-member-row .member-amount { color: var(--text-secondary); }

/* ── Challenges ─────────────────────────────────────────── */
.contest-challenge-box {
    background: linear-gradient(135deg, rgba(245,182,79,0.12), rgba(245,182,79,0.04));
    border: 1px solid rgba(245,182,79,0.3);
    border-radius: var(--radius-lg);
    padding: var(--gap-md);
    margin-bottom: var(--gap-sm);
}

.contest-challenge-title { font-weight: 800; font-size: 14px; margin-bottom: 4px; display:flex; align-items:center; gap:6px; }
.contest-challenge-desc  { font-size: 12.5px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 8px; }
.contest-challenge-status { font-size: 12px; font-weight: 700; }
.contest-challenge-status.won      { color: var(--success); }
.contest-challenge-status.ongoing  { color: var(--warning); }

/* ── Top 3 experts of the week ─────────────────────────── */
.contest-top3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap-sm);
}

.contest-top3-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 8px;
    text-align: center;
}

.contest-medal { width: 34px; height: 34px; margin: 0 auto 6px; display:block; }
.medal-star { rx: 2; }
.medal-star.gold   { fill: #FFD54A; }
.medal-star.silver { fill: #D6DAE0; }
.medal-star.bronze { fill: #E0A468; }

.contest-top3-name   { font-size: 12.5px; font-weight: 700; color: var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.contest-top3-team   { font-size: 10.5px; color: var(--text-muted); margin-top:2px; }
.contest-top3-amount { font-size: 12px; font-weight: 800; color: var(--accent); margin-top: 4px; }

/* ── Total sales ────────────────────────────────────────── */
.contest-total-sales-card {
    background: linear-gradient(135deg, var(--accent), #5b4fcf);
    border-radius: var(--radius-lg);
    padding: var(--gap-md);
    text-align: center;
    color: #fff;
    box-shadow: var(--shadow-accent);
}
.contest-total-sales-label { font-size: 12px; opacity: 0.85; margin-bottom: 4px; }
.contest-total-sales-value { font-size: 24px; font-weight: 800; }

/* ── Circular avg progress ──────────────────────────────── */
.contest-circular-wrap { display:flex; align-items:center; justify-content:center; padding: var(--gap-sm) 0; }
.contest-circular-wrap svg { transform: rotate(-90deg); }
.contest-ring-bg   { fill:none; stroke:var(--surface-2); stroke-width:10; }
.contest-ring-fill { fill:none; stroke-width:10; stroke-linecap:round; transition: stroke-dashoffset 1s cubic-bezier(0.34,1.56,0.64,1); }
.contest-ring-center { text-align:center; }
.contest-ring-percent { font-size:24px; font-weight:800; color:var(--text-primary); display:block; }
.contest-ring-label { font-size:11px; color:var(--text-muted); }

/* ── Countdown ──────────────────────────────────────────── */
.contest-countdown {
    display: flex;
    justify-content: center;
    gap: 8px;
}
.countdown-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 4px;
    min-width: 58px;
    text-align: center;
}
.countdown-num   { font-size: 20px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.countdown-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Weekly leaderboard ─────────────────────────────────── */
.contest-week-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
}
.contest-week-row:last-child { border-bottom: none; }
.contest-week-team { display:flex; align-items:center; gap:8px; font-weight:600; font-size:13px; }
.contest-week-dots { display:flex; gap:3px; }
.week-dot { width:9px; height:9px; border-radius:50%; background: var(--surface-3); }
.week-dot.filled { box-shadow: 0 0 4px currentColor; }
.contest-week-points { font-size:12px; font-weight:700; color:var(--text-secondary); min-width:56px; text-align:left; }

/* ── Empty / waiting state ─────────────────────────────── */
.contest-empty {
    text-align: center;
    padding: 60px var(--gap-md);
}
.contest-empty .icon { font-size: 52px; margin-bottom: 12px; opacity: 0.5; }

/* ══════════════════════════════════════════════════════
   Admin — Competition management
   ══════════════════════════════════════════════════════ */

.comp-status-chip {
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:3px 10px;
    border-radius: var(--radius-full);
    font-size:11px;
    font-weight:700;
}
.comp-status-chip.pending  { background: rgba(245,182,79,0.15); color: var(--warning); }
.comp-status-chip.active   { background: rgba(79,209,160,0.15); color: var(--success); }
.comp-status-chip.finished { background: var(--surface-2); color: var(--text-secondary); }

.team-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--surface) inset;
}

.assign-radio-list { display:flex; flex-direction:column; gap:8px; }
.assign-radio-option {
    display:flex;
    align-items:center;
    gap:10px;
    padding:12px 14px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    transition: all 0.2s;
}
.assign-radio-option input { accent-color: var(--accent); width:18px; height:18px; }
.assign-radio-option.checked { border-color: var(--accent); background: var(--accent-glow); }
.assign-radio-option label { flex:1; font-size:14px; font-weight:600; cursor:pointer; display:flex; align-items:center; gap:8px; }

.color-swatch-row { display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.color-swatch {
    width:28px; height:28px; border-radius:50%;
    cursor:pointer; border:2px solid transparent;
}
.color-swatch.selected { border-color: var(--text-primary); transform: scale(1.15); }