/* Math Practice Widget Styles - Eleriklass Theme */
.eleriklass-math-widget {
    --math-accent-color: var(--el-border-color, #bc0f0f);
    --math-font-family: var(--el-ui-font-family, "Assistant", sans-serif);
    --math-font-size: var(--el-ui-font-size, 16px);
    --math-font-weight-regular: 400;
    --math-font-weight-medium: 500;
    --math-font-weight-semibold: 600;
    --math-font-weight-bold: 700;
    width: 100%;
    margin: 20px 0;
    padding: 20px;
    background: #fffcef;
    border: 2px solid var(--math-accent-color);
    border-radius: 8px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-family: var(--math-font-family);
}

.eleriklass-math-title {
    text-align: center;
    color: var(--math-accent-color);
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: var(--math-font-weight-semibold);
    line-height: 1.3;
}

.math-problems {
    margin-bottom: 20px;
}

.math-problems {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.math-problem {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: #fffcef;
    border: 2px solid var(--math-accent-color);
    border-radius: 8px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    min-width: 100px;
    flex: 1;
}

.math-problem-label {
    font-size: var(--math-font-size);
    font-weight: var(--math-font-weight-medium);
    color: var(--math-accent-color);
    margin-bottom: 10px;
    text-align: center;
}

.math-points-info {
    font-family: var(--math-font-family);
    font-size: var(--math-font-size);
    font-weight: var(--math-font-weight-regular);
    color: var(--math-accent-color);
    opacity: 0.7;
    text-align: center;
    margin-bottom: 20px;
}

.math-problem-input {
    width: 68px;
    padding: 8px 12px;
    border: 2px solid var(--math-accent-color);
    border-radius: 8px;
    background: #fffcef;
    color: var(--math-accent-color);
    font-size: calc(var(--math-font-size) + 2px);
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    -moz-appearance: textfield;
}

.math-problem-input::-webkit-outer-spin-button,
.math-problem-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.math-problem-input:focus {
    outline: none;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.math-problem-input.correct {
    border-color: #006400;
    background-color: #f0fff0;
    color: #006400;
}

.math-problem-input.incorrect {
    border-color: #8b0000;
    background-color: #fff0f0;
    color: #8b0000;
}

.eleriklass-math-controls {
    text-align: center;
    margin-bottom: 20px;
}

.eleriklass-math-btn {
    display: inline-block;
    padding: 15px 30px;
    margin: 0 10px;
    background: #fffcef;
    color: var(--math-accent-color);
    border: 2px solid var(--math-accent-color);
    border-radius: 8px;
    font-size: var(--math-font-size);
    font-weight: var(--math-font-weight-medium);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.eleriklass-math-btn:hover {
    background: var(--math-accent-color);
    color: #fdfaf5;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.eleriklass-math-btn:active {
    transform: translateY(1px);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.eleriklass-math-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.eleriklass-math-btn.next-btn {
    background: #fffcef;
    color: var(--math-accent-color);
    border-color: var(--math-accent-color);
}

.eleriklass-math-btn.next-btn:hover {
    background: var(--math-accent-color);
    color: #fdfaf5;
}

.eleriklass-math-btn.retry-save-btn {
    background: #fffcef;
    color: var(--math-accent-color);
    border-color: var(--math-accent-color);
    border-style: dashed;
}

.eleriklass-math-btn.retry-save-btn:hover {
    background: var(--math-accent-color);
    color: #fdfaf5;
    border-style: solid;
}

.math-results {
    background: #fffcef;
    padding: 20px;
    border: 2px solid var(--math-accent-color);
    border-radius: 8px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.math-results h4 {
    margin-top: 0;
    color: var(--math-accent-color);
    font-size: 20px;
    font-weight: var(--math-font-weight-semibold);
    text-align: center;
}

#score-display {
    font-size: 18px;
    font-weight: var(--math-font-weight-semibold);
    margin-bottom: 15px;
    text-align: center;
    color: var(--math-accent-color);
}

#score-display.correct {
    color: #006400;
}

#score-display.incorrect {
    color: #8b0000;
}

#answers-display {
    margin-top: 15px;
}

.answer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--math-accent-color);
}

.answer-item:last-child {
    border-bottom: none;
}

.answer-problem {
    font-weight: var(--math-font-weight-medium);
    color: var(--math-accent-color);
}

.answer-result {
    font-weight: var(--math-font-weight-semibold);
}

.answer-result.correct {
    color: #006400;
}

.answer-result.incorrect {
    color: var(--math-accent-color);
}

