/* ============================================================================
   Position Page Styles
   Custom styles for the Position page (/position) redesign
   ============================================================================ */

/* Hero Section */
.position-hero {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Barometer Cards */
.barometer-card {
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    background: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.barometer-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* Color-coded barometers */
.barometer-quick {
    border-left: 4px solid #fbbf24;
    background: linear-gradient(to right, #fffbeb 0%, white 10%);
}

.barometer-quick:hover {
    border-left-color: #f59e0b;
}

.barometer-strategic {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(to right, #eff6ff 0%, white 10%);
}

.barometer-strategic:hover {
    border-left-color: #2563eb;
}

.barometer-behavior {
    border-left: 4px solid #8b5cf6;
    background: linear-gradient(to right, #f5f3ff 0%, white 10%);
}

.barometer-behavior:hover {
    border-left-color: #7c3aed;
}

.barometer-icon {
    font-size: 2rem;
    line-height: 1;
}

.barometer-preview summary {
    list-style: none;
    padding: 0.5rem;
    border-radius: 6px;
    background: #f8f9fa;
}

.barometer-preview summary:hover {
    background: #e9ecef;
}

.barometer-preview[open] summary {
    margin-bottom: 0.5rem;
}

/* Central Questions */
.central-question-card {
    display: block;
    padding: 1.25rem;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.central-question-card:hover {
    border-color: #3b82f6;
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.central-question-icon {
    font-size: 1.5rem;
    display: inline-block;
    min-width: 1.5rem;
}

/* Reflection categories driven by admin data */
.reflection-category-card {
    padding: 1.25rem;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fbfcfe;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reflection-category-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.1);
}

.reflection-item {
    padding: 0.75rem;
    border-radius: 10px;
    background: white;
    border: 1px solid #eef2ff;
}

.reflection-pill {
    display: inline-block;
    min-width: 80px;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Reflection Cards */
.reflection-card {
    padding: 1.25rem;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.reflection-card:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.reflection-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #4f46e5;
    margin-bottom: 0.75rem;
}

/* Toolbox Section */
.toolbox-card {
    display: block;
    padding: 1.25rem;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.toolbox-card:hover {
    border-color: #10b981;
    background: #f0fdf4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

/* Critical Thinking Section */
.critical-thinking-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
}

.critical-thinking-card {
    display: block;
    padding: 1.25rem;
    border: 1px solid #fbbf24;
    border-radius: 10px;
    background: white;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.critical-thinking-card:hover {
    border-color: #f59e0b;
    background: #fffbeb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.critical-thinking-icon {
    font-size: 2rem;
    line-height: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .position-hero {
        padding: 1.5rem;
    }

    .barometer-card,
    .central-question-card,
    .reflection-card,
    .toolbox-card,
    .critical-thinking-card {
        padding: 1rem;
    }

    .barometer-icon,
    .critical-thinking-icon {
        font-size: 1.5rem;
    }
}

/* Accessibility improvements */
.barometer-card:focus,
.central-question-card:focus,
.reflection-card:focus,
.toolbox-card:focus,
.critical-thinking-card:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .barometer-card,
    .central-question-card,
    .reflection-card,
    .toolbox-card,
    .critical-thinking-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

.valbarometer-start {
    background: #f8f9fb;
    border: 1px dashed #d0d7de;
    border-radius: 12px;
    padding: 16px;
}

.valbarometer-scale input[type="range"]::-webkit-slider-thumb {
    background: #5a54e8;
}

.valbarometer-scale input[type="range"]::-moz-range-thumb {
    background: #5a54e8;
}

.match-row .progress-bar {
    background: linear-gradient(90deg, #5a54e8, #37b3ff);
}

#question-breakdown .accordion-button:not(.collapsed) {
    background-color: #f5f7fb;
    color: #2c2f36;
}

#question-breakdown .accordion-button:focus {
    box-shadow: none;
}

/* ============================================================================
   Quiz Enhancements
   ============================================================================ */

/* Quiz form styling */
.quiz-form {
    max-width: 100%;
}

.position-quiz-shell {
    padding-top: 0.25rem;
}

.position-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    margin: -1.5rem -1.5rem 1rem;
    padding: 1rem 1.5rem 0.75rem;
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.03);
}

.position-topbar-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: center;
}

.position-progress-meta .fw-semibold {
    font-size: 1.05rem;
}

.mode-switch {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d7dbec;
    border-radius: 999px;
    background: #f8f9fc;
    color: #343a40;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mode-pill .badge {
    font-weight: 700;
    font-size: 0.75rem;
}

.mode-pill.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 14px rgba(118, 75, 162, 0.25);
}

.mode-pill.active .badge {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff;
}

.mode-pill:hover,
.mode-pill:focus-visible {
    border-color: #667eea;
    color: #2c2f36;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    outline: none;
}

.quiz-form h2 {
    color: #2c3e50;
    font-weight: 600;
    line-height: 1.4;
}

.quiz-options-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 52px;
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.04);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-option-card:hover,
.quiz-option-card:focus-visible {
    border-color: #667eea;
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.18);
    outline: none;
}

input[type="radio"].visually-hidden:checked + .quiz-option-card {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
}

input[type="radio"].visually-hidden:focus-visible + .quiz-option-card {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.35);
    outline: none;
}

.quiz-option-copy {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}

.quiz-option-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background: #f0f2ff;
    color: #3f51b5;
    font-weight: 700;
    border: 1px solid #d7dbec;
}

