/* ═══════════════════════════════════════
   Pygame Grader — front-end styles
═══════════════════════════════════════ */

/* ── Wrapper ── */
.pygrade-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 1.5rem 0;
    border: 1px solid #e2e4e7;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
}

/* ── Header ── */
.pygrade-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem 1rem;
    background: #1e1f2e;
    flex-wrap: wrap;
}
.pygrade-title {
    margin: 0;
    font-size: .9rem;
    font-weight: 700;
    color: #7c6af7;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.pygrade-best-badge {
    font-size: .75rem;
    font-weight: 700;
    padding: .25rem .65rem;
    border-radius: 20px;
    white-space: nowrap;
}
.pygrade-best-badge.passed  { background: #e8faf0; color: #1a7c46; }
.pygrade-best-badge.partial { background: #fff8e6; color: #8a6400; }

/* ── Trinket wrap ── */
.pygrade-trinket-wrap { position: relative; background: #000; }
.pygrade-trinket-iframe { display: block; border: 0; }
.pygrade-code-indicator {
    position: absolute;
    bottom: 8px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .7rem;
    color: #aaa;
    background: rgba(0,0,0,.6);
    padding: 3px 8px;
    border-radius: 12px;
    pointer-events: none;
}
.pygrade-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #666;
    transition: background .3s;
}
.pygrade-dot.ready { background: #50fa7b; }

/* ── Panel ── */
.pygrade-panel {
    padding: .75rem 1rem;
    background: #f9f9fb;
    border-top: 1px solid #e2e4e7;
}

/* ── Actions row ── */
.pygrade-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.pygrade-attempts {
    font-size: .8rem;
    color: #888;
}

/* ── Button ── */
.pygrade-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem 1.1rem;
    border: none;
    border-radius: 7px;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s, transform .1s;
    line-height: 1;
}
.pygrade-btn:active  { transform: scale(.97); }
.pygrade-submit-btn  { background: #50fa7b; color: #1a1a2e; }
.pygrade-submit-btn:hover { filter: brightness(1.1); }
.pygrade-submit-btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }

/* ── Loading ── */
.pygrade-loading {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .75rem 0;
    font-size: .85rem;
    color: #555;
}
@keyframes pygrade-spin { to { transform: rotate(360deg); } }
.pygrade-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-top-color: #7c6af7;
    border-radius: 50%;
    animation: pygrade-spin .7s linear infinite;
}

/* ── Error ── */
.pygrade-error {
    padding: .6rem .9rem;
    background: #fff2f2;
    border-left: 3px solid #e5534b;
    border-radius: 4px;
    font-size: .84rem;
    color: #c0392b;
    margin: .5rem 0;
}
.pygrade-login-notice {
    font-size: .85rem;
    color: #555;
    margin: .25rem 0 0;
}

/* ── Result card ── */
.pygrade-result {
    margin: .75rem 0 .25rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e4e7;
}
.pygrade-result.passed  { border-color: #b2e8c8; }
.pygrade-result.partial { border-color: #ffe08a; }
.pygrade-result.low     { border-color: #fcc; }

.pygrade-score-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1rem;
    background: #fff;
    flex-wrap: wrap;
}

.pygrade-score-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pygrade-score-circle.passed  { background: #e8faf0; }
.pygrade-score-circle.partial { background: #fff8e6; }
.pygrade-score-circle.low     { background: #fff2f2; }

.pygrade-score-circle .pygrade-score-num  { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.pygrade-score-circle.passed  .pygrade-score-num { color: #1a7c46; }
.pygrade-score-circle.partial .pygrade-score-num { color: #8a6400; }
.pygrade-score-circle.low     .pygrade-score-num { color: #c0392b; }
.pygrade-score-circle .pygrade-score-denom { font-size: .65rem; color: #aaa; }

.pygrade-score-meta { flex: 1; min-width: 180px; }
.pygrade-summary    { margin: 0 0 .4rem; font-size: .85rem; color: #333; }

.pygrade-score-bar-wrap {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: .45rem;
}
.pygrade-score-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .5s ease;
}
.pygrade-score-bar-fill.passed  { background: #2ecc71; }
.pygrade-score-bar-fill.partial { background: #f39c12; }
.pygrade-score-bar-fill.low     { background: #e74c3c; }

.pygrade-score-footer {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.pygrade-passed-badge {
    font-size: .7rem; font-weight: 700; padding: 2px 8px;
    border-radius: 10px; background: #e8faf0; color: #1a7c46;
}
.pygrade-needs-badge {
    font-size: .7rem; font-weight: 700; padding: 2px 8px;
    border-radius: 10px; background: #fff8e6; color: #8a6400;
}
.pygrade-personal-best {
    font-size: .7rem; color: #7c6af7; font-weight: 600;
}
.pygrade-personal-best.new { color: #2ecc71; }
.pygrade-attempt-count { font-size: .7rem; color: #aaa; margin-left: auto; }

/* ── Strengths / improvements ── */
.pygrade-section {
    padding: .6rem 1rem;
    border-top: 1px solid #f0f0f0;
    background: #fff;
}
.pygrade-section h4 {
    margin: 0 0 .4rem;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #888;
}
.pygrade-strengths,
.pygrade-improvements {
    margin: 0;
    padding: 0 0 0 1.1rem;
    font-size: .84rem;
    line-height: 1.6;
}
.pygrade-strengths li    { color: #1a7c46; }
.pygrade-improvements li { color: #555; }

.pygrade-hint {
    padding: .55rem 1rem;
    background: #f0eeff;
    border-top: 1px solid #e2d9ff;
    font-size: .82rem;
    color: #4a3b9a;
}

/* ── History ── */
.pygrade-history-wrap { margin-top: .6rem; }
.pygrade-history-toggle {
    background: none;
    border: none;
    color: #7c6af7;
    font-size: .8rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.pygrade-history { margin-top: .5rem; }
.pygrade-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
}
.pygrade-history-table th {
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid #e2e4e7;
    color: #888;
    font-weight: 600;
    font-size: .72rem;
    text-transform: uppercase;
}
.pygrade-history-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
}
.pygrade-muted { color: #aaa; font-style: italic; font-size: .82rem; }
