/* JEC Speaker Manager v1.1.0 — Frontend Styles */

.jec-speakers {
    --jec-primary:    #6B3FA0;
    --jec-accent:     #9B6FC8;
    --jec-text:       #1d2327;
    --jec-meta-color: #646970;
    --jec-bg:         #fafafa;
    --jec-border:     #ebebeb;
    --jec-radius:     8px;
    --jec-gap:        24px;
}

/* ============================================================
   BASE — solo speaker card
   ============================================================ */

.jec-speaker {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.jec-speaker-photo {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--jec-primary);
}

.jec-speaker-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.jec-speaker-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2px 0;
}

.jec-talk-title {
    color: var(--jec-primary);
    font-weight: 700;
    margin: 0 0 5px;
    font-size: 0.9em;
    line-height: 1.4;
}

.jec-speaker-name {
    font-weight: 700;
    margin: 0 0 3px;
    color: var(--jec-text);
    font-size: 1em;
    line-height: 1.3;
}

.jec-speaker-meta {
    color: var(--jec-meta-color);
    margin: 0;
    font-size: 0.85em;
    line-height: 1.4;
}

.jec-sep { margin: 0 2px; }

/* ============================================================
   GROUPED SPEAKERS — shared talk card
   ============================================================ */

/* Outer card — full width, same visual style as a solo card */
.jec-speaker-group {
    width: 100%;
    flex: 0 0 100%;
    min-width: 0;
    background: var(--jec-bg);
    border: 1px solid var(--jec-border);
    border-radius: var(--jec-radius);
    padding: 18px 20px;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.jec-speaker-group:hover {
    box-shadow: 0 4px 14px rgba(107, 63, 160, 0.1);
    border-color: var(--jec-primary);
}

/* Shared talk title */
.jec-group-title {
    color: var(--jec-primary);
    font-weight: 700;
    font-size: 0.9em;
    line-height: 1.4;
    margin: 0 0 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--jec-border);
}

/* Flex row of speakers inside the group */
.jec-group-speakers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

/* Individual speaker inside a group — NO card style */
.jec-gspeaker {
    flex: 1 1 200px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 24px 4px 0;
}

.jec-gspeaker + .jec-gspeaker {
    padding: 4px 0 4px 24px;
    border-left: 1px solid var(--jec-border);
}

.jec-gspeaker .jec-speaker-photo {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--jec-primary);
}

.jec-gspeaker .jec-speaker-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.jec-gspeaker .jec-speaker-body {
    flex: 1;
    min-width: 0;
    padding: 0;
}

/* ============================================================
   LAYOUT: GRID  [layout="grid"]
   Flex-based — avoids grid-column issues
   ============================================================ */

.jec-layout-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--jec-gap);
    align-items: stretch;
}

