/* ═══════════════════════════════════════════════
   分組選擇器 — Group Pick
   ═══════════════════════════════════════════════ */

/* ── 共用畫布 ── */
.gp-canvas {
    width: 100%; height: 100%;
    position: relative;
    font-family: 'Noto Sans TC', 'Google Sans', sans-serif;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 80%, rgba(99,102,241,0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(59,130,246,0.04) 0%, transparent 50%),
        #fafbfc;
    border-radius: 10px;
}
.gp-canvas--editor {
    background:
        radial-gradient(circle at 50% 50%, rgba(124,58,237,0.05) 0%, transparent 50%),
        linear-gradient(135deg, #f0f9ff, #ede9fe);
}
.gp-canvas-header {
    position: absolute; top: 10px; left: 50%;
    transform: translateX(-50%);
    font-size: 0.82rem; font-weight: 700; color: #334155;
    z-index: 5; white-space: nowrap;
}
.gp-canvas-hint {
    position: absolute; bottom: 8px; left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem; color: #94a3b8;
    display: flex; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.8);
    padding: 3px 10px; border-radius: 8px;
    pointer-events: none; z-index: 5;
    backdrop-filter: blur(4px);
}

/* ── 排列座位按鈕（編輯器預覽） ── */
.gp-arrange-btn {
    position: absolute; bottom: 12px; right: 12px;
    z-index: 10;
    display: flex; align-items: center; gap: 4px;
    padding: 6px 14px;
    background: rgba(124,58,237,0.9);
    color: #fff; border: none; border-radius: 10px;
    font-size: 0.72rem; font-weight: 600;
    cursor: pointer; font-family: inherit;
    box-shadow: 0 2px 10px rgba(124,58,237,0.3);
    transition: all 0.2s;
}
.gp-arrange-btn:hover {
    background: rgba(124,58,237,1);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}

