/**
 * Formidable Charts Addon 前台樣式表
 */
.frm-chart-container {
    box-sizing: border-box;
    width: 100%;
    margin: 1.5rem auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #1e293b;
}

.frm-chart-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
}

.frm-chart-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 14px;
}

.frm-chart-title {
    margin: 0 0 6px 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    color: #0f172a;
}

.frm-chart-subtitle {
    margin: 0 0 8px 0;
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

.frm-chart-total-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    margin-top: 4px;
}

.frm-chart-timestamp-wrap {
    margin: 6px 0 10px 0;
}

.frm-chart-timestamp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: #15803d;
}

.frm-chart-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #16a34a;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
    animation: frmPulse 2s infinite;
}

@keyframes frmPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 5px rgba(22, 163, 74, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

.frm-chart-meta-label {
    color: #64748b;
}

.frm-chart-meta-value {
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.frm-chart-canvas-wrap {
    width: 100%;
    margin: 16px 0;
}

.frm-chart-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.frm-chart-export-btn {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.frm-chart-export-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.frm-chart-error,
.frm-chart-notice {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin: 1rem 0;
}

.frm-chart-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.frm-chart-notice {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

@media (max-width: 640px) {
    .frm-chart-card {
        padding: 16px;
    }
    .frm-chart-title {
        font-size: 1.1rem;
    }
    .frm-chart-actions {
        flex-direction: column;
    }
    .frm-chart-export-btn {
        width: 100%;
        text-align: center;
    }
}

/* 前台前三名得主名冊樣式 (同分並列同名) */
.frm-top3-podium {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.frm-top3-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.frm-top3-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #92400e;
}

.frm-top3-meta {
    font-size: 0.75rem;
    color: #64748b;
}

.frm-top3-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.frm-top3-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.8125rem;
    transition: all 0.15s ease-in-out;
}

.frm-rank-1 {
    background: #fffbeb;
    border-color: #fde68a;
    color: #78350f;
}

.frm-rank-2 {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #334155;
}

.frm-rank-3 {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #7c2d12;
}

.frm-top3-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.frm-top3-medal {
    font-size: 1.25rem;
    line-height: 1;
}

.frm-top3-info {
    display: flex;
    flex-direction: column;
}

.frm-top3-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.frm-top3-name {
    font-size: 0.8125rem;
    font-weight: 700;
}

.frm-top3-tie-badge {
    background: #4f46e5;
    color: #ffffff;
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.frm-top3-subrank {
    font-size: 0.6875rem;
    color: #64748b;
    margin-top: 2px;
}

.frm-top3-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.frm-top3-votes {
    font-weight: 700;
}

.frm-top3-pct {
    font-size: 0.75rem;
    color: #64748b;
}

/* 分隔線與空白區間樣式 */
.frm-chart-divider-wrap.frm-divider-labeled {
    position: relative;
    margin: 28px 0;
    text-align: center;
    display: flex;
    align-items: center;
}

.frm-divider-line {
    flex: 1;
    border-top: 1px solid #cbd5e1;
}

.frm-divider-text {
    padding: 0 16px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #475569;
    background: #ffffff;
    letter-spacing: 0.05em;
}

.frm-chart-divider {
    margin: 24px 0;
    border-top: 1px solid #e2e8f0;
}

.frm-chart-divider.frm-divider-dashed {
    border-top-style: dashed;
}

.frm-chart-divider.frm-divider-accent {
    border-top: 2px solid #4f46e5;
    opacity: 0.85;
}

.frm-chart-spacer {
    width: 100%;
    display: block;
}
