/**
 * TAMARRANE Fitness Quiz Styles
 * 2 buttons per line - ALWAYS enforced
 */

@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@200;300;400;500;600;700;800;900&display=swap');

.tamarrane-quiz {
    font-family: 'Unbounded', sans-serif;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.tamarrane-quiz * {
    box-sizing: border-box;
}

.tamarrane-quiz-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background-color: #ffffff;
    position: relative;
}

/* Progress Bar */
.tamarrane-quiz-progress {
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    margin-bottom: 30px;
    overflow: hidden;
    position: relative;
}

.tamarrane-quiz-progress-bar {
    height: 100%;
    background-color: #000000;
    transition: width 0.5s ease;
    border-radius: 2px;
}

/* Content */
.tamarrane-quiz-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

/* Title */
.tamarrane-quiz-title {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 700;
    color: #000000;
    margin: 0 0 30px 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* Questions */
.tamarrane-quiz-questions {
    position: relative;
    min-height: 400px;
}

.tamarrane-quiz-question {
    animation: fadeIn 0.4s ease;
    width: 100%;
}

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

/* Question Media */
.tamarrane-quiz-question-media {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.tamarrane-quiz-question-media:empty {
    display: none;
    margin-bottom: 0;
}

.tamarrane-quiz-question-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.tamarrane-quiz-icon-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: block;
}

.tamarrane-quiz-question-image {
    max-width: 200px;
    width: 100%;
    height: auto;
    border-radius: 12px;
    overflow: hidden;
}

.tamarrane-quiz-question-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Question Text */
.tamarrane-quiz-question-text {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 600;
    color: #000000;
    margin: 0 0 20px 0;
    line-height: 1.3;
    padding: 0 20px;
}

/* Answers Container - CRITICAL: ALWAYS 2 buttons per line */
.tamarrane-quiz-answers {
    display: grid;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* 2 answers = 1 row with 2 buttons */
/* 4 answers = 2 rows with 2 buttons each (2x2 grid) */
.tamarrane-quiz-answers[data-answer-count="2"],
.tamarrane-quiz-answers[data-answer-count="4"],
.tamarrane-quiz-answers[data-answer-count="3"],
.tamarrane-quiz-answers[data-answer-count="5"],
.tamarrane-quiz-answers[data-answer-count="6"] {
    grid-template-columns: repeat(2, 1fr) !important;
}

/* Answer Item Wrapper - Contains image and button */
.tamarrane-quiz-answer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

/* Answer Image/Icon Above Button - Max 500x500px */
.tamarrane-quiz-answer-image {
    width: 100%;
    max-width: 500px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.tamarrane-quiz-answer-img {
    width: 100%;
    max-width: 500px;
    max-height: 500px;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

/* Answer Buttons - Individual styling per button */
.tamarrane-quiz-answer-btn {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 500;
    color: #000000;
    background-color: #ffffff;
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 12px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Individual button hover - handled by JavaScript via data attributes */
.tamarrane-quiz-answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tamarrane-quiz-answer-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.tamarrane-quiz-answer-btn:focus {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.tamarrane-quiz-answer-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tamarrane-quiz-answer-btn.selected {
    opacity: 0.9;
}

/* Compact layout - reduce spacing when images present */
@supports selector(:has(*)) {
    .tamarrane-quiz-answers:has(.tamarrane-quiz-answer-image) {
        gap: 12px;
    }
    
    .tamarrane-quiz-answer-item:has(.tamarrane-quiz-answer-image) {
        gap: 8px;
    }
}

/* Fallback for browsers without :has() */
.tamarrane-quiz-answer-item .tamarrane-quiz-answer-image + .tamarrane-quiz-answer-btn {
    margin-top: 8px;
}

/* Keep layout compact - reduce image size on mobile */
@media (max-width: 767px) {
    .tamarrane-quiz-answer-image {
        max-width: 150px;
    }
    
    .tamarrane-quiz-answer-img {
        max-width: 150px;
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .tamarrane-quiz-answer-image {
        max-width: 120px;
    }
    
    .tamarrane-quiz-answer-img {
        max-width: 120px;
        max-height: 120px;
    }
}

/* Dropdown */
.tamarrane-quiz-dropdown {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 500;
    color: #000000;
    background-color: #ffffff;
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 15px 30px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000000' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 12px;
    padding-right: 50px;
}

.tamarrane-quiz-dropdown:focus {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

/* Range Slider */
.tamarrane-quiz-range-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.tamarrane-quiz-range-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 15px;
}

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

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

.tamarrane-quiz-range-value {
    font-family: 'Unbounded', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: #000000;
    text-align: center;
}

.tamarrane-quiz-range-display {
    display: inline-block;
}

.tamarrane-quiz-range-unit {
    display: inline-block;
    margin-left: 5px;
    font-size: 18px;
    opacity: 0.8;
}

/* Text Input */
.tamarrane-quiz-text-input {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 500;
    color: #000000;
    background-color: #ffffff;
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 15px 30px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: block;
}

.tamarrane-quiz-text-input:focus {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.tamarrane-quiz-text-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

/* User Info Form */
.tamarrane-quiz-form {
    animation: fadeIn 0.5s ease;
    text-align: center;
    padding: 40px 0;
    max-width: 600px;
    margin: 0 auto;
}

.tamarrane-quiz-form-title {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(28px, 5vw, 36px);
    font-weight: 700;
    color: #000000;
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.tamarrane-quiz-form-description {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 400;
    color: #000000;
    margin: 0 0 30px 0;
    line-height: 1.6;
    opacity: 0.9;
}

.tamarrane-quiz-user-form {
    text-align: left;
}

.tamarrane-quiz-form-field {
    margin-bottom: 20px;
}

.tamarrane-quiz-form-field label {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(14px, 3vw, 16px);
    font-weight: 600;
    color: #000000;
    display: block;
    margin-bottom: 8px;
}

.tamarrane-quiz-form-field input,
.tamarrane-quiz-form-field textarea {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 400;
    color: #000000;
    background-color: #ffffff;
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 12px 20px;
    width: 100%;
    box-sizing: border-box;
}

.tamarrane-quiz-form-field textarea {
    min-height: 120px;
    resize: vertical;
}

.tamarrane-quiz-form-field input:focus {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.tamarrane-quiz-form-message {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(14px, 3vw, 16px);
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 8px;
    text-align: center;
}

.tamarrane-quiz-submit-btn {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 600;
    background-color: #000000;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 15px 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tamarrane-quiz-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tamarrane-quiz-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Answers Summary Table */
.tamarrane-quiz-answers-summary {
    margin: 30px 0;
    text-align: left;
}

.tamarrane-quiz-answers-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    max-width: 600px;
}

.tamarrane-quiz-answers-table th,
.tamarrane-quiz-answers-table td {
    font-family: 'Unbounded', sans-serif;
    padding: 12px;
    border: 1px solid #000000;
    text-align: left;
}

.tamarrane-quiz-answers-table th {
    background-color: #000000;
    color: #ffffff;
    font-weight: 600;
}

.tamarrane-quiz-answers-table td {
    background-color: #ffffff;
    color: #000000;
}

.tamarrane-quiz-answers-table tr:nth-child(even) td {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Results */
.tamarrane-quiz-results {
    animation: fadeIn 0.5s ease;
    text-align: center;
    padding: 40px 0;
}

.tamarrane-quiz-result-title {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    color: #000000;
    margin: 0 0 20px 0;
    line-height: 1.2;
}

.tamarrane-quiz-result-description {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(16px, 3vw, 20px);
    font-weight: 400;
    color: #000000;
    margin: 0 0 30px 0;
    line-height: 1.6;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 30px;
}

.tamarrane-quiz-cta-btn,
.tamarrane-quiz-restart-btn {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 600;
    display: inline-block;
    padding: 18px 40px;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin: 10px;
    border-style: solid;
}

.tamarrane-quiz-cta-btn {
    background-color: #000000;
    color: #ffffff;
    border-width: 0;
}

.tamarrane-quiz-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tamarrane-quiz-restart-btn {
    background-color: transparent;
    color: #000000;
    border: 2px solid #000000;
    border-width: 2px;
}

.tamarrane-quiz-restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Responsive Design */

/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    .tamarrane-quiz-container {
        padding: 30px;
    }
    
    .tamarrane-quiz-answers {
        max-width: 550px;
        gap: 12px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .tamarrane-quiz-container {
        padding: 20px;
    }
    
    .tamarrane-quiz-title {
        font-size: clamp(24px, 6vw, 32px);
        margin-bottom: 25px;
    }
    
    .tamarrane-quiz-question-text {
        font-size: clamp(18px, 5vw, 24px);
        padding: 0 10px;
        margin-bottom: 20px;
    }
    
    /* STILL 2 buttons per line on mobile */
    .tamarrane-quiz-answers {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
        max-width: 100%;
    }
    
    .tamarrane-quiz-answer-btn {
        padding: 14px 20px;
        font-size: clamp(15px, 4vw, 17px);
        min-height: 56px;
    }
    
    .tamarrane-quiz-question-media {
        margin-bottom: 25px;
        gap: 15px;
    }
    
    .tamarrane-quiz-icon-img {
        width: 48px;
        height: 48px;
    }
    
    .tamarrane-quiz-question-image {
        max-width: 150px;
    }
    
    .tamarrane-quiz-results {
        padding: 30px 0;
    }
    
    .tamarrane-quiz-result-title {
        font-size: clamp(28px, 6vw, 36px);
    }
    
    .tamarrane-quiz-result-description {
        font-size: clamp(15px, 4vw, 18px);
        padding: 0 10px;
    }
    
    .tamarrane-quiz-cta-btn,
    .tamarrane-quiz-restart-btn {
        width: 100%;
        max-width: 100%;
        display: block;
        margin: 10px 0;
        padding: 16px 30px;
    }
    
    .tamarrane-quiz-questions {
        min-height: 350px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .tamarrane-quiz-container {
        padding: 15px;
    }
    
    .tamarrane-quiz-answer-btn {
        min-height: 60px;
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .tamarrane-quiz-question-text {
        padding: 0 5px;
    }
    
    .tamarrane-quiz-icon-img {
        width: 40px;
        height: 40px;
    }
    
    .tamarrane-quiz-question-image {
        max-width: 120px;
    }
    
    /* STILL 2 buttons per line on small mobile */
    .tamarrane-quiz-answers {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .tamarrane-quiz-question,
    .tamarrane-quiz-results,
    .tamarrane-quiz-answer-btn,
    .tamarrane-quiz-cta-btn,
    .tamarrane-quiz-restart-btn,
    .tamarrane-quiz-progress-bar {
        animation: none;
        transition: none;
    }
}