.quiz-option-label {
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.35;
}

.quiz-option-emoji {
    font-size: 1.5rem;
}

/* Pass/Don't know option - styled differently */
.quiz-option-pass {
    border-style: dashed;
    border-color: #cbd5e0;
    background: #f7fafc;
}

.quiz-option-pass:hover,
.quiz-option-pass:focus-visible {
    border-color: #a0aec0;
    box-shadow: 0 4px 12px rgba(160, 174, 192, 0.15);
}

input[type="radio"].visually-hidden:checked + .quiz-option-pass {
    border-color: #a0aec0;
    border-style: dashed;
    box-shadow: 0 6px 16px rgba(160, 174, 192, 0.2);
    background: linear-gradient(135deg, rgba(160, 174, 192, 0.08), rgba(203, 213, 224, 0.08));
}

.quiz-bottom-bar {
    position: sticky;
    bottom: -1px;
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem;
    margin: 1rem -1rem -1rem;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

.quiz-actions button,
.quiz-bottom-bar button {
    font-weight: 700;
}

.progress {
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.6s ease;
}

.badge.bg-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    padding: 0.35rem 0.75rem;
    font-weight: 600;
}

/* Results section */
.alert.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
    border-radius: 12px;
    padding: 1.5rem;
}

/* Political compass visualization */
.political-compass-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f5f7fa 0%, #e3e7ef 100%);
    border: 2px solid #dee2e6;
    border-radius: 16px;
    padding: 2rem;
}

.compass-grid {
    position: relative;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
}

.compass-axes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.compass-axis-vertical,
.compass-axis-horizontal {
    position: absolute;
    background: #adb5bd;
}

