/* Elevate Incentives — frontend portal styles */
.ei-portal {
	--ei-bg: #ffffff;
	--ei-fg: #0f172a;
	--ei-muted: #64748b;
	--ei-line: #e5e7eb;
	--ei-brand: #2563eb;
	--ei-brand-dark: #1d4ed8;
	--ei-good: #16a34a;
	--ei-bad: #dc2626;
	--ei-soft: #f8fafc;
	max-width: 1080px;
	margin: 0 auto;
	color: var(--ei-fg);
	/* Inherit the theme's font by default (Impreza etc.); set --ei-font to override. */
	font-family: var(--ei-font, inherit);
}
.ei-portal * { box-sizing: border-box; }

.ei-portal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 8px 0 20px;
	border-bottom: 1px solid var(--ei-line);
	margin-bottom: 24px;
}
.ei-portal-head h2 { margin: 0 0 4px; font-size: 24px; }
.ei-muted { color: var(--ei-muted); }
.ei-logout {
	font-size: 14px;
	color: var(--ei-muted);
	text-decoration: none;
	border: 1px solid var(--ei-line);
	padding: 8px 14px;
	border-radius: 8px;
	white-space: nowrap;
}
.ei-logout:hover { border-color: var(--ei-brand); color: var(--ei-brand); }

.ei-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-bottom: 28px;
}
.ei-stat {
	background: var(--ei-soft);
	border: 1px solid var(--ei-line);
	border-radius: 12px;
	padding: 20px;
	text-align: center;
}
.ei-stat-num { display: block; font-size: 30px; font-weight: 800; line-height: 1; }
.ei-stat-label { display: block; margin-top: 8px; font-size: 13px; color: var(--ei-muted); }

.ei-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--ei-line); margin-bottom: 24px; }
.ei-tab {
	background: none; border: none; cursor: pointer;
	padding: 12px 18px; font-size: 15px; font-weight: 600; color: var(--ei-muted);
	border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ei-tab.is-active { color: var(--ei-brand); border-bottom-color: var(--ei-brand); }

.ei-panel { display: none; }
.ei-panel.is-active { display: block; }

.ei-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.ei-video-card, .ei-reward-card {
	border: 1px solid var(--ei-line);
	border-radius: 12px;
	overflow: hidden;
	background: var(--ei-bg);
	transition: box-shadow .15s ease;
}
.ei-video-card:hover, .ei-reward-card:hover { box-shadow: 0 6px 22px rgba(15,23,42,.08); }
.ei-video-card.is-complete { border-color: var(--ei-good); }

.ei-video-wrap { position: relative; background: #000; aspect-ratio: 16/9; }
.ei-video-embed, .ei-video-embed .ei-yt-target, .ei-html5-video, .ei-vimeo-frame,
.ei-video-embed iframe { width: 100%; height: 100%; display: block; }
.ei-video-wrap iframe, .ei-video-wrap video, .ei-video-wrap .ei-yt-target {
	position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.ei-video-body { padding: 16px; }
.ei-video-body h3, .ei-reward-body h3 { margin: 0 0 6px; font-size: 17px; }
.ei-video-meta, .ei-reward-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }

.ei-pill {
	display: inline-block; background: #eff6ff; color: var(--ei-brand-dark);
	font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.ei-pill-muted { background: #f1f5f9; color: var(--ei-muted); }
.ei-status { font-size: 13px; color: var(--ei-muted); }

.ei-reward-img { height: 150px; background-size: cover; background-position: center; background-color: var(--ei-soft); }
.ei-reward-body { padding: 16px; }
.ei-progress { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin: 12px 0 4px; }
.ei-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--ei-brand), #38bdf8); transition: width .4s ease; }

.ei-btn, .ei-claim {
	display: inline-block; width: 100%; margin-top: 14px; cursor: pointer;
	background: var(--ei-brand); color: #fff; border: none; border-radius: 8px;
	padding: 11px 16px; font-size: 15px; font-weight: 700;
}
.ei-btn:hover, .ei-claim:hover { background: var(--ei-brand-dark); }
.ei-claim:disabled { background: #cbd5e1; cursor: not-allowed; }

.ei-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ei-table th, .ei-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--ei-line); }
.ei-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ei-muted); }
.ei-right { text-align: right; }
.ei-pos { color: var(--ei-good); font-weight: 700; }
.ei-neg { color: var(--ei-bad); font-weight: 700; }

