/* 
======================
HOUSE QUIZ STYLES
======================
*/

/* Make sure canvas doesn't grow out of control */
#results-chart {
    max-height: 360px !important;
    width: 100% !important;
}

/* 
======================
HOUSE SPECIFIC COLORS
======================
*/
:root {
    --house-falkrest: #4A9744; /* Green */
    --house-veltaris: #2A6BC2; /* Blue */
    --house-thornefield: #D8B968; /* Gold */ 
    --house-astralor: #40D0D0; /* Teal */
    --house-eldran: #9F80EB; /* Purple */
    --house-emberlyn: #DD6C6C; /* Red */

    /* Default starting color (similar to character quiz) */
    --current-house-color: var(--house-veltaris);
}

/* House-specific styles for result card */
.result-header.house-falkrest { background: linear-gradient(135deg, var(--house-falkrest), #2a5a28); }
.result-header.house-veltaris { background: linear-gradient(135deg, var(--house-veltaris), #1a4580); }
.result-header.house-thornefield { background: linear-gradient(135deg, var(--house-thornefield), #b39737); }
.result-header.house-astralor { background: linear-gradient(135deg, var(--house-astralor), #2a8a8a); }
.result-header.house-eldran { background: linear-gradient(135deg, var(--house-eldran), #6b4bb8); }
.result-header.house-emberlyn { background: linear-gradient(135deg, var(--house-emberlyn), #a64242); }

/* 
======================
QUIZ HERO SECTION
======================
*/
.quiz-hero {
    background-position: center;
    height: 60vh;
}

.quiz-hero .hero-background {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('/assets/images/cc-bg.png');
    opacity: 1 !important;
    background-size: cover;
    background-position: center;
}

.quiz-hero .magical-overlay {
    background: 
        radial-gradient(circle at 30% 70%, rgba(42, 107, 194, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(216, 185, 104, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(74, 151, 68, 0.3) 0%, transparent 70%);
}

/* 
======================
QUIZ CONTAINER
======================
*/
.quiz-container {
    max-width: 900px;
    margin: 0 auto;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(42, 107, 194, 0.1);
    min-height: 500px;
}

.quiz-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--gradient-blue);
    z-index: 1;
}

/* 
======================
QUIZ INTRO
======================
*/
.quiz-intro {
    padding: 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.house-shields {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.shield {
    width: 100px;
    height: 100px;
    background-color: rgba(42, 107, 194, 0.1);
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    transform: translateZ(0); /* Force hardware acceleration */
}

.shield img {
    max-width: 80%;
    max-height: 80%;
    opacity: 0.6;
    filter: contrast(0%) brightness(0.5);
    transition: opacity 0.3s ease, filter 0.3s ease; /* Only transition specific properties */
}

/* Optional: Change hover to scale instead of vertical movement */
.shield:hover {
    transform: scale(1.05); /* Scale instead of vertical movement */
    box-shadow: 0 10px 20px rgba(42, 107, 194, 0.2);
}

.shield::after {
    content: '?';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: rgba(42, 107, 194, 0.3);
    font-weight: bold;
    opacity: 0.8;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#start-quiz {
    margin-top: 20px;
    position: relative;
    top: 30px;
}

/* Fix for shield alignment in quiz intro */
.quiz-intro .house-shields {
    display: grid;
    grid-template-columns: repeat(6, 100px);
    grid-gap: 20px;
    width: 340px;
    position: relative;
    top: -30px;
    left: -30px;
    margin: 30px auto;
    justify-content: center;
}

.quiz-intro .shield {
    margin: 0;
    width: 100px;
    height: 100px;
    will-change: transform;
    transform: translateZ(0);
}

.quiz-intro .shield img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

@media (max-width: 480px) {
    .quiz-intro .house-shields {
        grid-template-columns: repeat(2, 80px);
        width: 200px;
        grid-gap: 20px;
    }
    
    .quiz-intro .shield {
        width: 80px;
        height: 80px;
    }
}

/* 
======================
QUIZ QUESTIONS
======================
*/
.quiz-questions {
    padding: 30px;
    display: none;
}

.quiz-progress {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(42, 107, 194, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-blue);
    width: 0;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--primary-blue);
    font-weight: 600;
}

.question-container {
    min-height: 300px;
    margin-bottom: 30px;
}

.question {
    display: none;
    animation: fadeIn 0.5s ease;
}

.question.active {
    display: block;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--primary-blue-dark);
    line-height: 1.5;
    text-align: center;
    padding: 0 20px;
}

.answers {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-option {
    background-color: white;
    border: 2px solid rgba(42, 107, 194, 0.2);
    border-radius: 10px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.answer-option:hover {
    border-color: var(--primary-blue);
    background-color: rgba(42, 107, 194, 0.05);
    transform: translateY(-2px);
}

.answer-option.selected {
    border-color: var(--primary-blue);
    background-color: rgba(42, 107, 194, 0.1);
    box-shadow: 0 5px 15px rgba(42, 107, 194, 0.2);
}

.answer-option.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-blue);
}

/* House-specific answer styling - one for each house */
.answer-option[data-house="falkrest"] {
    border-color: rgba(74, 151, 68, 0.3);
}

.answer-option[data-house="falkrest"]:hover, 
.answer-option[data-house="falkrest"].selected {
    border-color: var(--house-falkrest);
    background-color: rgba(74, 151, 68, 0.05);
}

.answer-option[data-house="falkrest"].selected::after {
    color: var(--house-falkrest);
}

.answer-option[data-house="veltaris"] {
    border-color: rgba(42, 107, 194, 0.3);
}

.answer-option[data-house="veltaris"]:hover, 
.answer-option[data-house="veltaris"].selected {
    border-color: var(--house-veltaris);
    background-color: rgba(42, 107, 194, 0.05);
}

.answer-option[data-house="veltaris"].selected::after {
    color: var(--house-veltaris);
}

.answer-option[data-house="thornefield"] {
    border-color: rgba(216, 185, 104, 0.3);
}

.answer-option[data-house="thornefield"]:hover, 
.answer-option[data-house="thornefield"].selected {
    border-color: var(--house-thornefield);
    background-color: rgba(216, 185, 104, 0.05);
}

.answer-option[data-house="thornefield"].selected::after {
    color: var(--house-thornefield);
}

.answer-option[data-house="astralor"] {
    border-color: rgba(64, 208, 208, 0.3);
}

.answer-option[data-house="astralor"]:hover, 
.answer-option[data-house="astralor"].selected {
    border-color: var(--house-astralor);
    background-color: rgba(64, 208, 208, 0.05);
}

.answer-option[data-house="astralor"].selected::after {
    color: var(--house-astralor);
}

.answer-option[data-house="eldran"] {
    border-color: rgba(159, 128, 235, 0.3);
}

.answer-option[data-house="eldran"]:hover, 
.answer-option[data-house="eldran"].selected {
    border-color: var(--house-eldran);
    background-color: rgba(159, 128, 235, 0.05);
}

.answer-option[data-house="eldran"].selected::after {
    color: var(--house-eldran);
}

.answer-option[data-house="emberlyn"] {
    border-color: rgba(221, 108, 108, 0.3);
}

.answer-option[data-house="emberlyn"]:hover, 
.answer-option[data-house="emberlyn"].selected {
    border-color: var(--house-emberlyn);
    background-color: rgba(221, 108, 108, 0.05);
}

.answer-option[data-house="emberlyn"].selected::after {
    color: var(--house-emberlyn);
}

.answer-text {
    line-height: 1.4;
    font-weight: 500;
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

/* 
======================
NAME INPUT FORM
======================
*/
.name-input-form {
    padding: 40px;
    display: none;
    text-align: center;
}

.name-form {
    max-width: 600px;
    margin: 30px auto;
    background-color: rgba(42, 107, 194, 0.05);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid rgba(42, 107, 194, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-blue-dark);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid rgba(42, 107, 194, 0.2);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(42, 107, 194, 0.1);
}

.error-message {
    color: var(--primary-red);
    font-size: 0.9rem;
    margin-top: 5px;
    min-height: 20px;
}

#submit-name {
    margin-top: 10px;
}

/* 
======================
QUIZ RESULTS
======================
*/
.quiz-results {
    padding: 40px;
    display: none;
    text-align: center;
}

.results-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.primary-result {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-card {
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(42, 107, 194, 0.2);
    overflow: hidden;
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.8s ease;
    border: 2px solid rgba(42, 107, 194, 0.3);
    height: 100%;
}

.result-header {
    background: var(--gradient-blue);
    padding: 20px;
    color: white;
    text-align: center;
    position: relative;
}

.result-header h3 {
    margin: 0;
    font-size: 1.8rem;
    text-align: left;
    color: white;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.match-percentage {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1rem;
}

.house-image {
    padding: 20px;
    display: flex;
    justify-content: center;
    background-color: rgba(42, 107, 194, 0.05);
}

.house-image img {
    max-width: 150px;
    animation: float 3s ease infinite alternate;
}

@keyframes float {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-10px);
    }
}

.noble-title {
    padding: 15px 20px;
    font-family: var(--font-headers);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-blue-dark);
    background-color: rgba(42, 107, 194, 0.05);
    border-bottom: 1px solid rgba(42, 107, 194, 0.1);
    line-height: 1.4;
}

.house-traits {
    padding: 20px;
    text-align: left;
    border-bottom: 1px solid rgba(42, 107, 194, 0.1);
}

.house-traits h4 {
    margin-top: 0;
    color: var(--primary-blue);
}

.house-traits ul {
    margin: 0;
    padding-left: 20px;
}

.house-traits li {
    margin-bottom: 8px;
}

.house-description {
    padding: 20px;
    text-align: left;
    line-height: 1.6;
}

.additional-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.radar-chart-container {
    background-color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    animation: fadeInRight 0.8s ease;
    height: 450px; /* Fixed height */
    max-height: 450px; /* Maximum height */
    overflow: hidden; /* Prevent overflow */
    border: 1px solid rgba(42, 107, 194, 0.1);
    margin-bottom: 20px;
    position: relative; /* For proper canvas positioning */
}

.radar-chart-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-blue);
}

.result-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeInUp 1s ease;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.btn-share {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-share:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.instagram {
    background: linear-gradient(45deg, #405DE6, #5851DB, #833AB4, #C13584, #E1306C, #FD1D1D);
}

.facebook {
    background-color: #4267B2;
}

.discord {
    background-color: #7289DA;
}

#retake-quiz {
    animation: fadeInUp 1.2s ease;
}

/* Animation keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 
======================
RESULT CARD STYLING (for download)
======================
*/
.result-card-download {
    background-color: white;
    width: 1200px;
    height: 630px;
    position: relative;
    overflow: hidden;
}

.result-card-download::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(42, 107, 194, 0.2), rgba(74, 151, 68, 0.2));
    z-index: 1;
}

.card-header {
    background: var(--gradient-blue);
    padding: 30px;
    text-align: center;
    color: white;
}

.card-content {
    display: flex;
    padding: 40px;
}

.card-house {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-house img {
    max-width: 250px;
    margin-bottom: 20px;
}

.card-info {
    flex: 2;
    padding-left: 40px;
}

.card-qr {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 120px;
    height: 120px;
    background-color: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.card-logo {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 120px;
    height: auto;
}

/* House-specific styles for results */
.house-falkrest {
    --current-house-color: var(--house-falkrest);
}

.house-veltaris {
    --current-house-color: var(--house-veltaris);
}

.house-thornefield {
    --current-house-color: var(--house-thornefield);
}

.house-astralor {
    --current-house-color: var(--house-astralor);
}

.house-eldran {
    --current-house-color: var(--house-eldran);
}

.house-emberlyn {
    --current-house-color: var(--house-emberlyn);
}

/* 
======================
RESPONSIVE STYLES
======================
*/
@media (max-width: 992px) {
    .results-container {
        grid-template-columns: 1fr;
    }
    
    .result-card {
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .quiz-container {
        border-radius: 0;
        box-shadow: none;
    }
    
    .quiz-intro,
    .quiz-questions,
    .name-input-form,
    .quiz-results {
        padding: 20px;
    }
    
    .house-shields {
        gap: 10px;
    }
    
    .shield {
        width: 80px;
        height: 80px;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .answer-option {
        padding: 12px 15px;
    }
    
    .name-form {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .quiz-navigation {
        flex-direction: column-reverse;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .house-image img {
        max-width: 120px;
    }
}