/*
 * Ideathon — Hlasování: veřejné styly.
 * Prefixované třídy (iv-) a CSS proměnné kvůli izolaci od motivu/Elementoru.
 */

.iv-root {
	--iv-teal: #2AA7B6;
	--iv-accent: #2AA7B6;
	--iv-bg: #f6fafb;
	--iv-card-bg: #ffffff;
	--iv-text: #1d2b2e;
	--iv-muted: #5b7176;
	--iv-radius: 16px;
	--iv-shadow: 0 6px 24px rgba(20, 80, 90, 0.08);
	--iv-gold: #f4c542;
	--iv-silver: #c0c7cc;
	--iv-bronze: #cd8b54;

	box-sizing: border-box;
	color: var(--iv-text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	line-height: 1.45;
	max-width: 1100px;
	margin: 0 auto;
}

.iv-root *,
.iv-root *::before,
.iv-root *::after {
	box-sizing: border-box;
}

/* --- Oznámení --- */
.iv-notice {
	padding: 14px 18px;
	border-radius: var(--iv-radius);
	background: #eef6f7;
	color: var(--iv-text);
	margin: 12px 0;
}
.iv-notice--info { background: #eef6f7; }
.iv-notice--error { background: #fdecec; color: #a4282a; }
.iv-notice--success { background: #e9f7ee; color: #1d6b3a; }

/* --- Tlačítka --- */
.iv-btn {
	display: inline-block;
	border: 0;
	border-radius: 999px;
	padding: 14px 28px;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	background: #e3edef;
	color: var(--iv-text);
	transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.iv-btn:hover { transform: translateY(-1px); }
.iv-btn--primary { background: var(--iv-teal); color: #fff; box-shadow: var(--iv-shadow); }
.iv-btn--primary:disabled { background: #c5d6d9; color: #fff; cursor: not-allowed; transform: none; box-shadow: none; }

/* ============================================================= *
 *  HLASOVÁNÍ
 * ============================================================= */
.iv-vote__hint { color: var(--iv-muted); margin: 0 0 16px; }

.iv-projects {
	display: grid;
	grid-template-columns: repeat(var(--iv-columns, 1), minmax(0, 1fr));
	gap: 18px;
}

.iv-card {
	background: var(--iv-card-bg);
	border-radius: var(--iv-radius);
	box-shadow: var(--iv-shadow);
	overflow: hidden;
	border-top: 5px solid var(--iv-accent);
	display: flex;
	flex-direction: column;
}

.iv-card__media {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #0c1416;
}
.iv-card__media .iv-video,
.iv-card__media .iv-embed,
.iv-card__media iframe,
.iv-card__media .iv-poster {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	border: 0;
}
.iv-embed { aspect-ratio: 16 / 9; }
.iv-embed iframe { width: 100%; height: 100%; }

.iv-poster {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--iv-accent);
	color: #fff;
	font-weight: 700;
	font-size: 1.3rem;
	text-align: center;
	padding: 16px;
}

.iv-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.iv-card__title { margin: 0; font-size: 1.15rem; }
.iv-card__team { margin: 0; color: var(--iv-accent); font-weight: 600; font-size: .9rem; }
.iv-card__tagline { margin: 0; color: var(--iv-muted); font-size: .92rem; }

/* Volič místa */
.iv-ranks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.iv-rank-btn {
	flex: 1 1 auto;
	min-height: 46px; /* dotykově pohodlné */
	border: 2px solid #dbe7e9;
	background: #fff;
	color: var(--iv-text);
	border-radius: 12px;
	font-weight: 700;
	cursor: pointer;
	transition: all .12s ease;
}
.iv-rank-btn:hover { border-color: var(--iv-accent); }
.iv-rank-btn:focus-visible { outline: 3px solid var(--iv-accent); outline-offset: 2px; }
.iv-rank-btn[aria-pressed="true"] {
	background: var(--iv-accent);
	border-color: var(--iv-accent);
	color: #fff;
}
.iv-rank-btn.iv-rank-btn--taken {
	opacity: .4;
	cursor: not-allowed;
}

/* Karta s vybraným místem */
.iv-card--selected { outline: 3px solid var(--iv-accent); outline-offset: 0; }
.iv-rank-btn--elsewhere { opacity: .55; }

/* Anotace + PDF na kartě */
.iv-card__annotation { margin: 6px 0 2px; }
.iv-card__annotation summary { cursor: pointer; color: var(--iv-accent); font-weight: 600; font-size: .9rem; }
.iv-card__annotation-body { color: var(--iv-muted); font-size: .92rem; margin-top: 6px; }
.iv-card__annotation-body p { margin: 0 0 .5em; }
.iv-card__pdf {
	display: inline-flex; align-items: center; gap: 6px;
	margin: 4px 0 2px; padding: 8px 14px;
	background: #eef6f7; color: var(--iv-text); text-decoration: none;
	border-radius: 10px; font-weight: 600; font-size: .9rem;
	align-self: flex-start;
}
.iv-card__pdf:hover { background: #e0eff1; }

/* Indikátor počtu hlasujících */
.iv-vote__voters {
	display: inline-flex; align-items: center; gap: 8px;
	margin: 0 0 4px; padding: 6px 14px;
	background: #eef6f7; border-radius: 999px;
	font-weight: 600; color: var(--iv-text); font-size: .9rem;
}
.iv-vote__voters-dot {
	width: 9px; height: 9px; border-radius: 50%;
	background: #2ec27a; box-shadow: 0 0 0 0 rgba(46,194,122,.6);
	animation: iv-pulse 2s infinite;
}
@keyframes iv-pulse {
	0% { box-shadow: 0 0 0 0 rgba(46,194,122,.6); }
	70% { box-shadow: 0 0 0 8px rgba(46,194,122,0); }
	100% { box-shadow: 0 0 0 0 rgba(46,194,122,0); }
}

/* Chip se souhrnem (sticky lišta) */
.iv-chip {
	background: #fff;
	border: 2px solid var(--iv-accent);
	border-radius: 999px;
	padding: 5px 12px;
	font-weight: 700;
	font-size: .85rem;
	white-space: nowrap;
	max-width: 220px;
	overflow: hidden;
	text-overflow: ellipsis;
}
.iv-chip--rank1 { border-color: var(--iv-gold); }
.iv-chip--rank2 { border-color: var(--iv-silver); }
.iv-chip--rank3 { border-color: var(--iv-bronze); }

/* Sticky lišta se souhrnem + odesláním */
.iv-vote__spacer { height: 4px; }
.iv-vote__bar {
	position: sticky;
	bottom: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	margin-top: 10px;
	background: rgba(255,255,255,.96);
	backdrop-filter: saturate(150%) blur(6px);
	border-radius: var(--iv-radius);
	box-shadow: 0 -6px 24px rgba(20,80,90,.12);
	border: 1px solid #e3edef;
}
.iv-vote__bar-summary {
	flex: 1 1 auto;
	display: flex;
	gap: 8px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}
.iv-vote__bar-empty { color: var(--iv-muted); font-weight: 500; align-self: center; }
.iv-vote__bar .iv-btn { flex: 0 0 auto; white-space: nowrap; }

/* Modal */
body.iv-modal-open { overflow: hidden; }
.iv-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.iv-modal[hidden] { display: none; }
.iv-modal__backdrop { position: absolute; inset: 0; background: rgba(12,20,22,.55); }
.iv-modal__dialog {
	position: relative;
	background: #fff;
	border-radius: var(--iv-radius);
	box-shadow: 0 20px 60px rgba(0,0,0,.3);
	width: 100%;
	max-width: 460px;
	max-height: 90vh;
	overflow-y: auto;
	padding: 24px 22px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.iv-modal__x {
	position: absolute; top: 8px; right: 12px;
	border: 0; background: transparent; cursor: pointer;
	font-size: 1.8rem; line-height: 1; color: var(--iv-muted);
}
.iv-modal__title { margin: 0; font-size: 1.25rem; }
.iv-btn--block { width: 100%; }

/* Podium (rekapitulace pořadí) */
.iv-podium { display: flex; flex-direction: column; gap: 8px; }
.iv-podium__row {
	display: grid;
	grid-template-columns: auto auto 1fr auto;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	border-radius: 12px;
	background: #f6fafb;
	border-left: 5px solid var(--iv-teal);
}
.iv-podium__row--1 { border-left-color: var(--iv-gold); }
.iv-podium__row--2 { border-left-color: var(--iv-silver); }
.iv-podium__row--3 { border-left-color: var(--iv-bronze); }
.iv-podium__medal { font-size: 1.3rem; }
.iv-podium__place { font-weight: 700; font-size: .85rem; color: var(--iv-muted); }
.iv-podium__name { font-weight: 700; }
.iv-podium__pts { font-weight: 700; color: var(--iv-teal); white-space: nowrap; }

.iv-field label { font-weight: 600; display: block; margin-bottom: 6px; }
.iv-field input[type="email"] {
	width: 100%;
	padding: 12px 14px;
	border: 2px solid #dbe7e9;
	border-radius: 12px;
	font-size: 1rem;
}
.iv-field input[type="email"]:focus-visible { outline: 3px solid var(--iv-accent); outline-offset: 1px; border-color: var(--iv-accent); }
.iv-consent { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.iv-consent input { margin-top: 4px; width: 18px; height: 18px; }

.iv-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.iv-vote__message { font-weight: 600; min-height: 1.2em; }
.iv-vote__message.is-error { color: #a4282a; }
.iv-vote__message.is-success { color: #1d6b3a; }

.iv-vote--done .iv-projects { opacity: .55; pointer-events: none; }

/* ============================================================= *
 *  VÝSLEDKY
 * ============================================================= */
.iv-results__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 16px; }
.iv-results__count { font-size: 2rem; font-weight: 800; color: var(--iv-teal); }
.iv-results__count-label { color: var(--iv-muted); }

.iv-results__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.iv-row {
	display: grid;
	grid-template-columns: 44px 1fr auto;
	gap: 14px;
	align-items: center;
	background: var(--iv-card-bg);
	border-radius: var(--iv-radius);
	box-shadow: var(--iv-shadow);
	padding: 14px 18px;
	border-left: 6px solid var(--iv-accent);
}
.iv-row__rank { font-size: 1.4rem; font-weight: 800; color: var(--iv-muted); text-align: center; }
.iv-row__main { min-width: 0; }
.iv-row__title { font-weight: 700; font-size: 1.05rem; }
.iv-row__team { color: var(--iv-muted); font-weight: 500; font-size: .85rem; }
.iv-bar { height: 10px; background: #e8eff0; border-radius: 999px; margin: 8px 0 6px; overflow: hidden; }
.iv-bar__fill { display: block; height: 100%; background: var(--iv-accent); border-radius: 999px; transition: width .5s ease; }
.iv-row__breakdown { display: flex; gap: 14px; color: var(--iv-muted); font-size: .85rem; }
.iv-row__points { text-align: right; white-space: nowrap; }
.iv-row__points strong { font-size: 1.5rem; color: var(--iv-teal); }
.iv-row__pct { display: block; color: var(--iv-muted); font-size: .8rem; }

/* Medailové odznaky */
.iv-row--rank1 { border-left-color: var(--iv-gold); }
.iv-row--rank2 { border-left-color: var(--iv-silver); }
.iv-row--rank3 { border-left-color: var(--iv-bronze); }
.iv-row--rank1 .iv-row__rank { color: var(--iv-gold); }
.iv-row--rank2 .iv-row__rank { color: var(--iv-silver); }
.iv-row--rank3 .iv-row__rank { color: var(--iv-bronze); }
.iv-row--rank1 { box-shadow: 0 8px 28px rgba(244, 197, 66, .25); }

/* ============================================================= *
 *  PROJEKTOR
 * ============================================================= */
.iv-projector {
	max-width: none;
	background: #0c1416;
	color: #fff;
	min-height: 100vh;
	padding: 32px clamp(16px, 4vw, 64px);
	border-radius: 0;
}
.iv-projector__bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.iv-projector__title { font-size: clamp(1.6rem, 4vw, 3rem); margin: 0; }
.iv-btn--announce { background: var(--iv-teal); color: #fff; font-size: clamp(1rem, 2vw, 1.4rem); }

.iv-projector__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: clamp(10px, 1.6vw, 20px); }
.iv-prow {
	display: grid;
	grid-template-columns: clamp(60px, 8vw, 120px) 1fr auto;
	align-items: center;
	gap: 20px;
	background: rgba(255,255,255,.06);
	border-radius: 18px;
	padding: clamp(12px, 2vw, 26px) clamp(16px, 3vw, 40px);
	border-left: 10px solid var(--iv-accent);
}
.iv-prow__rank { font-size: clamp(2rem, 6vw, 5rem); font-weight: 900; color: var(--iv-accent); }
.iv-prow__name { font-size: clamp(1.4rem, 4vw, 3.4rem); font-weight: 800; }
.iv-prow__points { font-size: clamp(1.8rem, 5vw, 4.2rem); font-weight: 900; color: var(--iv-teal); }

.iv-prow--rank1 { border-left-color: var(--iv-gold); background: rgba(244,197,66,.12); }
.iv-prow--rank2 { border-left-color: var(--iv-silver); }
.iv-prow--rank3 { border-left-color: var(--iv-bronze); }
.iv-prow--rank1 .iv-prow__rank { color: var(--iv-gold); }

/* Vyhlášení vítěze */
.iv-projector.is-announced .iv-prow--rank1 {
	animation: iv-pop .6s ease;
	box-shadow: 0 0 60px rgba(244, 197, 66, .5);
}
.iv-projector.is-announced .iv-prow--rank1 .iv-prow__name::before {
	content: "👑 ";
}
@keyframes iv-pop {
	0% { transform: scale(1); }
	40% { transform: scale(1.04); }
	100% { transform: scale(1); }
}

/* ============================================================= *
 *  Responzivita
 * ============================================================= */
@media (max-width: 640px) {
	.iv-projects { grid-template-columns: 1fr; }
	.iv-row { grid-template-columns: 36px 1fr; }
	.iv-row__points { grid-column: 1 / -1; text-align: left; }
}

/* Respektování prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
	.iv-bar__fill,
	.iv-btn,
	.iv-rank-btn,
	.iv-projector.is-announced .iv-prow--rank1 {
		transition: none !important;
		animation: none !important;
	}
}
