/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --brand:        #0d6efd;
    --transition:   .18s ease;
    --radius:       .75rem;
    --shadow-sm:    0 2px 8px rgba(0,0,0,.06);
    --shadow:       0 4px 20px rgba(0,0,0,.08);
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .95rem;
}

/* ── Navbar ────────────────────────────────────────────────────────────────── */
#mainNav {
    background: rgba(var(--bs-body-bg-rgb, 255,255,255), .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] #mainNav {
    background: rgba(33,37,41,.92);
}

/* ── Auth ──────────────────────────────────────────────────────────────────── */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea10 0%, #764ba220 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    border-radius: var(--radius);
}

.auth-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
    border-radius: var(--radius);
    transition: box-shadow var(--transition);
}

.hover-lift:hover {
    box-shadow: var(--shadow) !important;
    transform: translateY(-2px);
}

.poll-card {
    transition: transform var(--transition), box-shadow var(--transition);
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f4fd 100%);
    border-radius: 0 0 2rem 2rem;
    padding: 4rem 0;
}

[data-bs-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #1a1d23 0%, #0d1117 100%);
}

/* ── Poll voting ───────────────────────────────────────────────────────────── */
.answer-option {
    cursor: pointer;
    transition: all var(--transition);
    border-color: var(--bs-border-color) !important;
}

.answer-option:hover {
    background: var(--bs-primary-bg-subtle);
    border-color: var(--brand) !important;
}

.answer-option.selected {
    background: var(--bs-primary-bg-subtle);
    border-color: var(--brand) !important;
    color: var(--brand);
}

.ranking-item {
    transition: box-shadow var(--transition);
    user-select: none;
}

.ranking-item:hover {
    box-shadow: var(--shadow-sm);
}

/* ── Progress bar animation ────────────────────────────────────────────────── */
.progress-bar.transition-all {
    transition: width .4s ease;
}

/* ── Avatar placeholder ────────────────────────────────────────────────────── */
.avatar-placeholder {
    width: 72px;
    height: 72px;
    background: var(--bs-primary-bg-subtle);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Feature icons ─────────────────────────────────────────────────────────── */
.feature-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Stat icon ─────────────────────────────────────────────────────────────── */
.stat-icon { display: flex; justify-content: center; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table > :not(caption) > * > * {
    vertical-align: middle;
}

/* ── Code ──────────────────────────────────────────────────────────────────── */
code {
    font-size: .8rem;
    background: var(--bs-secondary-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--bs-danger);
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 .2rem rgba(13,110,253,.15);
}

/* ── Cursor ────────────────────────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }

/* ── Results chart ─────────────────────────────────────────────────────────── */
.free-text-responses > div {
    line-height: 1.6;
}

/* ── Dark mode extras ──────────────────────────────────────────────────────── */
[data-bs-theme="dark"] .answer-option:hover,
[data-bs-theme="dark"] .answer-option.selected {
    background: rgba(13,110,253,.15);
}

[data-bs-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #1a1d23, #0d1117);
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
    .hero-section { padding: 3rem 0; }
    .hero-section .display-4 { font-size: 2rem; }
}

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.question-step:not(.d-none) {
    animation: fadeInUp .25s ease;
}

.poll-card {
    animation: fadeInUp .3s ease both;
}

/* ── Media answer options (voting) ─────────────────────────────────────────── */
.answer-option-media {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all var(--transition);
    border-color: var(--bs-border-color) !important;
    overflow: hidden;
}

.answer-option-media:hover {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 2px rgba(13,110,253,.15);
}

.answer-option-media.selected {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 2px rgba(13,110,253,.25);
}

.answer-option-media .media-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: var(--bs-secondary-bg);
}

.answer-option-media .media-label {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .75rem;
}

/* answers displayed as a responsive grid when they have images */
.answer-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem;
}

/* ── YouTube thumbnail with play overlay ───────────────────────────────────── */
.yt-thumb-wrap {
    position: relative;
    display: block;
    width: 100%;
    height: 140px;
    overflow: hidden;
    background: #000;
}

.yt-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .85;
    transition: opacity var(--transition);
}

.yt-thumb-wrap:hover img { opacity: .7; }

.yt-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: #ff0000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    pointer-events: none;
    transition: transform var(--transition);
}

.yt-thumb-wrap:hover .yt-play-btn {
    transform: translate(-50%, -50%) scale(1.12);
}

/* ── YouTube modal embed ───────────────────────────────────────────────────── */
.yt-iframe-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.yt-iframe-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ── Results page — card reveal animation ──────────────────────────────────── */
@keyframes resultReveal {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-card {
    opacity: 0;
    animation: resultReveal .45s ease both;
    animation-delay: var(--delay, 0s);
}

.result-bar-item {
    opacity: 0;
    animation: resultReveal .38s ease both;
    animation-delay: var(--delay, 0s);
}

/* ── Results — animated progress bars ────────────────────────────────────── */
.result-bar-item + .result-bar-item {
    margin-top: 1.1rem;
}

/* ── Results — media card grid ───────────────────────────────────────────── */
.result-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 1rem;
}

.result-media-card {
    position: relative;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bs-body-bg);
    opacity: 0;
    animation: resultReveal .42s ease both;
    animation-delay: var(--delay, 0s);
    transition: box-shadow var(--transition), transform var(--transition);
}

.result-media-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.result-media-thumb-wrap {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: var(--bs-secondary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.result-media-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.result-media-card:hover .result-media-thumb {
    transform: scale(1.04);
}

.result-media-placeholder {
    background: var(--bs-secondary-bg);
}

.result-media-info {
    border-top: 1px solid var(--bs-border-color);
}

/* ── Results — winner badge ──────────────────────────────────────────────── */
.result-winner-badge {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: #ffc107;
    color: #000;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    z-index: 1;
}

/* ── Results — scale display ─────────────────────────────────────────────── */
.result-scale-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--brand);
    line-height: 1;
    margin-bottom: .5rem;
}

/* ── Legacy result thumbnails (kept for backwards compat) ────────────────── */
.result-thumb {
    width: 48px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.result-yt-thumb {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

/* ── Drop zone upload ──────────────────────────────────────────────────────── */
.img-dropzone {
    border: 2px dashed var(--bs-border-color);
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.img-dropzone:hover {
    border-color: var(--brand);
    background: var(--bs-primary-bg-subtle);
}

.img-dropzone.dz-over {
    border-color: var(--brand);
    border-style: solid;
    background: var(--bs-primary-bg-subtle);
}

[data-bs-theme="dark"] .img-dropzone:hover,
[data-bs-theme="dark"] .img-dropzone.dz-over {
    background: rgba(13,110,253,.12);
}

/* ── Poll builder — answer rows ────────────────────────────────────────────── */
.answer-row {
    background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .answer-row {
    background: var(--bs-body-bg);
}