/* Responsive design */
@media (max-width: 768px) {
    .eleriklass-math-widget {
        margin: 10px;
        padding: 15px;
    }
    
    .math-problems {
        flex-direction: column;
        gap: 15px;
    }
    
    .math-problem {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .math-problem-label {
        margin-bottom: 0;
        margin-right: 15px;
        text-align: left;
    }

    
    .math-problem-input {
        width: 88px;
    }
    
    .eleriklass-math-btn {
        display: block;
        width: 100%;
        margin: 10px 0;
    }
}

/* Loading state */
.eleriklass-math-widget.loading {
    opacity: 0.7;
    pointer-events: none;
}

.eleriklass-math-widget.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.eleriklass-math-btn.check-btn {
    color: var(--math-accent-color) !important;
}

.eleriklass-math-btn.check-btn {
    background: transparent;
    border: 2px solid var(--math-accent-color) !important;
    color: var(--math-accent-color) !important;
    font-weight: var(--math-font-weight-bold);
    border-radius: 8px;
}

.eleriklass-math-btn.check-btn:hover {
    background: var(--math-accent-color) !important;
    color: #fffcef;
}

/* Player name input */
.math-player-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.math-player-name label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: calc(var(--math-font-size) - 1px);
    font-weight: var(--math-font-weight-medium);
    color: var(--math-accent-color);
    white-space: nowrap;
}

.math-password-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 0;
}

.math-player-name .math-pin-label {
    display: none;
}

.math-pin-wrapper {
    display: none;
    align-items: center;
    gap: 2px;
}

.math-pin-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 2px;
    font-size: 1.1em;
    line-height: 1;
    opacity: 0.6;
    vertical-align: middle;
}

.math-pin-toggle:hover {
    opacity: 1;
}

#math-player-name {
    width: 110px;
}

#math-leaderboard-password {
    width: 90px;
}

#math-player-pin {
    width: 80px;
    text-align: center;
    letter-spacing: 3px;
}

.math-player-name input[type="text"],
.math-player-name input[type="password"] {
    padding: 6px 8px;
    border: 2px solid var(--math-accent-color);
    border-radius: 8px;
    background: #fffcef;
    color: var(--math-accent-color);
    font-size: calc(var(--math-font-size) - 1px);
    font-family: var(--math-font-family);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.3s ease;
}

.math-player-name input[type="text"]:focus,
.math-player-name input[type="password"]:focus {
    outline: none;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.math-warnings {
    text-align: center;
    min-height: 24px;
    margin-bottom: 8px;
}

.math-name-warning {
    display: inline-block;
    background: #fff0f0;
    border: 1px solid #8b0000;
    border-radius: 6px;
    color: #8b0000;
    font-size: 13px;
    font-weight: var(--math-font-weight-medium);
    padding: 4px 10px;
}

/* Leaderboard */
.math-leaderboard {
    margin: 15px 0;
}

.math-leaderboard-title {
    color: var(--math-accent-color);
    font-size: 18px;
    font-weight: var(--math-font-weight-semibold);
    margin-bottom: 10px;
    text-align: center;
}

.math-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--math-font-family);
    font-size: var(--math-font-size);
}

.math-leaderboard-table th {
    background: var(--math-accent-color);
    color: #fffcef;
    padding: 8px 12px;
    text-align: left;
    font-weight: var(--math-font-weight-semibold);
}

.math-leaderboard-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(188, 15, 15, 0.2);
    color: var(--math-accent-color);
}


.math-leaderboard-table tbody tr:hover {
    background: transparent;
}

.math-leaderboard-player td {
    font-weight: var(--math-font-weight-bold);
    background: rgba(188, 15, 15, 0.08);
}

.math-leaderboard-top1 {
    background: rgba(255, 215, 0, 0.18);
}

.math-leaderboard-top1 td {
    font-weight: var(--math-font-weight-bold);
    font-size: calc(var(--math-font-size) + 8px);
    color: var(--math-accent-color);
}

.math-leaderboard-top2 {
    background: rgba(192, 192, 192, 0.25);
}

.math-leaderboard-top2 td {
    font-weight: var(--math-font-weight-bold);
    font-size: calc(var(--math-font-size) + 5px);
    color: var(--math-accent-color);
}

.math-leaderboard-top3 {
    background: rgba(205, 127, 50, 0.18);
}

.math-leaderboard-top3 td {
    font-weight: var(--math-font-weight-bold);
    font-size: calc(var(--math-font-size) + 2px);
    color: var(--math-accent-color);
}
