/**
 * /assets/css/tools/challenge-vote.css
 *
 * Mobile-first styles for Mentor Feedback voting page.
 * Also includes .cv-chip styles for journey integration
 * and voice recorder (vr-*) styles.
 * Follows existing pv-* conventions.
 *
 * Design tokens: uses --peritiq-* vars from global.css
 * Brand: teal (#008085 light) / yellow (#F7CB18 dark)
 */

/* ─── Outline Button (used by voice recorder) ────────────────── */

.pv-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    border: 1.5px solid var(--peritiq-border-primary, #B0B4BE);
    background: transparent;
    color: var(--peritiq-text-primary, #1A1D26);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pv-btn-outline:hover {
    border-color: var(--peritiq-brand-primary, #008085);
    color: var(--peritiq-brand-primary, #008085);
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.04);
}

/* ─── Self-ID (Screen 1) ──────────────────────────────────────── */

.cv-self-id {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
}

.cv-self-id label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--peritiq-text-primary, #1A1D26);
}

.cv-self-id input,
.cv-self-id select {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--peritiq-border-primary, #B0B4BE);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--peritiq-background-base, #ECEDF2);
    color: var(--peritiq-text-primary, #1A1D26);
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.cv-self-id input:focus,
.cv-self-id select:focus {
    outline: none;
    border-color: var(--peritiq-brand-primary, #008085);
    box-shadow: 0 0 0 3px rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.12);
}

.cv-self-id .cv-field-optional,
.cv-field-optional {
    font-weight: 400;
    color: var(--peritiq-text-secondary, #4B5563);
    font-size: 0.75rem;
}

/* ─── Step Selection (Screen 2) ────────────────────────────────── */

.cv-step-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0.5rem 0;
    max-height: 55vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-padding: 0.5rem;
}

/* Subtle fade hint at bottom when scrollable */
.cv-step-list-wrap {
    position: relative;
}
.cv-step-list-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: linear-gradient(transparent, var(--peritiq-background-surface, #fff));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.cv-step-list-wrap.cv-scrollable::after {
    opacity: 1;
}
.cv-step-list-wrap.cv-scrolled-bottom::after {
    opacity: 0;
}

.cv-section-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cv-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--peritiq-text-secondary, #4B5563);
    margin: 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--peritiq-border-secondary, #D5D8DE);
}

.cv-step-card {
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--peritiq-border-primary, #B0B4BE);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    background: var(--peritiq-background-base, #ECEDF2);
}

.cv-step-card:hover {
    border-color: var(--peritiq-brand-primary, #008085);
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.02);
}

.cv-step-card.cv-step-selected {
    border-color: var(--peritiq-brand-primary, #008085);
    box-shadow: 0 0 0 2px rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.12);
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.04);
}

.cv-step-text {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--peritiq-text-primary, #1A1D26);
    line-height: 1.5;
}

.cv-step-summary {
    font-size: 0.78rem;
    color: var(--peritiq-text-secondary, #4B5563);
    margin-top: 0.3rem;
    line-height: 1.4;
}

.cv-status-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.4rem;
    vertical-align: middle;
    text-transform: capitalize;
}

.cv-status-done {
    background: rgba(16, 185, 129, 0.1);
    color: var(--peritiq-accent-signal, #10b981);
}

.cv-status-active {
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.1);
    color: var(--peritiq-brand-primary, #008085);
}

/* Brief accordion — placed above step list, visually prominent */
.cv-brief-accordion {
    margin-bottom: 1.25rem;
    border: 1.5px solid rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.25);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.02);
}

.cv-brief-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--peritiq-brand-primary, #008085);
    cursor: pointer;
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.05);
    list-style: none;
    transition: background 0.2s;
}

.cv-brief-toggle:hover {
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.09);
}

.cv-brief-toggle::-webkit-details-marker {
    display: none;
}

.cv-brief-toggle .material-symbols-outlined {
    font-size: 1.1rem;
    color: var(--peritiq-brand-primary, #008085);
}

.cv-brief-chevron {
    margin-left: auto;
    font-size: 1rem !important;
    transition: transform 0.2s;
}

.cv-brief-accordion[open] .cv-brief-chevron {
    transform: rotate(180deg);
}

.cv-brief-content {
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    color: var(--peritiq-text-primary, #1A1D26);
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    word-break: break-word;
    border-top: 1px solid var(--peritiq-border-primary, #B0B4BE);
}
.cv-brief-heading {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--peritiq-brand-primary, #008085);
    margin: 0.75rem 0 0.25rem;
    letter-spacing: 0.01em;
}
.cv-brief-heading:first-child { margin-top: 0; }
.cv-brief-para {
    margin: 0 0 0.5rem;
    white-space: pre-wrap;
}

/* ─── Feedback Form (Screen 3) ─────────────────────────────────── */

.cv-selected-step {
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.04);
    border: 1px solid rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.15);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
}

.cv-selected-step-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--peritiq-brand-primary, #008085);
}