/* ── 拖曳卡片 ── */
.gp-drag-card {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: 10px 16px;
    border-radius: 12px;
    background: #fff;
    border: 2.5px solid var(--gp-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    cursor: grab; user-select: none;
    touch-action: none;
    transition: box-shadow 0.2s, transform 0.15s;
    z-index: 2;
    min-width: 72px; text-align: center;
}
.gp-drag-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.gp-drag-card.gp-dragging {
    cursor: grabbing;
    box-shadow: 0 12px 36px rgba(0,0,0,0.18);
    transform: translate(-50%, -50%) scale(1.08);
    z-index: 20 !important;
}
.gp-drag-card-name {
    font-size: 0.82rem; font-weight: 700;
    color: var(--gp-color);
}

/* ═══════════════════════════════════════════════
   排列座位彈窗
   ═══════════════════════════════════════════════ */
.gp-modal-overlay {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    animation: gpFadeIn 0.2s ease;
}
@keyframes gpFadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
.gp-modal {
    width: 90vw; max-width: 800px;
    background: #fff; border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.2);
    overflow: hidden;
    display: flex; flex-direction: column;
    animation: gpSlideUp 0.3s ease;
}
@keyframes gpSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.gp-modal-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}
.gp-modal-title {
    font-size: 1rem; font-weight: 700; color: #0f172a;
    display: flex; align-items: center; gap: 8px;
}
.gp-modal-close {
    background: none; border: none;
    cursor: pointer; color: #94a3b8;
    padding: 4px; border-radius: 8px;
    transition: background 0.2s;
}
.gp-modal-close:hover { background: #f1f5f9; color: #475569; }

.gp-modal-canvas {
    position: relative;
    width: 100%; height: 400px;
    background:
        radial-gradient(circle at 50% 0%, rgba(99,102,241,0.06) 0%, transparent 50%),
        repeating-linear-gradient(0deg, transparent, transparent 39px, #f1f5f940 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, #f1f5f940 40px),
        #fafbfc;
    overflow: hidden;
}
.gp-modal-canvas-label {
    position: absolute; top: 10px; left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem; font-weight: 600;
    color: #94a3b8; letter-spacing: 4px;
    border-bottom: 2px dashed #cbd5e1;
    padding: 0 30px 6px;
}
.gp-modal-footer {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid #f1f5f9;
}
.gp-modal-reset {
    display: flex; align-items: center; gap: 4px;
    background: none; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 6px 14px;
    font-size: 0.75rem; color: #64748b;
    cursor: pointer; font-family: inherit;
    transition: all 0.2s;
}
.gp-modal-reset:hover { background: #f8fafc; color: #334155; }

.gp-modal-save {
    display: flex; align-items: center; gap: 4px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    border: none; border-radius: 10px;
    padding: 8px 20px;
    font-size: 0.82rem; font-weight: 600;
    color: #fff; cursor: pointer; font-family: inherit;
    box-shadow: 0 2px 10px rgba(99,102,241,0.3);
    transition: all 0.2s;
}
.gp-modal-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}

/* ── 講師端 ── */
.gp-canvas--teacher {
    background:
        radial-gradient(circle at 20% 80%, rgba(99,102,241,0.03) 0%, transparent 50%),
        linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.gp-teacher-header {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 10px 16px; z-index: 5;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.gp-teacher-title {
    font-size: 1rem; font-weight: 800; color: #0f172a;
    display: flex; align-items: center; gap: 8px;
}
.gp-teacher-stats {
    font-size: 0.78rem; color: #64748b;
}
.gp-team-card--abs {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: grab; user-select: none;
    touch-action: none;
    z-index: 2;
    width: auto; min-width: 130px; max-width: 200px;
}
.gp-team-card--abs.gp-dragging {
    cursor: grabbing;
    box-shadow: 0 12px 36px rgba(0,0,0,0.18) !important;
    transform: translate(-50%, -50%) scale(1.06);
    z-index: 20 !important;
}

.gp-team-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 12px;
    display: flex; flex-direction: column; gap: 5px;
    transition: box-shadow 0.3s, transform 0.2s;
    position: relative; overflow: hidden;
}
.gp-team-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gp-color);
}
.gp-team-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.gp-team-card-header {
    display: flex; align-items: center;
    justify-content: space-between;
}
.gp-team-card-name {
    font-size: 0.85rem; font-weight: 700;
    color: var(--gp-color);
}
.gp-team-card-score {
    font-size: 1.1rem; font-weight: 800;
    color: var(--gp-color);
}
.gp-team-card-members {
    display: flex; flex-wrap: wrap; gap: 3px;
}
.gp-member-chip {
    font-size: 0.58rem; font-weight: 500;
    padding: 1px 6px; border-radius: 8px;
    background: #f1f5f9; color: #475569;
    white-space: nowrap;
}
.gp-team-card-count {
    font-size: 0.62rem; color: #94a3b8;
    display: flex; align-items: center; gap: 3px;
}

/* ── 破冰牆卡片 ── */
.gp-wall-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: box-shadow 0.3s, transform 0.2s;
    display: flex;
    flex-direction: column;
}
.gp-wall-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.gp-wall-card-top {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.gp-wall-card-color {
    width: 6px;
    flex-shrink: 0;
}
.gp-wall-card-info {
    flex: 1;
    padding: 10px 14px;
    min-width: 0;
}
.gp-wall-card-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--gp-color);
    margin-bottom: 2px;
}
.gp-wall-card-meta {
    font-size: 0.7rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 3px;
}
.gp-wall-card-meta b {
    color: #1e293b;
}
.gp-wall-members {
    padding: 6px 14px 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 32px;
}
.gp-wall-member {
    display: flex;
    align-items: center;
    gap: 5px;
    animation: gpMemberIn 0.3s ease-out both;
}
.gp-wall-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.gp-wall-member-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
}
.gp-wall-empty {
    font-size: 0.72rem;
    color: #cbd5e1;
    font-style: italic;
    padding: 4px 0;
}
@keyframes gpMemberIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.gp-canvas--student {
    background:
        radial-gradient(circle at 50% 50%, rgba(59,130,246,0.04) 0%, transparent 60%),
        #fafbfc;
}
.gp-student-title {
    position: absolute; top: 8px; left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem; font-weight: 700; color: #0f172a;
    display: flex; align-items: center; gap: 6px;
    z-index: 5; white-space: nowrap;
    background: rgba(255,255,255,0.8);
    padding: 4px 14px; border-radius: 10px;
    backdrop-filter: blur(4px);
}
.gp-pos-btn {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 12px 16px; gap: 4px;
    border: 2.5px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    min-width: 85px; min-height: 60px;
    z-index: 2;
}
.gp-pos-btn:hover {
    transform: translate(-50%, -50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.gp-pos-btn.selected {
    border-color: var(--gp-color);
    border-width: 3px;
    transform: translate(-50%, -50%) scale(1.06);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.gp-pos-btn-name {
    font-size: 0.85rem; font-weight: 700;
    color: var(--gp-color, #475569);
}
.gp-pos-btn-count {
    font-size: 0.62rem; color: #94a3b8;
}
.gp-pos-btn-check {
    position: absolute; top: 4px; right: 6px;
    color: var(--gp-color);
}
.gp-float-info {
    position: absolute; bottom: 10px; left: 50%;
    transform: translateX(-50%);
    font-size: 0.72rem; color: #475569;
    background: rgba(255,255,255,0.9);
    padding: 5px 14px; border-radius: 10px;
    border: 1px solid #e2e8f0;
    z-index: 5; white-space: nowrap;
    backdrop-filter: blur(4px);
}

/* ── 滿組 ── */
.gp-pos-btn.gp-full {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
    pointer-events: none;
}
.gp-pos-btn.gp-full .gp-pos-btn-count {
    color: #ef4444;
    font-weight: 600;
}

/* ── 講師端座位可點擊移除 ── */
.gp-seat-filled {
    position: relative;
    transition: transform 0.15s, opacity 0.15s;
}
.gp-seat-filled:hover {
    transform: scale(1.1);
}
.gp-seat-filled:hover::after {
    content: '✕';
    position: absolute;
    top: -2px; right: -2px;
    width: 16px; height: 16px;
    background: #ef4444;
    color: #fff;
    font-size: 10px; font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    line-height: 1;
}