.ei-leaderboard { list-style: none; margin: 0; padding: 0; }
.ei-leaderboard li { display: flex; align-items: center; gap: 14px; padding: 12px 8px; border-bottom: 1px solid var(--ei-line); }
.ei-rank { width: 28px; height: 28px; border-radius: 50%; background: var(--ei-soft); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.ei-leaderboard li:nth-child(1) .ei-rank { background: #fde68a; }
.ei-leaderboard li:nth-child(2) .ei-rank { background: #e5e7eb; }
.ei-leaderboard li:nth-child(3) .ei-rank { background: #fed7aa; }
.ei-lb-name { flex: 1; font-weight: 600; }
.ei-lb-pts { color: var(--ei-brand-dark); font-weight: 700; }

.ei-status-pending { background: #fef3c7; color: #92400e; }
.ei-status-fulfilled { background: #dcfce7; color: #166534; }
.ei-status-cancelled { background: #fee2e2; color: #991b1b; }

.ei-card { border: 1px solid var(--ei-line); border-radius: 12px; padding: 28px; max-width: 420px; margin: 40px auto; }
.ei-login-prompt .ei-card h2 { margin-top: 0; }

/* Toasts */
#ei-toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 99999; display: flex; flex-direction: column; gap: 10px; }
.ei-toast {
	background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 10px;
	font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2);
	opacity: 0; transform: translateY(10px); transition: all .3s ease; max-width: 320px;
}
.ei-toast.is-in { opacity: 1; transform: translateY(0); }
.ei-toast-success { background: #16a34a; }
.ei-toast-error { background: #dc2626; }

/* Element titles */
.ei-el-title { font-size: 20px; margin: 0 0 16px; }

/* Notices */
.ei-notice { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.ei-notice-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.ei-notice-error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* Admin preview badge */
.ei-badge-preview {
	display: inline-block; vertical-align: middle; margin-left: 8px;
	font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
	background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 999px;
}

/* Nav links */
.ei-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.ei-links .ei-link {
	text-decoration: none; font-size: 14px; font-weight: 600; color: var(--ei-brand-dark);
	border: 1px solid var(--ei-line); padding: 8px 14px; border-radius: 8px;
}
.ei-links .ei-link:hover { border-color: var(--ei-brand); background: var(--ei-soft); }
.ei-reg-links { margin-top: 14px; }

/* Native auth forms */
.ei-auth-form { margin-top: 4px; }
.ei-auth-form .ei-inline-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.ei-auth-form .ei-inline-check input { width: auto; }
.ei-login-prompt .ei-btn { width: 100%; }

/* Forms */
.ei-form { display: flex; flex-direction: column; gap: 14px; }
.ei-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ei-fg); }
.ei-form input {
	width: 100%; padding: 10px 12px; border: 1px solid var(--ei-line); border-radius: 8px;
	font-size: 15px; font-weight: 400;
}
.ei-form input:focus { outline: none; border-color: var(--ei-brand); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.ei-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ei-hint { font-size: 12px; font-weight: 400; color: var(--ei-muted); }
.ei-form .ei-btn { margin-top: 4px; }
.ei-code { background: var(--ei-soft); border: 1px solid var(--ei-line); padding: 2px 8px; border-radius: 6px; font-weight: 700; letter-spacing: .05em; }

/* Bulk bar + pending */
.ei-bulkbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.ei-bulkbar label { font-size: 14px; color: var(--ei-muted); }
.ei-btn-sm { width: auto; margin: 0; padding: 8px 14px; font-size: 13px; }
.ei-btn-ghost { background: #fff; color: var(--ei-bad); border: 1px solid var(--ei-line); }
.ei-btn-ghost:hover { background: #fef2f2; }
.ei-count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: #fee2e2; color: #991b1b; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.ei-row-actions a { text-decoration: none; }

/* Quizzes */
.ei-quiz { margin-top: 14px; border-top: 1px solid var(--ei-line); padding-top: 12px; }
.ei-quiz-result { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ei-quiz-toggle { display: inline-block; }
.ei-quiz-lock { font-size: 12px; margin: 8px 0 0; }
.ei-quiz[data-ei-quiz-state="ready"] .ei-quiz-lock { display: none; }
.ei-quiz[data-ei-quiz-state="locked"] .ei-quiz-toggle { opacity: .5; cursor: not-allowed; }
.ei-quiz-form { display: none; margin-top: 12px; }
.ei-quiz.is-open .ei-quiz-form { display: block; }
.ei-quiz-q { border: 1px solid var(--ei-line); border-radius: 8px; padding: 12px 14px; margin: 0 0 10px; }
.ei-quiz-q legend { font-weight: 700; font-size: 14px; padding: 0 4px; }
.ei-quiz-opt { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.ei-quiz-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.ei-quiz-feedback { margin-top: 10px; font-size: 13px; font-weight: 600; }
.ei-quiz-retry { color: #92400e; }
.ei-quiz-error { color: var(--ei-bad); }

/* View controls: grid / theater toggle */
.ei-view-bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-bottom: 14px; }
.ei-view-btn {
	background: #fff; border: 1px solid var(--ei-line); border-radius: 8px; cursor: pointer;
	padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--ei-muted);
}
.ei-view-btn.is-active { border-color: var(--ei-brand); color: var(--ei-brand); background: var(--ei-soft); }

/* Theater view: single large column */
.ei-grid.ei-view-theater { grid-template-columns: 1fr; max-width: 820px; margin-left: auto; margin-right: auto; }

/* Per-video expand: card spans the full grid width */
.ei-video-card { position: relative; }
.ei-video-expand {
	position: absolute; top: 8px; right: 8px; z-index: 2;
	background: rgba(15,23,42,.7); color: #fff; border: none; border-radius: 6px;
	width: 32px; height: 32px; font-size: 15px; cursor: pointer; line-height: 1;
}
.ei-video-expand:hover { background: rgba(15,23,42,.9); }
.ei-video-card.is-expanded { grid-column: 1 / -1; }
.ei-video-card.is-expanded .ei-video-wrap { max-width: 900px; margin: 0 auto; width: 100%; }

/* Plan cards */
.ei-plan-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ei-plan-card { border: 1px solid var(--ei-line); border-radius: 12px; padding: 20px; text-align: center; background: #fff; }
.ei-plan-card.is-current { border-color: var(--ei-brand); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.ei-plan-card h3 { margin: 0 0 6px; font-size: 18px; }
.ei-plan-price { font-size: 22px; font-weight: 800; color: var(--ei-brand-dark); margin-bottom: 12px; }
.ei-plan-caps { list-style: none; margin: 0 0 14px; padding: 0; font-size: 13px; color: var(--ei-muted); }
.ei-plan-caps li { padding: 3px 0; border-bottom: 1px dashed var(--ei-line); }
.ei-plan-card .ei-btn { width: 100%; }

/* Leaderboards two-column */
.ei-lb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 640px) { .ei-lb-cols { grid-template-columns: 1fr; } }

/* Workspace-admin manage panel */
.ei-manage-h { font-size: 18px; margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--ei-line); }
.ei-manage-form { max-width: 640px; margin-top: 16px; padding: 18px; border: 1px solid var(--ei-line); border-radius: 12px; background: var(--ei-soft); }
.ei-manage-form h4 { margin: 0 0 4px; font-size: 16px; }
.ei-manage-form select { width: 100%; padding: 10px 12px; border: 1px solid var(--ei-line); border-radius: 8px; font-size: 15px; background: #fff; }

/* Quiz builder */
.ei-qb-questions { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 12px; }
.ei-qb-q { background: #fff; border: 1px solid var(--ei-line); border-radius: 10px; padding: 12px; }
.ei-qb-qtext { width: 100%; margin-bottom: 8px; font-weight: 600; }
.ei-qb-opts { display: flex; flex-direction: column; gap: 6px; }
.ei-qb-opt { display: flex; align-items: center; gap: 8px; }
.ei-qb-opt input[type=radio] { flex-shrink: 0; }
.ei-qb-opt .ei-qb-otext { flex: 1; margin: 0; }
.ei-qb-x { background: none; border: none; color: var(--ei-bad); font-size: 18px; cursor: pointer; line-height: 1; padding: 0 6px; }
.ei-qb-qactions { display: flex; gap: 8px; margin-top: 10px; }

@media (max-width: 640px) {
	.ei-stats { grid-template-columns: 1fr; }
	.ei-portal-head { flex-direction: column; align-items: flex-start; }
	.ei-field-row { grid-template-columns: 1fr; }
}
