/**
 * Quiz Builder - Frontend Styles
 * Modern, responsive design for quiz interface
 */

/* Quiz Container */
.fmm-quiz-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 20px;
}

.quiz-description {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1em;
    color: #666;
}

/* Progress Bar */
.quiz-progress-container {
    margin-bottom: 40px;
}

.quiz-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.quiz-progress-text {
    text-align: center;
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

/* Quiz Question */
.quiz-question {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-header {
    margin-bottom: 30px;
}

.question-text {
    font-size: 1.5em;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.question-text .required {
    color: #f44336;
    margin-left: 5px;
}

.question-body {
    margin-bottom: 30px;
}

/* Error Message */
.quiz-error {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #ef9a9a;
    animation: shake 0.5s ease-in-out;
}

.quiz-error .material-icons {
    color: #c62828;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Answer Options */
.answer-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-option {
    display: flex;
    align-items: center;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.answer-option:hover {
    border-color: #4CAF50;
    background: #f1f8f4;
    transform: translateX(5px);
}

.answer-option input[type="radio"],
.answer-option input[type="checkbox"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.answer-option input[type="radio"]:checked~.option-text,
.answer-option input[type="checkbox"]:checked~.option-text {
    font-weight: 600;
    color: #4CAF50;
}

.option-text {
    font-size: 1.1em;
    color: #333;
    flex: 1;
}

/* Slider */
.answer-slider {
    padding: 20px 0;
}

.slider-input {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-value {
    text-align: center;
    margin-top: 15px;
}

.value-display {
    font-size: 1.5em;
    font-weight: 600;
    color: #4CAF50;
}

/* Text Input */
.answer-text input {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.answer-text input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Navigation Buttons */
.question-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
}

.question-navigation .btn {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #4CAF50;
    color: #fff;
    margin-left: auto;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: #757575;
    color: #fff;
}

.btn-secondary:hover {
    background: #616161;
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    color: #fff;
    margin-left: auto;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
}

/* Loading Overlay */
.quiz-loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.quiz-loading p {
    font-size: 1.2em;
    color: #666;
}

/* Results Page */
.fmm-quiz-results {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.results-intro {
    font-size: 1.2em;
    color: #666;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.products-comparison {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.product-card-featured {
    grid-column: 1 / -1;
    max-width: 600px;
    margin: 0 auto;
}

.match-score {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.score-value {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
}

.score-label {
    display: block;
    font-size: 0.8em;
    opacity: 0.9;
}

.product-image {
    position: relative;
    padding-top: 100%;
    overflow: hidden;
    background: #f5f5f5;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
}

.product-name {
    font-size: 1.3em;
    font-weight: 600;
    margin: 0 0 10px;
}

.product-name a {
    color: #333;
    text-decoration: none;
}

.product-name a:hover {
    color: #4CAF50;
}

.product-description {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.match-breakdown {
    margin: 15px 0;
}

.toggle-breakdown {
    background: none;
    border: none;
    color: #4CAF50;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 0;
    font-size: 0.9em;
}

.breakdown-details {
    margin-top: 10px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.breakdown-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.breakdown-details li {
    padding: 5px 0;
    font-size: 0.9em;
}

.product-price {
    font-size: 1.5em;
    font-weight: 700;
    color: #4CAF50;
    margin: 15px 0;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.product-actions .btn {
    flex: 1 1 auto;
    padding: 10px 5px;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: normal;
    line-height: 1.2;
}

.results-actions {
    text-align: center;
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Comparison Table */
.comparison-table-container {
    margin-top: 40px;
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th,
.comparison-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.comparison-table th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Responsive */
/* Responsive */
@media (max-width: 768px) {
    .quiz-question {
        padding: 25px 20px;
    }

    .question-text {
        font-size: 1.2em;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-actions {
        flex-direction: column;
    }

    .product-actions .btn {
        width: 100%;
        flex: none;
        white-space: normal;
        font-size: 0.9em;
        padding: 10px;
    }

    .results-actions {
        flex-direction: column;
    }

    .match-score {
        padding: 5px 10px;
        top: 10px;
        right: 10px;
    }

    .score-value {
        font-size: 1.2em;
    }

    .score-label {
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    .match-score {
        padding: 4px 8px;
    }

    .score-value {
        font-size: 1em;
    }
}