/* Floating panels and the analytics funnel.
   Shared by manage.html (Edit Text / Submissions / Analytics panels),
   analytics.html (funnel only) and create.html (full preview panel). */

/* --- Floating panel shell --- */

.panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.panel-overlay.hidden {
    display: none;
}

.floating-panel {
    display: flex;
    flex-direction: column;
    width: min(1200px, 100%);
    max-height: calc(100vh - 48px);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.floating-panel--narrow {
    width: min(820px, 100%);
}

.floating-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 auto;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.floating-panel-header h3 {
    margin: 0;
    font-size: 17px;
}

.floating-panel-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.floating-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 16px 20px 20px;
}

.panel-close {
    flex: 0 0 auto;
    padding: 4px 10px;
    font-size: 20px;
    line-height: 1;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.panel-close:hover {
    color: var(--text);
    background: var(--bg);
}

/* --- Collapsible card (Appearance, on both create and manage) --- */

.collapsible-card > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.collapsible-card > summary::-webkit-details-marker {
    display: none;
}

.collapsible-card > summary::before {
    content: '\25B8';
    font-size: 13px;
    color: var(--text-secondary);
    transition: transform 0.15s;
}

.collapsible-card[open] > summary::before {
    transform: rotate(90deg);
}

.collapsible-card > summary .collapsible-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

.collapsible-body {
    margin-top: 16px;
}

/* --- Analytics funnel --- */

.funnel-row {
    margin-bottom: 12px;
}

.funnel-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.funnel-label {
    font-size: 13px;
}

.funnel-label--milestone {
    font-weight: 700;
}

.funnel-quit,
.funnel-count {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Explicitly not the per-poll theme variables (--accent / --bg-accent): those are
   injected at runtime by appearance.js and are undefined on pages that do not
   apply a poll theme, which left the bars invisible. */
.funnel-track {
    height: 24px;
    overflow: hidden;
    background: var(--border);
    border-radius: 4px;
}

.funnel-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}
