/*
 * Group registration CTA (task-185 — theme-aware collapsible dropdown)
 *
 * Native <details>/<summary> for the collapsible. All colors reference
 * the --theme-* CSS variables defined per-theme in
 * events/static/events/registration/themes/css/*.css, with safe fallbacks.
 * Dark mode is handled by registration-dark-mode.css overriding those
 * variables at html.dark-mode scope — nothing extra needed here.
 *
 * Mobile-first; Bootstrap Icons only (task-174).
 */

/* ----------------------------------------------------------------------
   Container — a single bordered card that *is* the <details> element.
   Visually compact when closed; opens to reveal the participants list.
   ---------------------------------------------------------------------- */
.group-cta {
    margin: 24px 0;
    border-radius: var(--theme-border-radius, 12px);
    background: var(--theme-surface, #ffffff);
    border: 1px solid var(--theme-border, #e2e8f0);
    color: var(--theme-text, #0f172a);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.group-cta[open] {
    border-color: var(--theme-accent, var(--theme-primary, #2563eb));
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

/* ----------------------------------------------------------------------
   Summary (always visible) — the clickable header.
   ---------------------------------------------------------------------- */
.group-cta__summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    color: inherit;
    transition: background 0.15s ease;
}

.group-cta__summary::-webkit-details-marker { display: none; }
.group-cta__summary::marker { display: none; }

.group-cta__summary:hover {
    background: var(--theme-input-bg, rgba(15, 23, 42, 0.03));
}

.group-cta__summary:focus-visible {
    outline: 2px solid var(--theme-accent, var(--theme-primary, #2563eb));
    outline-offset: -2px;
}

.group-cta__step-badge {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--theme-accent, var(--theme-primary, #2563eb));
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}

.group-cta__step-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.group-cta__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--theme-text, #0f172a);
    line-height: 1.3;
}

.group-cta__hint-soft {
    font-size: 0.8125rem;
    color: var(--theme-muted, #64748b);
    line-height: 1.4;
}

.group-cta__chevron {
    flex: 0 0 24px;
    color: var(--theme-muted, #94a3b8);
    transition: transform 0.2s ease;
}

.group-cta[open] .group-cta__chevron {
    transform: rotate(180deg);
    color: var(--theme-accent, var(--theme-primary, #2563eb));
}

/* ----------------------------------------------------------------------
   Panel — visible only when the <details> is open.
   ---------------------------------------------------------------------- */
.group-cta__panel {
    padding: 4px 16px 20px;
    border-top: 1px solid var(--theme-border, #e2e8f0);
    background: var(--theme-bg, transparent);
}

@media (min-width: 768px) {
    .group-cta__summary { padding: 16px 20px; }
    .group-cta__panel { padding: 8px 20px 24px; }
}

.group-cta__hint {
    margin: 12px 0 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--theme-muted, #475569);
}

/* ----------------------------------------------------------------------
   Family discount banner — appears once ≥1 participant is added.
   ---------------------------------------------------------------------- */
.group-cta__family-banner {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 14px;
    background: var(--theme-input-bg, #f0f9ff);
    border: 1px solid var(--theme-border, #bae6fd);
    border-left: 3px solid var(--theme-accent, var(--theme-primary, #0284c7));
    border-radius: var(--theme-input-radius, 8px);
    color: var(--theme-text, #075985);
    font-size: 0.875rem;
    line-height: 1.45;
}

.group-cta__family-banner .bi {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--theme-accent, var(--theme-primary, #0284c7));
    font-size: 1.05em;
}

/* ----------------------------------------------------------------------
   Counter row + action button — theme-aware.
   ---------------------------------------------------------------------- */
.group-cta__counter-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

@media (min-width: 576px) {
    .group-cta__counter-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.group-cta__counter {
    font-size: 0.9rem;
    color: var(--theme-muted, #475569);
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-cta__counter .bi {
    color: var(--theme-accent, var(--theme-primary, #2563eb));
    font-size: 1.05em;
}

.group-cta__counter strong { color: var(--theme-text, #0f172a); }

.group-cta__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Theme-driven primary action. Higher specificity wins over Bootstrap. */
.group-cta__actions #add-participant-btn,
.group-cta #add-participant-btn {
    background: var(--theme-accent, var(--theme-primary, #2563eb));
    border: 1px solid var(--theme-accent, var(--theme-primary, #2563eb));
    color: #ffffff;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--theme-input-radius, 8px);
    transition: background 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}

.group-cta__actions #add-participant-btn:hover,
.group-cta #add-participant-btn:hover {
    background: var(--theme-accent-hover, var(--theme-primary, #1d4ed8));
    border-color: var(--theme-accent-hover, var(--theme-primary, #1d4ed8));
    color: #ffffff;
}

.group-cta__actions #add-participant-btn:active,
.group-cta #add-participant-btn:active { transform: translateY(1px); }

.group-cta__actions #add-participant-btn:disabled,
.group-cta #add-participant-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.group-cta__actions #add-participant-btn .bi { font-size: 1em; }

/* Secondary "copy my data" button — quieter, theme-aware */
.group-cta__actions #copy-organizer-btn {
    background: var(--theme-surface, #ffffff);
    border: 1px solid var(--theme-border, #cbd5e1);
    color: var(--theme-muted, #475569);
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--theme-input-radius, 8px);
}

.group-cta__actions #copy-organizer-btn:hover {
    background: var(--theme-input-bg, #f1f5f9);
    border-color: var(--theme-accent, var(--theme-primary, #94a3b8));
    color: var(--theme-text, inherit);
}

/* ----------------------------------------------------------------------
   Empty state + total bar.
   ---------------------------------------------------------------------- */
.group-cta__empty {
    padding: 14px 16px;
    background: var(--theme-surface, #ffffff);
    border: 1px dashed var(--theme-border, #cbd5e1);
    border-radius: var(--theme-input-radius, 8px);
    color: var(--theme-muted, #64748b);
    font-size: 0.875rem;
    display: flex;
    gap: 10px;
    align-items: center;
    line-height: 1.45;
}

.group-cta__empty .bi {
    color: var(--theme-muted, #94a3b8);
    font-size: 1.05em;
    flex-shrink: 0;
}

.group-cta__total-bar {
    margin-top: 14px;
    padding: 14px 16px;
    background: var(--theme-surface, #ffffff);
    border-radius: var(--theme-input-radius, 8px);
    border: 1px solid var(--theme-border, #e2e8f0);
}

.group-cta__total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.group-cta__total-label {
    font-weight: 600;
    color: var(--theme-text, #334155);
    font-size: 0.95rem;
}

.group-cta__total-value {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--theme-accent, var(--theme-primary, #2563eb));
}

.group-cta__total-breakdown {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--theme-muted, #64748b);
}

/* ----------------------------------------------------------------------
   Participant card age markers (task-173 age-gate).
   ---------------------------------------------------------------------- */
.participant--minor .participant-header {
    border-left: 3px solid var(--theme-warning, #f59e0b);
}

.participant--child .participant-header {
    border-left: 3px solid var(--theme-error, #dc2626);
}

.participant-age-notice {
    margin-top: 8px;
    font-size: 0.825rem;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    line-height: 1.45;
    padding: 8px 10px;
    border-radius: var(--theme-input-radius, 8px);
}

.participant-age-notice .bi {
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 1em;
}

.participant-age-notice.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--theme-text, #92400e);
}

.participant-age-notice.alert-info {
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: var(--theme-text, #1e40af);
}

.participant-age-notice.alert-secondary {
    background: var(--theme-input-bg, #f8fafc);
    border: 1px solid var(--theme-border, #e2e8f0);
    color: var(--theme-muted, #475569);
}

/* ----------------------------------------------------------------------
   Participant cards — theme-aware
   ---------------------------------------------------------------------- */
.group-participant-card {
    background: var(--theme-surface, #ffffff);
    border: 1px solid var(--theme-border, #e2e8f0);
    border-radius: var(--theme-border-radius, 10px);
    padding: 14px;
    margin-top: 12px;
}

.group-participant-card .participant-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--theme-border, #e2e8f0);
}

.participant-badge {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--theme-accent, var(--theme-primary, #2563eb));
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.participant-title {
    font-weight: 600;
    color: var(--theme-text, #0f172a);
    flex: 1 1 auto;
}

.participant-actions {
    display: flex;
    gap: 6px;
}

.participant-collapse-btn,
.remove-participant-btn {
    border: 1px solid var(--theme-border, #e2e8f0);
    background: var(--theme-surface, #ffffff);
    color: var(--theme-muted, #64748b);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    line-height: 1;
    cursor: pointer;
}

.remove-participant-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--theme-error, #dc2626);
    color: var(--theme-error, #dc2626);
}

.participant-fields-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

@media (min-width: 576px) {
    .participant-fields-row { grid-template-columns: 1fr 1fr; }
}

.participant-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--theme-muted, #475569);
    margin-bottom: 4px;
}

.participant-field .form-control {
    background: var(--theme-input-bg, #ffffff);
    border: 1px solid var(--theme-border, #cbd5e1);
    color: var(--theme-text, #0f172a);
    border-radius: var(--theme-input-radius, 6px);
}

.participant-field .form-control:focus {
    border-color: var(--theme-accent, var(--theme-primary, #2563eb));
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field-required { color: var(--theme-error, #dc2626); }

/* ----------------------------------------------------------------------
   Auto-collapsed card (task-187) — show only a summary line until the
   user clicks the expand chevron. Saves vertical space when adding
   multiple participants in a row.
   ---------------------------------------------------------------------- */
.group-participant-card.participant--auto-collapsed {
    padding: 10px 14px;
    background: var(--theme-input-bg, #f8fafc);
}

.group-participant-card.participant--auto-collapsed .participant-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.group-participant-card.participant--auto-collapsed .participant-summary {
    margin-top: 8px;
    font-size: 0.875rem;
    color: var(--theme-text, #0f172a);
    font-weight: 500;
    padding: 6px 10px;
    background: var(--theme-surface, #ffffff);
    border-radius: 6px;
    border: 1px solid var(--theme-border, #e2e8f0);
}

/* ----------------------------------------------------------------------
   task-187: dark-mode fine-tuning. The base vars already shift via
   registration-dark-mode.css.
   These rules only soften the rgba() backgrounds that don't theme cleanly.
   ---------------------------------------------------------------------- */
html.dark-mode .group-cta__family-banner {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.25);
}

html.dark-mode .participant-age-notice.alert-warning {
    background: rgba(245, 158, 11, 0.12);
}

html.dark-mode .participant-age-notice.alert-info {
    background: rgba(96, 165, 250, 0.12);
}

html.dark-mode .group-cta__summary:hover {
    background: rgba(255, 255, 255, 0.04);
}
