/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 44px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn--primary {
    background: var(--color-primary);
    color: white;
}

.btn--primary:hover {
    background: var(--color-primary-dark);
    color: white;
}

.btn--secondary {
    background: var(--color-surface);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn--secondary:hover {
    background: var(--color-surface-alt);
    color: var(--color-primary);
}

.btn--ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: none;
}

.btn--ghost:hover {
    color: var(--color-text);
}

.btn--sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    min-height: 32px;
    border-radius: var(--radius-md);
}

.btn--lg {
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    min-height: 48px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-elevated);
    transform: translateY(-2px);
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-lg);
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--color-border-light);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.badge--difficulty-easy {
    background: #DBEAFE;
    color: #0284C7;
}

.badge--difficulty-intermediate {
    background: #FEF3C7;
    color: #B45309;
}

.badge--difficulty-hard {
    background: #FEE2E2;
    color: #DC2626;
}

.badge--tag {
    background: var(--color-surface-alt);
    color: var(--color-primary);
}

.badge--success {
    background: #D1FAE5;
    color: #065F46;
}

.badge--muted {
    background: var(--color-border-light);
    color: var(--color-text-muted);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width var(--transition);
    width: 0%;
}

/* Feedback panel */
.feedback-panel {
    display: none;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border-left: 4px solid;
    margin-top: 1.5rem;
}

.feedback-panel.feedback--correct {
    display: block;
    background: #F0FDF4;
    border-left-color: var(--color-correct);
}

.feedback-panel.feedback--wrong {
    display: block;
    background: #FEF2F2;
    border-left-color: var(--color-wrong);
}

.feedback-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.feedback-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.feedback-correct .feedback-title {
    color: var(--color-correct);
}

.feedback-wrong .feedback-title {
    color: var(--color-wrong);
}

.feedback-explanation {
    color: var(--color-text);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 0.75rem;
}

.feedback-answer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.feedback-answer-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.feedback-answer-value {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-weight: 500;
}

.feedback-answer-correct .feedback-answer-value {
    background: #D1FAE5;
    color: #065F46;
}

.feedback-answer-wrong .feedback-answer-value {
    background: #FEE2E2;
    color: #991B1B;
}

/* Comments */
.comment-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    transition: all var(--transition);
}

.comment-toggle:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.comment-toggle.active {
    background: var(--color-surface-alt);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    margin-top: 1rem;
    display: none;
}

.comment-list.visible {
    display: block;
}

.comment-item {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    background: var(--color-surface-alt);
}

.comment-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.comment-author {
    font-weight: 600;
    color: var(--color-text);
}

.comment-body {
    color: var(--color-text);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Score ring */
.score-ring-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.score-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-primary) 0deg calc(var(--pct) * 3.6deg),
        var(--color-border) calc(var(--pct) * 3.6deg) 360deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-card);
}

.score-ring-inner {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-ring-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.score-ring-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form inputs */
input[type="text"],
input[type="search"],
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color var(--transition);
}

input[type="text"]:focus,
input[type="search"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(239, 90, 11, 0.1);
}

input[type="search"]::placeholder {
    color: var(--color-text-muted);
}

/* Catalog search input */
.catalog-search {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition);
}

.catalog-search:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Responsive */
@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        min-height: 48px;
        width: 100%;
    }

    .score-ring {
        width: 140px;
        height: 140px;
    }

    .score-ring-inner {
        width: 120px;
        height: 120px;
    }

    .score-ring-value {
        font-size: 2rem;
    }
}
