/* ============================================================================
 *  SBM BALLOT — Voter portal styles  (ballot/voter/voter.css)
 *  Standalone (public) — does not inherit the admin shell tokens.
 * ========================================================================== */
:root {
	--blue: #0071e3; --blue-hover: #005bbf;
	--card: rgba(255,255,255,0.98);
	--text: #1d1d1f; --sub: #6e6e73; --line: #ececf0;
	--green: #34c759; --red: #ff3b30;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
	min-height: 100vh; color: var(--text);
	background: linear-gradient(165deg, #0a0f1e 0%, #0a1628 50%, #0c1a35 100%);
	position: relative; overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
.vp-orb { position: fixed; border-radius: 50%; filter: blur(90px); opacity: 0.3; pointer-events: none; z-index: 0; animation: vpFloat 18s ease-in-out infinite; }
.vp-orb-1 { width: 380px; height: 380px; background: radial-gradient(circle,#3b82f6,#1e40af); top:-100px; left:-90px; }
.vp-orb-2 { width: 300px; height: 300px; background: radial-gradient(circle,#8b5cf6,#4c1d95); bottom:-90px; right:-70px; animation-delay:-7s; }
@keyframes vpFloat { 0%,100%{transform:translate(0,0)} 50%{transform:translate(24px,28px)} }

.vp-shell { position: relative; z-index: 2; min-height: 100vh; display: flex; flex-direction: column; }
.vp-shell.vp-center { align-items: center; justify-content: center; padding: 20px; }

/* Topbar */
.vp-topbar {
	display: flex; align-items: center; justify-content: space-between;
	padding: 16px 22px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
	background: rgba(10,15,30,0.5); border-bottom: 1px solid rgba(255,255,255,0.08);
	position: sticky; top: 0; z-index: 10;
}
.vp-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; }
.vp-brand i { color: #60a5fa; }
.vp-brand span { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-logout {
	display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
	color: rgba(255,255,255,0.75); font-size: 13px; font-weight: 600;
	padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12);
	background: rgba(255,255,255,0.05); transition: all .2s;
}
.vp-logout:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.35); color: #fff; }

/* Main - Enhanced width for dashboard */
.vp-main { 
	flex: 1; 
	width: 100%; 
	max-width: 780px; /* Increased from 640px for wider dashboard */
	margin: 0 auto; 
	padding: 24px 18px 60px; 
}
.vp-ballot { max-width: 1040px; }

/* Cards - Enhanced padding for better spacing */
.vp-card { 
	background: var(--card); 
	border-radius: 20px; 
	padding: 28px 32px; /* Increased from 22px */
	margin-bottom: 18px; 
	box-shadow: 0 18px 44px rgba(0,0,0,0.32); 
}

/* Welcome - Enhanced for wider cards */
.vp-welcome { 
	display: flex; 
	align-items: center; 
	gap: 20px; /* Increased from 16px */
	padding: 30px 32px !important; /* Override for welcome card */
}
.vp-avatar { 
	width: 72px; /* Increased from 62px */
	height: 72px; /* Increased from 62px */
	border-radius: 50%; 
	object-fit: cover; 
	border: 3px solid rgba(0,113,227,0.2); 
	flex-shrink: 0; 
}
.vp-hi { font-size: 13px; color: var(--sub); }
.vp-name { 
	font-size: 22px; /* Increased from 19px */
	font-weight: 800; 
	letter-spacing: -0.4px; 
}
.vp-meta { font-size: 12.5px; color: var(--sub); margin-top: 2px; }

/* Election block */
.vp-elec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.vp-elec-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--blue); }
.vp-elec-name { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; margin-top: 4px; }
.vp-badge { font-size: 11.5px; font-weight: 700; padding: 5px 11px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
.vp-badge.open { background: rgba(52,199,89,0.14); color: #1e9e4a; }
.vp-badge.done { background: rgba(0,113,227,0.1); color: var(--blue); }

/* Stats - Enhanced for wider cards */
.vp-elec-stats { 
	display: flex; 
	gap: 14px; 
	margin-bottom: 20px; 
}
.vp-elec-stats > div { 
	flex: 1; 
	text-align: center; 
	background: #f5f5f7; 
	border-radius: 14px; 
	padding: 18px !important; /* Increased from 14px */
}
.vp-stat-val { 
	font-size: 28px !important; /* Increased from 24px */
	font-weight: 800; 
	letter-spacing: -0.5px; 
}
.vp-stat-lbl { font-size: 11.5px; color: var(--sub); margin-top: 2px; }

/* Buttons - Enhanced for wider cards */
.vp-btn {
	display: flex; align-items: center; justify-content: center; gap: 9px;
	width: 100%; 
	padding: 16px !important; /* Increased from 14px */
	border: none; border-radius: 13px;
	background: var(--blue); color: #fff; 
	font-family: inherit; 
	font-size: 16px !important; /* Increased from 15px */
	font-weight: 700;
	cursor: pointer; text-decoration: none; transition: background .2s, transform .1s;
}
.vp-btn:hover { background: var(--blue-hover); }
.vp-btn:active { transform: scale(0.99); }
.vp-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.vp-btn-lg { padding: 16px; font-size: 16px; }
.vp-note { text-align: center; font-size: 11.5px; color: var(--sub); margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 7px; }

.vp-voted-note {
	display: flex; align-items: center; gap: 14px; padding: 16px;
	background: rgba(52,199,89,0.1); border: 1px solid rgba(52,199,89,0.25); border-radius: 14px;
}
.vp-voted-note i { font-size: 24px; color: var(--green); }
.vp-voted-note b { display: block; font-size: 14px; }
.vp-voted-note span { display: block; font-size: 12px; color: var(--sub); margin-top: 2px; }

/* Progress */
.vp-progress-wrap { position: sticky; top: 66px; z-index: 5; margin-bottom: 16px; background: rgba(10,15,30,0.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 14px; padding: 12px 16px; }
.vp-progress-text { font-size: 12.5px; color: #fff; font-weight: 600; margin-bottom: 8px; }
.vp-progress-bar { height: 6px; background: rgba(255,255,255,0.15); border-radius: 4px; overflow: hidden; }
.vp-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg,#3b82f6,#8b5cf6); border-radius: 4px; transition: width .3s ease; }

/* Position card */
.vp-position { border: 2px solid transparent; transition: border-color .25s; }
.vp-position.answered { border-color: rgba(52,199,89,0.35); }
.vp-pos-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.vp-pos-num { width: 30px; height: 30px; border-radius: 9px; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.vp-pos-name { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }
.vp-pos-sub { font-size: 12px; color: var(--sub); margin-top: 1px; }

/* Candidates grid */
/* Fluid: items flow left-to-right and wrap after 4 per row; when there are
   only 2-3 they sit to the left rather than stretching across the row. */
.vp-candidates { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.vp-candidate {
	/* 4 across the row, accounting for the 14px gaps between them */
	flex: 0 0 calc((100% - 3 * 14px) / 4);
	max-width: 220px;
}
@media (max-width: 900px) { .vp-candidate { flex-basis: calc((100% - 2 * 14px) / 3); } }
@media (max-width: 560px) { .vp-candidate { flex-basis: calc((100% - 14px) / 2); } }
.vp-candidate { position: relative; cursor: pointer; }
.vp-candidate input { position: absolute; opacity: 0; pointer-events: none; }
.vp-cand-inner {
	border: 2px solid var(--line); border-radius: 16px; padding: 12px; text-align: center;
	transition: all .2s; background: #fff; position: relative;
}
.vp-candidate:hover .vp-cand-inner { border-color: #c7d8f0; }
.vp-cand-inner img { width: 100%; aspect-ratio: 1 / 1; height: auto; border-radius: 14px; object-fit: cover; border: 2px solid var(--line); display: block; }
.vp-cand-name { font-size: 13.5px; font-weight: 600; margin-top: 10px; line-height: 1.35; }
.vp-cand-check {
	position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
	background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center;
	font-size: 11px; opacity: 0; transform: scale(0.5); transition: all .2s;
}
.vp-candidate input:checked + .vp-cand-inner { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,113,227,0.12); background: #f5faff; }
.vp-candidate input:checked + .vp-cand-inner .vp-cand-check { opacity: 1; transform: scale(1); }

.vp-abstain .vp-abstain-icon { width: 100%; aspect-ratio: 1 / 1; border-radius: 14px; background: #f5f5f7; display: flex; align-items: center; justify-content: center; color: var(--sub); font-size: 40px; }
.vp-abstain input:checked + .vp-cand-inner { border-color: var(--sub); box-shadow: 0 0 0 4px rgba(110,110,115,0.12); background: #fafafa; }
.vp-abstain input:checked + .vp-cand-inner .vp-cand-check { background: var(--sub); }

.vp-submit-card { text-align: center; }

/* Empty */
.vp-empty { text-align: center; padding: 30px 16px; }
.vp-empty i { font-size: 36px; color: #c7c7cc; margin-bottom: 14px; }
.vp-empty h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.vp-empty p { font-size: 13px; color: var(--sub); line-height: 1.6; }

/* Success */
.vp-success { text-align: center; max-width: 400px; padding: 40px 30px; }
.vp-success-ring { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 22px; background: linear-gradient(135deg,#34c759,#28a745); display: flex; align-items: center; justify-content: center; box-shadow: 0 14px 34px rgba(52,199,89,0.4); animation: vpPop .5s cubic-bezier(0.34,1.56,0.64,1); }
.vp-success-ring i { color: #fff; font-size: 38px; }
@keyframes vpPop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.vp-success h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.vp-success p { font-size: 14px; color: var(--sub); margin-top: 12px; line-height: 1.6; }
.vp-success-sub { font-size: 12.5px !important; }
.vp-success .vp-btn { margin-top: 22px; }

/* Footer */
.vp-foot { text-align: center; padding: 20px; font-size: 11px; color: rgba(255,255,255,0.4); position: relative; z-index: 2; }
.swal-compact { font-size: 14px !important; }

/* ============================================================================
 *  Modern modal + toast (replaces SweetAlert in the voter section)
 * ========================================================================== */
.bxm-overlay {
	position: fixed; inset: 0; z-index: 9000;
	background: rgba(6, 10, 22, 0.66);
	backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
	display: none; align-items: center; justify-content: center; padding: 20px;
	opacity: 0; transition: opacity .22s ease;
}
.bxm-overlay.show { display: flex; opacity: 1; }
.bxm-modal {
	background: #fff; border-radius: 22px; width: 100%; max-width: 440px;
	max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
	box-shadow: 0 30px 80px rgba(0,0,0,0.5);
	transform: translateY(16px) scale(0.96); opacity: 0;
	transition: transform .28s cubic-bezier(0.34,1.56,0.64,1), opacity .22s ease;
}
.bxm-overlay.show .bxm-modal { transform: none; opacity: 1; }
.bxm-modal.wide { max-width: 560px; }
.bxm-head { padding: 26px 26px 6px; text-align: center; }
.bxm-icon {
	width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 16px;
	display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff;
}
.bxm-icon.info    { background: linear-gradient(135deg,#0071e3,#4c1d95); }
.bxm-icon.success { background: linear-gradient(135deg,#34c759,#28a745); }
.bxm-icon.warn    { background: linear-gradient(135deg,#ff9f0a,#ff7a00); }
.bxm-icon.error   { background: linear-gradient(135deg,#ff3b30,#c0241a); }
.bxm-title { font-size: 19px; font-weight: 800; color: #1d1d1f; letter-spacing: -0.4px; }
.bxm-body { padding: 12px 26px 8px; overflow-y: auto; color: #444; font-size: 14px; line-height: 1.6; }
.bxm-body.center { text-align: center; }
.bxm-foot { padding: 18px 26px 24px; display: flex; gap: 10px; }
.bxm-foot.stack { flex-direction: column; }
.bxm-btn {
	flex: 1; padding: 13px 16px; border: none; border-radius: 13px;
	font-family: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer;
	transition: filter .15s, transform .1s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.bxm-btn:active { transform: scale(0.99); }
.bxm-btn-primary { background: #0071e3; color: #fff; }
.bxm-btn-primary:hover { filter: brightness(1.06); }
.bxm-btn-ghost { background: #f0f0f3; color: #333; }
.bxm-btn-ghost:hover { background: #e6e6ea; }
.bxm-btn-success { background: #34c759; color: #fff; }
.bxm-btn-danger { background: #ff3b30; color: #fff; }

/* Toast */
.bxm-toast-wrap { position: fixed; top: 18px; left: 0; right: 0; z-index: 9500; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.bxm-toast {
	background: #1d1d1f; color: #fff; padding: 12px 18px; border-radius: 12px;
	font-size: 13.5px; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,0.35);
	display: flex; align-items: center; gap: 9px; max-width: 90vw;
	transform: translateY(-14px); opacity: 0; transition: all .3s cubic-bezier(0.34,1.56,0.64,1);
}
.bxm-toast.show { transform: none; opacity: 1; }
.bxm-toast.success i { color: #4ade80; }
.bxm-toast.error i { color: #ff6b6b; }
.bxm-toast.warn i { color: #fbbf24; }

/* Instruction list (dashboard modal) */
.bxm-steps { list-style: none; padding: 0; margin: 4px 0; text-align: left; }
.bxm-steps li { display: flex; gap: 12px; padding: 9px 0; align-items: flex-start; }
.bxm-steps .num { flex-shrink: 0; width: 24px; height: 24px; border-radius: 8px; background: rgba(0,113,227,0.1); color: #0071e3; font-weight: 700; font-size: 12.5px; display: flex; align-items: center; justify-content: center; }
.bxm-steps .txt { font-size: 13.5px; color: #444; line-height: 1.5; }

/* ============================================================================
 *  Header logo + centered ballot info (vote page)
 * ========================================================================== */
.vp-brand-logo { height: 30px; width: 30px; border-radius: 7px; object-fit: contain; background: #fff; padding: 2px; }
.vp-ballot-info { text-align: center; margin: 4px auto 18px; max-width: 620px; }
.vp-ballot-election { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -0.4px; line-height: 1.25; }
.vp-ballot-count { display: inline-block; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: #dfe7f5; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); padding: 5px 14px; border-radius: 999px; }

/* ============================================================================
 *  Review page
 * ========================================================================== */
.vp-review-list { display: flex; flex-direction: column; }
.vp-review-row { padding: 14px 4px; border-bottom: 1px solid var(--line); }
.vp-review-row:last-child { border-bottom: none; }
.vp-review-pos { font-size: 12.5px; font-weight: 600; color: var(--sub); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.4px; }
.vp-review-cand { display: flex; align-items: center; gap: 14px; }
.vp-review-cand img { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; border: 2px solid var(--line); flex-shrink: 0; }
.vp-review-cand span { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
.vp-review-tick { color: #34c759; font-size: 20px; }
.vp-btn-secondary { display: block; width: 100%; text-align: center; margin-top: 10px; padding: 12px; border-radius: 13px; background: transparent; color: var(--blue); font-weight: 600; font-size: 14px; text-decoration: none; border: 1px solid var(--line); }
.vp-btn-secondary:hover { background: #f5f7fb; }

/* ============================================================================
 *  Voter results page
 * ========================================================================== */
.vp-result-pos { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.vp-result-total { font-size: 12px; font-weight: 600; color: var(--sub); white-space: nowrap; }
.vp-result-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.vp-result-row:last-child { border-bottom: none; }
.vp-result-row.win { background: rgba(52,199,89,0.06); border-radius: 12px; padding-left: 10px; padding-right: 10px; }
.vp-result-row img { width: 46px; height: 46px; border-radius: 11px; object-fit: cover; border: 2px solid var(--line); flex-shrink: 0; }
.vp-result-body { flex: 1; min-width: 0; }
.vp-result-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.vp-result-name { font-size: 14px; font-weight: 700; color: var(--text); }
.vp-result-num { font-size: 12.5px; font-weight: 700; color: var(--sub); white-space: nowrap; }
.vp-result-bar { height: 8px; background: #eef0f4; border-radius: 5px; overflow: hidden; }
.vp-result-fill { height: 100%; background: linear-gradient(90deg,#0071e3,#8b5cf6); border-radius: 5px; }
.vp-result-fill.win { background: linear-gradient(90deg,#34c759,#28a745); }
.vp-result-verdict { margin-top: 12px; font-size: 12.5px; font-weight: 700; color: var(--sub); text-align: center; padding-top: 10px; border-top: 1px dashed var(--line); }

/* ============================================================================
 *  Dashboard specific enhancements
 * ========================================================================== */

/* Election dates info - clean layout with right-aligned end date */
.vp-election-dates {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 13px;
	color: #64748b;
	padding: 4px 0;
}

.vp-election-dates .vp-date-start,
.vp-election-dates .vp-date-end {
	display: flex;
	align-items: center;
	gap: 6px;
}

.vp-election-dates .vp-date-end {
	margin-left: auto; /* Push to the right */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 640px) {
	.vp-main {
		max-width: 100%;
		padding: 16px 12px 40px;
	}
	
	.vp-card {
		padding: 20px 16px !important;
	}
	
	.vp-welcome {
		padding: 20px 16px !important;
		gap: 14px;
	}
	
	.vp-avatar {
		width: 56px !important;
		height: 56px !important;
	}
	
	.vp-name {
		font-size: 18px !important;
	}
	
	.vp-elec-stats > div {
		padding: 14px !important;
	}
	
	.vp-stat-val {
		font-size: 22px !important;
	}
	
	.vp-btn {
		padding: 14px !important;
		font-size: 14px !important;
	}
	
	.vp-election-dates {
		flex-direction: column;
		gap: 6px;
		align-items: flex-start;
	}
	
	.vp-election-dates .vp-date-end {
		margin-left: 0;
	}
}

/* Smooth hover effects for cards */
.vp-card {
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.vp-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 20px 48px rgba(0,0,0,0.36);
}

/* Improve button hover states */
.vp-btn {
	position: relative;
	overflow: hidden;
}

.vp-btn::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(255,255,255,0.1);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.vp-btn:hover::after {
	opacity: 1;
}

/* Enhanced badge styling */
.vp-badge {
	position: relative;
	transition: all 0.2s ease;
}

.vp-badge.open {
	animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.7; }
}

/* Stats hover effect */
.vp-elec-stats > div {
	transition: all 0.2s ease;
	cursor: default;
}

.vp-elec-stats > div:hover {
	transform: scale(1.02);
	box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Voted note enhancement */
.vp-voted-note {
	transition: all 0.2s ease;
}

.vp-voted-note:hover {
	background: rgba(52,199,89,0.15);
	border-color: rgba(52,199,89,0.4);
}