/**
 * ProQyz Toolkit CSS - Question Flagging & UI Enhancements
 */

/* Block Question Title Header Layout - Retains Original Text Alignment */
.test-panel__question-sm-title,
.test-panel__question-title {
    position: relative !important;
    padding-right: 32px !important;
}

/* Flag Button Styles - Block Questions (MCQ / Radio / Checkbox) */
.test-panel__question-sm-title .proqyz-flag-btn,
.test-panel__question-title .proqyz-flag-btn {
    position: absolute !important;
    right: 0 !important;
    top: 2px !important;
    margin: 0 !important;
}

/* Base Flag Button Styling */
.proqyz-flag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 4px;
    color: #94a3b8;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    vertical-align: middle;
    line-height: 1;
}

.proqyz-flag-btn:hover {
    color: #f59e0b;
    transform: scale(1.15);
    background-color: rgba(245, 158, 11, 0.1);
}

.proqyz-flag-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: fill 0.2s ease, stroke 0.2s ease;
}

/* Flagged Active State */
.proqyz-flag-btn.is-flagged {
    color: #f59e0b;
}

.proqyz-flag-btn.is-flagged svg {
    fill: #f59e0b;
    stroke: #d97706;
}

.proqyz-flag-btn.is-flagged:hover {
    color: #d97706;
    background-color: rgba(217, 119, 6, 0.15);
}

/* Inline & Table Fillup Flag Buttons */
.proqyz-flag-btn.proqyz-flag-inline {
    position: relative !important;
    display: inline-flex !important;
    vertical-align: middle !important;
    margin-left: 6px !important;
    padding: 2px 4px !important;
    height: 26px !important;
    width: 26px !important;
}

table td .proqyz-flag-inline,
.test-panel td .proqyz-flag-inline {
    margin-left: 4px !important;
    vertical-align: middle !important;
}

/* Footer Question Palette Items Positioning */
.question-palette__item {
    position: relative !important;
}

/* Palette Flag Badge */
.proqyz-palette-flag-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 15px;
    height: 15px;
    background-color: #f59e0b;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    z-index: 10;
    pointer-events: none;
    animation: proqyzBadgePop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.proqyz-palette-flag-badge svg {
    width: 9px;
    height: 9px;
    fill: #ffffff;
    stroke: none;
}

.question-palette__item.is-flagged {
    border-color: #f59e0b !important;
    background-color: #fffbeb !important;
}

.question-palette__item.is-flagged.-checked {
    border-color: #f59e0b !important;
}

@keyframes proqyzBadgePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* High Contrast / Dark Theme Compatibility */
body.ielts-theme-white-on-black .proqyz-flag-btn,
body.ielts-theme-yellow-on-black .proqyz-flag-btn {
    color: #cbd5e1;
}

body.ielts-theme-white-on-black .proqyz-flag-btn.is-flagged,
body.ielts-theme-yellow-on-black .proqyz-flag-btn.is-flagged {
    color: #fbbf24;
}

body.ielts-theme-white-on-black .proqyz-flag-btn.is-flagged svg,
body.ielts-theme-yellow-on-black .proqyz-flag-btn.is-flagged svg {
    fill: #fbbf24;
    stroke: #f59e0b;
}

body.ielts-theme-white-on-black .question-palette__item.is-flagged,
body.ielts-theme-yellow-on-black .question-palette__item.is-flagged {
    background-color: #451a03 !important;
    border-color: #fbbf24 !important;
}
