/* Search Bar */
.search-container {
    max-width: 600px;
    margin: 0 auto 3rem;
    position: relative;
    padding: 0 1rem;
}

.search-input {
    width: 100%;
    padding: clamp(0.75rem, 3vw, 1rem) clamp(1rem, 4vw, 1.5rem);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    color: var(--text-color);
    font-size: clamp(14px, 2.5vw, 16px);
    transition: border-color 0.2s;
    min-height: 44px;
}

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

@media (max-width: 640px) {
    .search-container {
        margin: 0 0 2rem 0;
        padding: 0;
    }
}

/* Problem Card */
.problem-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: clamp(0.8rem, 2.5vw, 1.1rem);
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.6rem;
    cursor: pointer;
}

.problem-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.problem-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-bottom: 0.35rem;
    flex-wrap: wrap;
}

.problem-card-header .problem-title {
    flex: 1 1 auto;
    min-width: 0;
}

.problem-summary {
    color: var(--text-muted);
    font-size: clamp(0.85rem, 2vw, 0.92rem);
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.15em * 3);
}

.problem-link {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary);
    font-weight: 600;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

.problem-link svg {
    width: 14px;
    height: 14px;
}

.problem-card:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(2,6,23,0.6);
    border-color: var(--primary);
    outline: none;
}

.problem-title {
    font-size: clamp(1.05rem, 3vw, 1.25rem);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.problem-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.badge {
    padding: 0.25rem clamp(0.5rem, 1vw, 0.75rem);
    border-radius: 9999px;
    font-size: clamp(0.65rem, 1.5vw, 0.75rem);
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge.easy { background: rgba(34, 197, 94, 0.1); color: var(--easy); }
.badge.medium { background: rgba(234, 179, 8, 0.1); color: var(--medium); }
.badge.hard { background: rgba(239, 68, 68, 0.1); color: var(--hard); }

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.3rem, 1vw, 0.5rem);
}

.tag {
    font-size: clamp(0.65rem, 1.5vw, 0.75rem);
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.1);
    padding: clamp(0.1rem, 0.5vw, 0.125rem) clamp(0.35rem, 1vw, 0.5rem);
    border-radius: 4px;
    white-space: nowrap;
}

/* Buttons refinement */
.btn {
    padding: clamp(0.4rem, 2vw, 0.5rem) clamp(0.6rem, 3vw, 1rem);
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background 0.2s;
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

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

@media (max-width: 375px) {
    .btn {
        padding: 0.4rem 0.6rem;
        font-size: clamp(0.75rem, 1.8vw, 0.85rem);
    }
}

@media (min-width: 1025px) {
    .problem-card {
        padding: 0.85rem 1rem;
        max-height: 240px;
        overflow: hidden;
    }

    .problem-summary {
        -webkit-line-clamp: 2;
        min-height: calc(1.15em * 2);
    }

    .problem-title {
        line-height: 1.15;
        margin-bottom: 0.25rem;
    }
}
