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

.quizforge-embed {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.quizforge-embed * {
    box-sizing: border-box;
}

/* Loading state */
.qf-embed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    flex: 1;
}

.qf-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #e5e7eb;
    border-top-color: #0d9488;
    border-radius: 50%;
    animation: qf-spin 0.7s linear infinite;
}

@keyframes qf-spin {
    to { transform: rotate(360deg); }
}

/* Quiz header bar */
.qf-embed-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.qf-embed-progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.qf-progress-label {
    font-size: 12px;
    color: #9ca3af;
    flex-shrink: 0;
}

.qf-progress-bar-bg {
    flex: 1;
    height: 6px;
    background: #f3f4f6;
    border-radius: 99px;
    overflow: hidden;
}

.qf-progress-bar-fill {
    height: 100%;
    background: #0d9488;
    border-radius: 99px;
    transition: width 0.3s ease;
}

/* Timer */
.qf-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 6px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,.08);
    background: #fff;
    flex-shrink: 0;
}

.qf-timer-svg {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    transform: rotate(-90deg);
}

.qf-timer-text-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.qf-timer-number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.qf-timer-label {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 500;
    white-space: nowrap;
}

/* Quiz body */
.qf-embed-body {
    flex: 1;
    padding: 20px 18px;
    overflow-y: auto;
}

/* Quiz intro */
.qf-quiz-intro {
    margin-bottom: 16px;
}

.qf-quiz-intro h2 {
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px;
    line-height: 1.3;
}

.qf-quiz-intro p {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

/* Results */
.qf-results {
    text-align: center;
    padding: 24px 0 16px;
    animation: qf-fade-in .3s ease-out;
}

.qf-results-icon {
    width: 52px;
    height: 52px;
    background: #f0fdfa;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.qf-results-icon svg {
    width: 26px;
    height: 26px;
    color: #0d9488;
}

.qf-results h3 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
}

.qf-results-score {
    font-size: 32px;
    font-weight: 700;
    color: #0d9488;
    margin: 0 0 8px;
    line-height: 1;
}

.qf-results-msg {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 18px;
}

/* Question display */
.qf-question-display {
    animation: qf-slide-up .3s cubic-bezier(.16,1,.3,1);
}

.qf-question-label {
    font-size: 11px;
    font-weight: 600;
    color: #0d9488;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 10px;
}

.qf-question-content {
    font-size: 16px;
    color: #1f2937;
    line-height: 1.6;
    margin-bottom: 14px;
    white-space: pre-wrap;
}

.qf-question-image {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    margin-bottom: 14px;
    max-width: 100%;
}

.qf-question-image img {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: contain;
    display: block;
}

/* Bar chart */
.qf-bar-chart {
    margin-bottom: 14px;
}

.qf-bar-chart-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-align: center;
    margin-bottom: 12px;
}

.qf-bar-chart-svg {
    width: 100%;
    overflow: visible;
}

/* Answers - text */
.qf-answers-text {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.qf-answer-btn {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all .2s;
    font-family: inherit;
}

.qf-answer-btn:hover:not(:disabled) {
    border-color: #d1d5db;
    background: #f9fafb;
}

.qf-answer-btn.selected {
    border-color: #0d9488;
    background: #f0fdfa;
    box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

.qf-answer-btn.correct {
    border-color: #10b981;
    background: #f0fdf4;
}

.qf-answer-btn.incorrect {
    border-color: #ef4444;
    background: #fef2f2;
}

.qf-answer-btn.dimmed {
    border-color: #e5e7eb;
    opacity: .55;
}

.qf-answer-btn:disabled {
    cursor: default;
}

.qf-answer-radio {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}

.qf-answer-btn.selected .qf-answer-radio {
    border-color: #0d9488;
    background: #0d9488;
}

.qf-answer-btn.correct .qf-answer-radio {
    border-color: #10b981;
    background: #10b981;
}

.qf-answer-btn.incorrect .qf-answer-radio {
    border-color: #ef4444;
    background: #ef4444;
}

.qf-answer-radio svg {
    width: 12px;
    height: 12px;
    color: #fff;
    display: none;
}

.qf-answer-btn.correct .qf-answer-radio svg.qf-check,
.qf-answer-btn.incorrect .qf-answer-radio svg.qf-x {
    display: block;
}

.qf-answer-btn.selected:not(.correct):not(.incorrect) .qf-answer-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

.qf-answer-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

/* Answers - image grid */
.qf-answers-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 400px) {
    .qf-answers-images {
        grid-template-columns: repeat(3, 1fr);
    }
}

.qf-answer-img-btn {
    width: 100%;
    padding: 8px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    font-family: inherit;
}

.qf-answer-img-btn:hover:not(:disabled) {
    border-color: #d1d5db;
}

.qf-answer-img-btn.selected {
    border-color: #0d9488;
    background: #f0fdfa;
    box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

.qf-answer-img-btn.correct {
    border-color: #10b981;
    background: #f0fdf4;
}

.qf-answer-img-btn.incorrect {
    border-color: #ef4444;
    background: #fef2f2;
}

.qf-answer-img-btn.dimmed {
    opacity: .55;
}

.qf-answer-img-btn:disabled {
    cursor: default;
}

.qf-answer-img-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 7px;
    overflow: hidden;
    background: #f3f4f6;
}

.qf-answer-img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.qf-answer-img-lbl {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    text-align: center;
}

.qf-answer-img-check {
    color: #10b981;
    display: none;
}

.qf-answer-img-btn.correct .qf-answer-img-check {
    display: block;
}

.qf-answer-img-check svg {
    width: 14px;
    height: 14px;
}

/* Navigation */
.qf-embed-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
}

/* Buttons */
.qf-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #0d9488;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}

.qf-btn-primary:hover {
    background: #0f766e;
}

.qf-btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.qf-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}

.qf-btn-secondary:hover {
    background: #f9fafb;
}

.qf-btn-secondary:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.qf-btn-primary svg,
.qf-btn-secondary svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Footer */
.qf-embed-footer {
    display: flex;
    justify-content: center;
    padding: 6px;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.qf-embed-footer span {
    font-size: 10px;
    color: #d1d5db;
    letter-spacing: .05em;
}

/* Error state */
.qf-embed-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    flex: 1;
}

.qf-embed-error p {
    font-size: 13px;
    color: #6b7280;
}

/* Animations */
@keyframes qf-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes qf-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