.compass-axis-vertical {
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

.compass-axis-horizontal {
    top: 50%;
    left: 0;
    height: 2px;
    width: 100%;
    transform: translateY(-50%);
}

.compass-labels {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.compass-label {
    position: absolute;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.compass-label.top {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-label.bottom {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-label.left {
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.compass-label.right {
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.compass-point {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid white;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    cursor: help;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.7rem;
    color: white;
}

.compass-point.other {
    opacity: 0.30;
    width: 14px;
    height: 14px;
    font-size: 0;
    box-shadow: none;
}

.compass-point.top {
    opacity: 1;
    width: 28px;
    height: 28px;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid rgba(0,0,0,.15);
}

.compass-point.user {
    width: 30px;
    height: 30px;
    font-size: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-width: 4px;
    z-index: 10;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.2), 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.2), 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

.compass-point:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 11;
}

.compass-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 8px;
}

.compass-point:hover .compass-tooltip {
    opacity: 1;
}

/* ============================================================================
   Results Section Enhancements
   ============================================================================ */

/* Result Banner - Top Match Display */
.result-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    animation: slideInFromTop 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.result-banner::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    pointer-events: none;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-banner-icon {
    font-size: 3rem;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.result-banner-label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.25rem;
    position: relative;
    z-index: 1;
}

.result-banner-party {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.result-banner-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.result-banner-score {
    font-size: 1.25rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.result-banner-score .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.9rem;
    font-weight: 400;
}

/* Section Icons */
.compass-section-icon {
    font-size: 1.75rem;
    line-height: 1;
}

/* Party Match Bars */
.party-match-bars {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.party-match-bar-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out backwards;
}

.party-match-bar-item:nth-child(1) { animation-delay: 0.1s; }
.party-match-bar-item:nth-child(2) { animation-delay: 0.15s; }
.party-match-bar-item:nth-child(3) { animation-delay: 0.2s; }
.party-match-bar-item:nth-child(4) { animation-delay: 0.25s; }
.party-match-bar-item:nth-child(5) { animation-delay: 0.3s; }
.party-match-bar-item:nth-child(6) { animation-delay: 0.35s; }
.party-match-bar-item:nth-child(7) { animation-delay: 0.4s; }
.party-match-bar-item:nth-child(8) { animation-delay: 0.45s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.party-match-bar-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.party-match-bar-item.top-match {
    border-color: #667eea;
    border-width: 3px;
    background: linear-gradient(135deg, #f8f9ff 0%, white 100%);
}

.party-match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.party-match-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.party-match-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: contain;
    background: #f8f9fa;
    padding: 4px;
    border: 2px solid #dee2e6;
}

.party-match-logo[src=""]:before,
.party-match-logo[src=""]:after {
    content: "";
    display: none;
}

.party-match-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
}

.party-match-score-text {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.party-match-score-text strong {
    font-size: 1.5rem;
    color: #667eea;
}

.party-match-bar-container {
    position: relative;
    width: 100%;
    height: 32px;
    background: #f1f3f5;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.party-match-bar-fill {
    height: 100%;
    background: currentColor;
    border-radius: 16px;
    transition: width 1s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.75rem;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Detailed Comparison */
.detailed-comparison {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
}

.question-comparison-item {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

.question-comparison-item:last-child {
    margin-bottom: 0;
}

.answer-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 2px solid #e9ecef;
    transition: all 0.2s ease;
}

.answer-box.user-answer {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #f8f9fa 100%);
}

.answer-box.party-answer {
    border-color: #28a745;
    background: linear-gradient(135deg, #f0fff4 0%, #f8f9fa 100%);
}

.answer-box.no-answer {
    background: #fff;
    border-style: dashed;
}

.answer-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #6c757d;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.answer-value {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.answer-score {
    font-size: 0.875rem;
    color: #6c757d;
}

.party-explanation {
    padding: 1rem;
    background: linear-gradient(135deg, #fff8e1 0%, #fff9e6 100%);
    border-left: 4px solid #ffc107;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #495057;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .quiz-form .btn-check + label {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .political-compass-container {
        padding: 1rem;
    }
    
    .compass-label {
        font-size: 0.65rem;
    }
    
    .compass-point {
        width: 20px;
        height: 20px;
    }
    
    .compass-point.user {
        width: 26px;
        height: 26px;
    }
    
    .result-banner {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .result-banner-icon {
        font-size: 2.5rem;
    }
    
    .result-banner-party {
        font-size: 1.5rem;
        justify-content: center;
    }
    
    .result-banner-logo {
        width: 40px;
        height: 40px;
    }
    
    .party-match-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .party-match-score-text {
        width: 100%;
        justify-content: space-between;
    }

    .party-match-name {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .position-hero {
        padding: 1.25rem 1rem;
        margin-bottom: 1rem;
    }

    .position-hero .page-title-valu {
        font-size: 1.6rem;
    }

    .position-hero .page-lead-valu {
        font-size: 1rem;
    }

    .position-topbar {
        margin: -1rem -1rem 0.75rem;
        padding: 0.85rem 1rem 0.65rem;
    }

    .mode-switch {
        gap: 0.4rem;
    }

    .quiz-option-card {
        padding: 0.85rem 0.9rem;
    }

    .quiz-bottom-bar {
        padding: 0.75rem 0.5rem;
        margin: 1rem -0.5rem -1rem;
    }
}
