/* FDQ2 modal layer — attempt history and the admin preview shell.
   Hairline editorial, matching the site. */

.fdq2-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(21, 26, 24, 0.4);
    backdrop-filter: blur(3px);
}

.fdq2-modal {
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: 86vh;
    border: 1px solid var(--fdq2-line);
    border-radius: var(--fdq2-radius);
    background: var(--fdq2-surface);
    box-shadow: var(--fdq2-shadow-hover);
    overflow: hidden;
    font-family: var(--fdq2-font);
    color: var(--fdq2-ink);
}

.fdq2-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--fdq2-line);
}

.fdq2-modal-head strong {
    font-family: var(--fdq2-font);
    font-size: var(--fdq2-section);
    font-weight: 700;
    letter-spacing: var(--fdq2-tight);
}

.fdq2-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: var(--fdq2-muted);
    font-size: 16px;
    cursor: pointer;
}

.fdq2-modal-close:hover { color: var(--fdq2-ink); }

.fdq2-modal-content { padding: 20px 24px 24px; overflow: auto; }

.fdq2-loading { margin: 0; color: var(--fdq2-muted); font-family: var(--fdq2-serif); }

/* Controls --------------------------------------------------------------- */

.fdq2-attempt-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--fdq2-line);
    margin-bottom: 0;
}

.fdq2-attempt-search,
.fdq2-page-size {
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--fdq2-line);
    border-radius: var(--fdq2-radius-sm);
    background: var(--fdq2-surface);
    color: var(--fdq2-ink);
    font-family: var(--fdq2-font);
    font-size: 13px;
}

.fdq2-attempt-search { flex: 1 1 180px; }

.fdq2-csv-btn {
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--fdq2-line);
    border-radius: var(--fdq2-radius-sm);
    background: transparent;
    color: var(--fdq2-ink);
    font-family: var(--fdq2-font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.fdq2-csv-btn:hover { border-color: var(--fdq2-moss); color: var(--fdq2-moss); }

/* Attempt list ----------------------------------------------------------- */

.fdq2-attempt-list-wrap { min-height: 60px; }

.fdq2-attempt-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fdq2-attempt-item,
.fdq2-attempt-list li {
    margin: 0;
    padding: 16px 0;
    border-bottom: 1px solid var(--fdq2-line);
}

.fdq2-attempt-meta { display: flex; align-items: baseline; gap: 12px; }

.fdq2-attempt-title {
    flex: 1;
    min-width: 0;
    font-family: var(--fdq2-serif);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.fdq2-attempt-score {
    color: var(--fdq2-moss);
    font-family: var(--fdq2-font);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fdq2-attempt-date {
    color: var(--fdq2-muted);
    font-family: var(--fdq2-font);
    font-size: 12px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.fdq2-attempt-delete {
    border: 0;
    background: transparent;
    color: var(--fdq2-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.fdq2-attempt-delete:hover { color: var(--fdq2-red); }

.fdq2-attempt-delete-all {
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--fdq2-line);
    border-radius: var(--fdq2-radius-sm);
    background: transparent;
    color: var(--fdq2-red);
    font-family: var(--fdq2-font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.fdq2-attempt-delete-all:hover { border-color: var(--fdq2-red); }

.fdq2-attempt-pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding-top: 18px;
    color: var(--fdq2-muted);
    font-family: var(--fdq2-font);
    font-size: 13px;
}

.fdq2-attempt-pager button {
    min-height: 36px;
    padding: 6px 14px;
    border: 1px solid var(--fdq2-line);
    border-radius: var(--fdq2-radius-sm);
    background: transparent;
    color: var(--fdq2-ink);
    cursor: pointer;
}

.fdq2-attempt-pager button:disabled { opacity: 0.35; cursor: not-allowed; }

/* Admin preview ---------------------------------------------------------- */

.fdq2-form-plain { border: 0; background: transparent; }
.fdq2-preview-title {
    margin: 0 0 20px;
    font-family: var(--fdq2-font);
    font-size: var(--fdq2-section);
    font-weight: 700;
    letter-spacing: var(--fdq2-tight);
}

.fdq2-correct-answer-note { color: var(--fdq2-red); }

/* Performance table (shortcode) ------------------------------------------ */

.fdq2-performance-table { max-width: 900px; }
.fdq2-performance-bar {
    width: 120px; height: 6px; border: 0; border-radius: 999px;
    appearance: none; -webkit-appearance: none; overflow: hidden; background: var(--fdq2-soft);
}
.fdq2-performance-bar::-webkit-progress-bar { background: var(--fdq2-soft); border-radius: 999px; }
.fdq2-performance-bar::-webkit-progress-value { background: var(--fdq2-moss); border-radius: 999px; }
.fdq2-performance-bar::-moz-progress-bar { background: var(--fdq2-moss); border-radius: 999px; }

/* Mobile: bottom sheet --------------------------------------------------- */

@media (max-width: 640px) {
    .fdq2-modal-overlay { align-items: flex-end; padding: 0; }

    .fdq2-modal {
        width: 100%;
        max-height: 90vh;
        border-radius: var(--fdq2-radius) var(--fdq2-radius) 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .fdq2-modal-head { position: relative; padding-top: 26px; }
    .fdq2-modal-head::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        width: 36px;
        height: 3px;
        border-radius: 999px;
        background: var(--fdq2-line);
        transform: translateX(-50%);
    }

    .fdq2-attempt-meta { flex-wrap: wrap; }
    .fdq2-modal-content { padding: 16px 20px 22px; }
}