.cv-selected-step-text {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--peritiq-text-primary, #1A1D26);
    margin: 0.25rem 0 0;
    line-height: 1.4;
}

.cv-form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--peritiq-text-primary, #1A1D26);
    margin-bottom: 0.4rem;
}

/* Readiness slider */
.cv-readiness {
    margin-bottom: 1.5rem;
}

.cv-readiness-dots {
    display: flex;
    gap: 0.25rem;
    justify-content: space-between;
    margin: 0.5rem 0 0.25rem;
}

.cv-readiness-dot {
    flex: 1;
    min-width: 0;
    height: 40px;
    border-radius: 8px;
    border: 1.5px solid var(--peritiq-border-primary, #B0B4BE);
    background: var(--peritiq-background-base, #ECEDF2);
    color: var(--peritiq-text-secondary, #4B5563);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

.cv-readiness-dot:hover {
    border-color: var(--peritiq-brand-primary, #008085);
    color: var(--peritiq-brand-primary, #008085);
}

.cv-readiness-dot.cv-readiness-active {
    background: var(--peritiq-brand-primary, #008085);
    border-color: var(--peritiq-brand-primary, #008085);
    color: var(--peritiq-text-inverse, #fff);
}

.cv-readiness-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--peritiq-text-secondary, #4B5563);
    padding: 0 2px;
}

/* Comment & brief textarea */
.cv-comment,
.cv-brief-feedback {
    margin-bottom: 1.25rem;
}

.cv-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--peritiq-border-primary, #B0B4BE);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--peritiq-text-primary, #1A1D26);
    background: var(--peritiq-background-base, #ECEDF2);
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cv-textarea:focus {
    outline: none;
    border-color: var(--peritiq-brand-primary, #008085);
    box-shadow: 0 0 0 3px rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.12);
}

.cv-textarea::placeholder {
    color: var(--peritiq-text-secondary, #4B5563);
}

/* Voice section divider */
.cv-voice-section {
    margin-bottom: 1.25rem;
}

.cv-voice-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.75rem;
    color: var(--peritiq-text-secondary, #4B5563);
    font-size: 0.78rem;
    font-weight: 500;
}

.cv-voice-divider::before,
.cv-voice-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--peritiq-border-primary, #B0B4BE);
}

/* ─── Review Screen (Screen 4) ─────────────────────────────────── */

.cv-review-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cv-review-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--peritiq-border-secondary, #D5D8DE);
}

.cv-review-row:last-child {
    border-bottom: none;
}

.cv-review-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--peritiq-text-secondary, #4B5563);
}

.cv-review-value {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--peritiq-text-primary, #1A1D26);
    line-height: 1.5;
}

.cv-review-comment {
    font-style: italic;
    color: var(--peritiq-text-primary, #1A1D26);
}

.cv-readiness-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--peritiq-brand-primary, #008085);
}

/* ─── Voice Recorder Component (vr-*) ─────────────────────────── */

.vr-container {
    min-height: 48px;
}

.vr-hidden {
    display: none !important;
}

.vr-record-btn {
    width: 100%;
    min-height: 48px;
}

.vr-mic-icon {
    color: #ef4444;
    font-size: 0.65rem;
}

.vr-recording {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: rgba(239, 68, 68, 0.06);
    border: 1.5px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
}

.vr-pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    animation: vrPulse 1s ease-in-out infinite;
}

@keyframes vrPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.15); }
}

.vr-timer {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--peritiq-text-primary, #1A1D26);
    font-variant-numeric: tabular-nums;
}

.vr-stop-btn {
    min-height: 40px;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
}

.vr-uploading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem;
    color: var(--peritiq-text-secondary, #4B5563);
    font-size: 0.85rem;
}

.vr-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--peritiq-border-primary, #B0B4BE);
    border-top-color: var(--peritiq-brand-primary, #008085);
    border-radius: 50%;
    animation: vrSpin 0.6s linear infinite;
}

@keyframes vrSpin {
    to { transform: rotate(360deg); }
}

.vr-ready {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--peritiq-background-secondary, #F3F4F7);
    border-radius: 8px;
    border: 1px solid var(--peritiq-border-primary, #B0B4BE);
}

.vr-audio {
    flex: 1;
    height: 36px;
    min-width: 0;
}

.vr-duration {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--peritiq-text-secondary, #4B5563);
    flex-shrink: 0;
}

.vr-delete-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--peritiq-border-primary, #B0B4BE);
    background: var(--peritiq-background-base, #ECEDF2);
    color: var(--peritiq-text-secondary, #4B5563);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.vr-delete-btn:hover {
    color: #ef4444;
    border-color: #ef4444;
}

.vr-error {
    padding: 0.5rem 0.75rem;
    background: rgba(239, 68, 68, 0.06);
    border-radius: 6px;
    font-size: 0.78rem;
    color: #ef4444;
    margin-top: 0.5rem;
}

/* ─── Journey Chip ──────────────────────────────────────────────── */

.cv-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 12px;
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.08);
    color: var(--peritiq-brand-primary, #008085);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.cv-chip:hover {
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.15);
}

.cv-chip .material-symbols-outlined {
    font-size: 0.8rem;
}

.cv-chip-panel {
    padding: 0.75rem;
    margin-top: 0.5rem;
    background: var(--peritiq-background-secondary, #F3F4F7);
    border-radius: 8px;
    border: 1px solid var(--peritiq-border-primary, #B0B4BE);
    font-size: 0.8rem;
}

/* ─── Mentor Feedback Modal (founder view) ─────────────────────── */

.cv-modal-desc {
    font-size: 0.85rem;
    color: var(--peritiq-text-secondary, #4B5563);
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

.cv-modal-url-input {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--peritiq-border-primary, #B0B4BE);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--peritiq-text-primary, #1A1D26);
    background: var(--peritiq-background-secondary, #F3F4F7);
    min-width: 0;
}

.cv-modal-url-input:focus {
    outline: none;
    border-color: var(--peritiq-brand-primary, #008085);
}

.cv-modal-expiry {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--peritiq-text-secondary, #4B5563);
    margin-top: 0.75rem;
}

/* Feedback card in modal */
.cv-feedback-card {
    border: 1px solid var(--peritiq-border-primary, #B0B4BE);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--peritiq-background-base, #ECEDF2);
}

.cv-feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.cv-feedback-mentor {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cv-feedback-focus {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--peritiq-brand-primary, #008085);
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.08);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.cv-feedback-readiness {
    font-size: 1rem;
    font-weight: 800;
    color: var(--peritiq-brand-primary, #008085);
}

.cv-feedback-step {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--peritiq-text-primary, #1A1D26);
    background: var(--peritiq-background-secondary, #F3F4F7);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.cv-feedback-comment {
    font-size: 0.85rem;
    color: var(--peritiq-text-primary, #1A1D26);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.cv-feedback-audio {
    margin-bottom: 0.5rem;
}

.cv-feedback-audio audio {
    width: 100%;
    height: 36px;
}

.cv-feedback-brief {
    font-size: 0.8rem;
    color: var(--peritiq-text-secondary, #4B5563);
    font-style: italic;
    border-left: 2px solid var(--peritiq-border-primary, #B0B4BE);
    padding-left: 0.75rem;
}

.cv-feedback-date {
    font-size: 0.7rem;
    color: var(--peritiq-text-secondary, #4B5563);
    margin-top: 0.5rem;
}

.cv-avg-readiness {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(var(--peritiq-brand-rgb, 0, 128, 133), 0.04);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.cv-avg-score {
    font-size: 2rem;
    font-weight: 800;
    color: var(--peritiq-brand-primary, #008085);
    line-height: 1;
}

.cv-avg-label {
    font-size: 0.8rem;
    color: var(--peritiq-text-secondary, #4B5563);
}

/* ─── QR Modal ──────────────────────────────────────────────────── */

.cv-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.cv-qr-wrap img,
.cv-qr-wrap canvas {
    border-radius: 8px;
    border: 2px solid var(--peritiq-border-primary, #B0B4BE);
}

.cv-qr-label {
    font-size: 0.75rem;
    color: var(--peritiq-text-secondary, #4B5563);
    font-weight: 500;
}

/* ─── Nav spacing (challenge context) ──────────────────────────── */

#challenge-vote-app .pv-nav {
    padding: 1.25rem 2rem 1.75rem;
    border-top: 1px solid var(--peritiq-border-secondary, #D5D8DE);
    margin-top: 0;
}

/* Step-badge as subtitle needs spacing from step list heading */
#challenge-vote-app .pv-card-header {
    padding-bottom: 1.25rem;
}

#challenge-vote-app .pv-card-header h2 {
    margin: 0.25rem 0 0.4rem;
}

/* ─── Responsive ────────────────────────────────────────────────── */

@media (max-width: 680px) {
    .cv-readiness-dot {
        height: 44px;
        font-size: 0.85rem;
    }

    .cv-step-card {
        padding: 0.75rem;
    }

    .cv-self-id input,
    .cv-self-id select {
        padding: 0.75rem;
        font-size: 1rem;
    }

    .cv-textarea {
        font-size: 1rem;
        padding: 0.75rem;
    }

    .vr-record-btn {
        min-height: 52px;
        font-size: 0.9rem;
    }

    #challenge-vote-app .pv-nav {
        padding: 1rem 1.25rem 1.5rem;
    }

    .cv-step-list {
        max-height: 45vh;
    }
}