/* Default: 2 columns */
.jec-layout-grid > .jec-speaker {
    flex: 0 0 calc(50% - 12px);
    background: var(--jec-bg);
    border: 1px solid var(--jec-border);
    border-radius: var(--jec-radius);
    padding: 16px;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.jec-layout-grid > .jec-speaker:hover {
    box-shadow: 0 4px 14px rgba(107, 63, 160, 0.1);
    border-color: var(--jec-primary);
}

/* Column overrides */
.jec-layout-grid.jec-cols-1 > .jec-speaker { flex: 0 0 100%; }
.jec-layout-grid.jec-cols-3 > .jec-speaker { flex: 0 0 calc(33.333% - 16px); }
.jec-layout-grid.jec-cols-4 > .jec-speaker { flex: 0 0 calc(25% - 18px); }

/* ============================================================
   LAYOUT: LIST  [layout="list"]
   ============================================================ */

.jec-layout-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.jec-layout-list > .jec-speaker {
    padding: 14px 0;
    border-bottom: 1px solid var(--jec-border);
    align-items: center;
}

.jec-layout-list > .jec-speaker:last-child,
.jec-layout-list > .jec-speaker-group:last-child {
    border-bottom: none;
}

/* Groups in list: no card bg, flush with content */
.jec-layout-list > .jec-speaker-group {
    background: none;
    border: none;
    border-bottom: 1px solid var(--jec-border);
    border-radius: 0;
    padding: 14px 0;
    box-shadow: none !important;
}

.jec-layout-list > .jec-speaker-group:hover {
    border-color: var(--jec-border) !important;
}

/* In list: speakers in a group stack vertically */
.jec-layout-list .jec-group-speakers {
    flex-direction: column;
    gap: 10px;
}

.jec-layout-list .jec-gspeaker {
    flex: none;
    padding: 0;
}

.jec-layout-list .jec-gspeaker + .jec-gspeaker {
    padding: 10px 0 0;
    border-left: none;
    border-top: 1px solid var(--jec-border);
}

/* ============================================================
   LAYOUT: CARDS  [layout="cards"]
   ============================================================ */

.jec-layout-cards {
    display: flex;
    flex-wrap: wrap;
    gap: var(--jec-gap);
    align-items: stretch;
}

/* Default: 3 columns */
.jec-layout-cards > .jec-speaker {
    flex: 0 0 calc(33.333% - 16px);
    min-width: 0;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--jec-bg);
    border: 1px solid var(--jec-border);
    border-radius: var(--jec-radius);
    padding: 24px 16px 20px;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.jec-layout-cards > .jec-speaker:hover {
    box-shadow: 0 6px 18px rgba(107, 63, 160, 0.12);
    border-color: var(--jec-primary);
}

.jec-layout-cards > .jec-speaker .jec-speaker-photo {
    width: 100px;
    height: 100px;
    margin-bottom: 14px;
}

.jec-layout-cards > .jec-speaker .jec-speaker-body {
    align-items: center;
}

.jec-layout-cards > .jec-speaker .jec-talk-title {
    font-size: 0.82em;
}

/* Column overrides */
.jec-layout-cards.jec-cols-1 > .jec-speaker { flex: 0 0 100%; }
.jec-layout-cards.jec-cols-2 > .jec-speaker { flex: 0 0 calc(50% - 12px); }
.jec-layout-cards.jec-cols-4 > .jec-speaker { flex: 0 0 calc(25% - 18px); }
.jec-layout-cards.jec-cols-5 > .jec-speaker { flex: 0 0 calc(20% - 19px); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
    .jec-layout-grid.jec-cols-3 > .jec-speaker,
    .jec-layout-grid.jec-cols-4 > .jec-speaker,
    .jec-layout-cards.jec-cols-4 > .jec-speaker,
    .jec-layout-cards.jec-cols-5 > .jec-speaker {
        flex: 0 0 calc(50% - 12px);
    }
}

@media (max-width: 640px) {
    .jec-layout-grid > .jec-speaker,
    .jec-layout-grid.jec-cols-3 > .jec-speaker,
    .jec-layout-grid.jec-cols-4 > .jec-speaker,
    .jec-layout-cards > .jec-speaker,
    .jec-layout-cards.jec-cols-2 > .jec-speaker,
    .jec-layout-cards.jec-cols-3 > .jec-speaker,
    .jec-layout-cards.jec-cols-4 > .jec-speaker,
    .jec-layout-cards.jec-cols-5 > .jec-speaker {
        flex: 0 0 100%;
    }

    /* Cards → horizontal on mobile */
    .jec-layout-cards > .jec-speaker {
        flex-direction: row;
        text-align: left;
        align-items: flex-start;
        padding: 14px 12px;
    }

    .jec-layout-cards > .jec-speaker .jec-speaker-photo {
        width: 64px;
        height: 64px;
        margin-bottom: 0;
    }

    .jec-layout-cards > .jec-speaker .jec-speaker-body {
        align-items: flex-start;
    }

    /* Groups on mobile: speakers stack */
    .jec-speaker-group {
        padding: 14px;
    }

    .jec-group-speakers {
        flex-direction: column;
        gap: 0;
    }

    .jec-gspeaker {
        flex: none;
        padding: 8px 0;
    }

    .jec-gspeaker + .jec-gspeaker {
        padding: 8px 0 0;
        border-left: none;
        border-top: 1px solid var(--jec-border);
    }
}
