/* ── Group Leader Dashboard ── */

.scorm-leader-dashboard {
    max-width: 1000px;
    margin: 0 auto;
    color: var(--scorm-text-color, #334155);
    font-size: 15px;
    line-height: 1.5;
}

/* ── Summary bar ── */
.gld-summary {
    display: flex;
    gap: 1px;
    background: var(--scorm-border-color, #e2e8f0);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 28px;
}
.gld-summary-item {
    flex: 1;
    background: var(--scorm-surface-color, #fff);
    padding: 20px;
    text-align: center;
}
.gld-summary-value {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    color: var(--scorm-heading-color, #0f172a);
    line-height: 1.2;
}
.gld-summary-label {
    display: block;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--scorm-muted-text-color, #94a3b8);
    margin-top: 2px;
}

/* ── Card grid ── */
.gld-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.gld-card {
    background: var(--scorm-surface-color, #fff);
    border: 1px solid var(--scorm-border-color, #e2e8f0);
    border-radius: 12px;
    padding: 0;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
}
.gld-card:hover {
    border-color: var(--scorm-primary-color, #0073aa);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.gld-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 20px 0;
}
.gld-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--scorm-primary-color, #0073aa);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gld-card-icon .dashicons { font-size: 18px; width: 18px; height: 18px; }
.gld-card-header h3 {
    margin: 0;
    font-size: 1.05em;
    font-weight: 600;
    color: var(--scorm-heading-color, #0f172a);
}
.gld-card-meta {
    font-size: 0.82em;
    color: var(--scorm-muted-text-color, #94a3b8);
}
.gld-card-body {
    padding: 16px 20px;
    flex: 1;
}
.gld-card-stats {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}
.gld-mini-stat {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    background: var(--scorm-surface-muted-color, #f8fafc);
    border-radius: 8px;
}
.gld-mini-value {
    display: block;
    font-size: 1.2em;
    font-weight: 700;
    color: var(--scorm-heading-color, #0f172a);
}
.gld-mini-label {
    display: block;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--scorm-muted-text-color, #94a3b8);
}
.gld-card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--scorm-border-color, #f1f5f9);
    font-size: 0.85em;
    color: var(--scorm-primary-color, #0073aa);
    font-weight: 500;
}

/* ── Progress bars ── */
.gld-bar {
    height: 6px;
    background: var(--scorm-border-color, #e2e8f0);
    border-radius: 3px;
    overflow: hidden;
}
.gld-bar-sm { height: 4px; width: 80px; display: inline-block; vertical-align: middle; }
.gld-bar-fill {
    height: 100%;
    background: var(--scorm-primary-color, #0073aa);
    border-radius: 3px;
    transition: width 0.3s;
}
.gld-bar-green { background: #10b981; }
.gld-progress-cell { display: flex; align-items: center; gap: 8px; }
.gld-progress-pct { font-size: 0.85em; color: var(--scorm-muted-text-color, #64748b); font-weight: 500; min-width: 32px; }

/* ── Detail page ── */
.gld-back {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--scorm-primary-color, #0073aa);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}
.gld-back:hover { text-decoration: underline; }
.gld-detail-header { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.gld-detail-header h2 {
    margin: 0;
    font-size: 1.6em;
    font-weight: 700;
    color: var(--scorm-heading-color, #0f172a);
}
.gld-subtitle {
    margin: 4px 0 0;
    color: var(--scorm-muted-text-color, #64748b);
}

/* ── Stats row ── */
.gld-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.gld-stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--scorm-surface-color, #fff);
    border: 1px solid var(--scorm-border-color, #e2e8f0);
    border-radius: 10px;
}
.gld-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gld-stat-icon .dashicons { font-size: 18px; width: 18px; height: 18px; }
.gld-stat-blue { background: #dbeafe; color: #2563eb; }
.gld-stat-green { background: #d1fae5; color: #059669; }
.gld-stat-orange { background: #fef3c7; color: #d97706; }
.gld-stat-gray { background: #f1f5f9; color: #64748b; }
.gld-stat-value {
    display: block;
    font-size: 1.3em;
    font-weight: 700;
    color: var(--scorm-heading-color, #0f172a);
    line-height: 1.1;
}
.gld-stat-label {
    display: block;
    font-size: 0.78em;
    color: var(--scorm-muted-text-color, #64748b);
}

/* ── Tabs ── */
.gld-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--scorm-border-color, #e2e8f0);
    margin-bottom: 0;
}
.gld-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.92em;
    font-weight: 500;
    color: var(--scorm-muted-text-color, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
}
.gld-tab .dashicons { font-size: 16px; width: 16px; height: 16px; }
.gld-tab:hover { color: var(--scorm-heading-color, #0f172a); }
.gld-tab.gld-tab-active {
    color: var(--scorm-primary-color, #0073aa);
    border-bottom-color: var(--scorm-primary-color, #0073aa);
}
.gld-tab-content {
    display: none;
    padding-top: 20px;
}
.gld-tab-content.gld-tab-active { display: block; }

/* ── Add learner bar ── */
.gld-add-learner {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
}
.gld-section { /* keep for email form */ }

/* ── Table ── */
.gld-table-wrap { overflow-x: auto; }
.gld-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--scorm-surface-color, #fff);
    border: 1px solid var(--scorm-border-color, #e2e8f0);
    border-radius: 10px;
    overflow: hidden;
}
.gld-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--scorm-muted-text-color, #64748b);
    background: var(--scorm-surface-muted-color, #f8fafc);
    border-bottom: 1px solid var(--scorm-border-color, #e2e8f0);
    font-weight: 600;
    white-space: nowrap;
}
.gld-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--scorm-border-color, #f1f5f9);
    font-size: 0.92em;
    vertical-align: middle;
}
.gld-table tbody tr:last-child td { border-bottom: none; }
.gld-table tbody tr:hover { background: var(--scorm-surface-muted-color, #f8fafc); }
.gld-course-col { text-align: center; width: 60px; }

/* User cell */
.gld-user { display: flex; align-items: center; gap: 10px; }
.gld-user img { border-radius: 50%; width: 28px; height: 28px; flex-shrink: 0; }
.gld-user-name { display: block; font-weight: 500; color: var(--scorm-heading-color, #0f172a); line-height: 1.3; }
.gld-user-email { display: block; font-size: 0.82em; color: var(--scorm-muted-text-color, #94a3b8); }

/* Status dots */
.gld-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.gld-dot-gray { background: #cbd5e1; }
.gld-dot-orange { background: #f59e0b; }
.gld-dot-green { background: #10b981; }

/* Action buttons */
.gld-actions { white-space: nowrap; }
.gld-icon-btn {
    background: none;
    border: 1px solid var(--scorm-border-color, #e2e8f0);
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
    color: var(--scorm-muted-text-color, #94a3b8);
    transition: all 0.15s;
    margin-left: 4px;
    line-height: 1;
}
.gld-icon-btn .dashicons { font-size: 16px; width: 16px; height: 16px; }
.gld-icon-btn:hover { color: var(--scorm-primary-color, #0073aa); border-color: var(--scorm-primary-color, #0073aa); background: #f0f9ff; }
.gld-icon-btn-danger:hover { color: #ef4444; border-color: #fca5a5; background: #fef2f2; }

/* ── Courses list ── */
.gld-courses-list { display: flex; flex-direction: column; gap: 12px; }
.gld-course-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
    background: var(--scorm-surface-color, #fff);
    border: 1px solid var(--scorm-border-color, #e2e8f0);
    border-radius: 10px;
}
.gld-course-info { flex: 1; min-width: 0; }
.gld-course-info h4 {
    margin: 0 0 8px;
    font-size: 1em;
    font-weight: 600;
    color: var(--scorm-heading-color, #0f172a);
}
.gld-course-link {
    color: inherit;
    text-decoration: none;
}
.gld-course-link:hover {
    color: var(--scorm-primary-color, #0073aa);
}
.gld-course-link .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
    vertical-align: middle;
    opacity: 0.4;
}
.gld-subtle-link {
    color: var(--scorm-primary-color, #0073aa);
    text-decoration: none;
}
.gld-subtle-link:hover {
    text-decoration: underline;
}
.gld-course-breakdown { display: flex; gap: 8px; flex-shrink: 0; }
.gld-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78em;
    font-weight: 500;
    white-space: nowrap;
}
.gld-badge-green { background: #d1fae5; color: #065f46; }
.gld-badge-orange { background: #fef3c7; color: #92400e; }
.gld-badge-gray { background: #f1f5f9; color: #475569; }

/* ── Email form ── */
.gld-email-form {
    background: var(--scorm-surface-color, #fff);
    border: 1px solid var(--scorm-border-color, #e2e8f0);
    border-radius: 10px;
    padding: 24px;
}
.gld-form-row { margin-bottom: 16px; }
.gld-form-row label {
    display: block;
    font-size: 0.82em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--scorm-muted-text-color, #64748b);
    margin-bottom: 6px;
}
.gld-select, .gld-input, .gld-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--scorm-border-color, #d1d5db);
    border-radius: 8px;
    font-size: 0.95em;
    background: var(--scorm-surface-color, #fff);
    color: var(--scorm-text-color, #334155);
    font-family: inherit;
    box-sizing: border-box;
}
.gld-select:focus, .gld-input:focus, .gld-textarea:focus {
    outline: none;
    border-color: var(--scorm-primary-color, #0073aa);
    box-shadow: 0 0 0 2px rgba(0,115,170,0.15);
}
.gld-textarea { resize: vertical; min-height: 100px; }
.gld-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.gld-email-hint { font-size: 0.82em; color: var(--scorm-muted-text-color, #94a3b8); }
.gld-email-stats { font-size: 0.82em; color: var(--scorm-muted-text-color, #94a3b8); margin: 12px 0 0; text-align: right; }

/* ── Buttons ── */
.gld-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.92em;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: opacity 0.15s;
}
.gld-btn .dashicons { font-size: 16px; width: 16px; height: 16px; }
.gld-btn-primary {
    background: var(--scorm-primary-color, #0073aa);
    color: #fff;
}
.gld-btn-primary:hover { opacity: 0.9; }
.gld-btn-outline {
    background: var(--scorm-surface-color, #fff);
    color: var(--scorm-text-color, #334155);
    border: 1px solid var(--scorm-border-color, #d1d5db);
    text-decoration: none;
}
.gld-btn-outline:hover {
    border-color: var(--scorm-primary-color, #0073aa);
    color: var(--scorm-primary-color, #0073aa);
    background: #f0f9ff;
}
.gld-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Empty state ── */
.gld-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--scorm-muted-text-color, #94a3b8);
}
.gld-empty-state .dashicons { font-size: 40px; width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.4; }
.gld-empty-state h3 { margin: 0 0 4px; color: var(--scorm-heading-color, #64748b); font-size: 1.1em; }
.gld-empty-state p { margin: 0; font-size: 0.9em; }

/* ── Toast ── */
.gld-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.92em;
    z-index: 99999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    animation: gld-toast-in 0.25s ease;
    max-width: 340px;
}
.gld-toast-error { background: #ef4444; }
.gld-toast-success { background: #059669; }
@keyframes gld-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Email modal (inline per-user) ── */
.gld-email-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: gld-toast-in 0.2s ease;
}
.gld-email-modal-body {
    background: var(--scorm-surface-color, #fff);
    border-radius: 12px;
    padding: 28px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.gld-email-modal-body h3 { margin: 0 0 16px; font-size: 1.1em; }
.gld-email-modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.gld-btn-ghost {
    background: none;
    border: 1px solid var(--scorm-border-color, #d1d5db);
    color: var(--scorm-text-color, #334155);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.92em;
    cursor: pointer;
    font-family: inherit;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .gld-stats-row { grid-template-columns: repeat(2, 1fr); }
    .gld-course-row { flex-direction: column; align-items: flex-start; }
    .gld-course-breakdown { flex-wrap: wrap; }
    .gld-summary { flex-direction: column; }
    .gld-add-learner { flex-direction: column; }
    .gld-add-learner .gld-select { width: 100%; }
    .gld-form-footer { flex-direction: column; gap: 10px; align-items: flex-start; }
}
@media (max-width: 480px) {
    .gld-stats-row { grid-template-columns: 1fr 1fr; }
    .gld-tabs { overflow-x: auto; }
}
